More Information about: Link: 1) http://www.onlinetradingconcepts.com/TechnicalAnalysis/KeltnerChannel.html Formula: In the modern version of Keltner Channels, the central line is (typically) a 20-period Exponential Moving Average. The upper and lower bands are drawn at an equal distance from the central line. The distance is defined as a specified multiple (typically 2x) of the ATR(10) indicator. In SharpCharts, the Keltner Channels take three parameters. The first one is the period of the central EMA. The second one is the multiplier for the bands. The last one is the period of the ATR indicator. The default parameter values are "20,2.0,10". In the chart above, we've added the ATR(10) indicator below the price plot. You can see how the Keltner Channel expands as the ATR(10) value rises and contracts when it shrinks. |
Source Code "KChannels Indicator": |
||
function init() { with (KChannels) { createBuffer("KChannels"); setBufferColor("KChannels", "#00FFAA"); setBufferDrawStyle("KChannels", DrawStyle.LINE); createBuffer("KChannels1"); setBufferColor("KChannels1", "#009999"); setBufferDrawStyle("KChannels1", DrawStyle.LINE); createBuffer("KChannels2"); setBufferColor("KChannels2", "#005555"); setBufferDrawStyle("KChannels2", DrawStyle.LINE); setAutoChangeMaxMin("KChannels", "KChannels1", "KChannels2"); createParameter("Period", 10); } } function start() { KChannels.label = "KChannels (" + KChannels.parameter("Period") + ")"; var num = Shared.numberOfQuotes(); var TypicalBuf = Shared.typical(); var HighBuf = Shared.high(); var LowBuf = Shared.low(); var KChannelsBuf = Shared.ema(KChannels.parameter("Period"), TypicalBuf); var DeltaBuf = new Array(num); for (var i = 0; i < num; ++i) { DeltaBuf[i] = HighBuf[i] - LowBuf[i]; } var DeltaBufSma = Shared.ema(KChannels.parameter("Period"), DeltaBuf); var KChannelsBuf1 = new Array(num); var KChannelsBuf2 = new Array(num); for (var i = 0; i < num; ++i) { KChannelsBuf1[i] = KChannelsBuf[i] + DeltaBufSma[i]; KChannelsBuf2[i] = KChannelsBuf[i] - DeltaBufSma[i]; } KChannels.setBufferData("KChannels", KChannelsBuf); KChannels.setBufferData("KChannels1", KChannelsBuf1); KChannels.setBufferData("KChannels2", KChannelsBuf2); } |