KeltnerATR using Ema
Author: topcat77
Creation Date: 10/7/2009 8:34 PM
profile picture

topcat77

#1
Has anybody scripted an indicator for KeltnerATR using Ema of AP ?
profile picture

Eugene

#2
I believe it's extremely simple, one-line code - something like EMA.Series( AveragePriceC.Series(Bars), period, EMACalculation.Modern).
profile picture

topcat77

#3
Eugene, the Ema part I get. But how do I embed that into the code for the KeltnerATR Indicator to make a KeltnerATR-EMA indicator ? Thanks
profile picture

Eugene

#4
Upper band:
CODE:
Please log in to see this code.

Lower band:
CODE:
Please log in to see this code.

QUOTE:
But how do I embed that into the code for the KeltnerATR Indicator to make a KeltnerATR-EMA indicator ?

Now I understand that you want to modify the compiled indicator in our library. The source code for Community.Indicators is open, you would need to install MS Visual Studio (Express) or SharpDevelop, load the project, make sure that target .NET framework is 2.0, navigate to Bands.cs, and modify the KeltnerATR classes almost as shown above (i.e. change the SMA to an EMA).
profile picture

topcat77

#5
I'll try and make Dataseries for the two bands (maybe using the simpler Keltner rather than the KeltnerATR) but please may I request both Keltner EMA and KeltnerATR EMA for a future update of Community.Indicators . Thank You
profile picture

Eugene

#6
As a rule, Community.Indicators accepts custom indicators that involve a minimum of 4 simple math operations. Hence, adding this one-line function (EMA of HLC/3) doesn't sound like a good addition.

Regarding Keltner EMA + ATR, please take a look at what is already available in Community.Indicators:

ATRBandLower
ATRBandUpper

Just pass an EMA of AveragePriceC.Series as the data series parameter of ATRBandLower/ATRBandUpper, and voila -- you have a Keltner EMA + ATR.
profile picture

Eugene

#7
P.S. Adding a modification of Keltner Bands also doesn't sound like a good idea as it possibly can create confusion. Modifying the existing KeltnerATR to accept a choice of MAs is feasible, but a) will break backward compatibility for those who are already using it, and b) this is not going to be universal - we can only hardcode a handful of typical MAs like SMA, EMA and WMA, but what if at some point in time someone asks about, say, ASEMA/VMA/HullMA_of_(OHLC/4) etc.?

So, my advice above on marrying an EMA(AveragePriceC) with ATRBand* in your strategy seems like more universal approach.
profile picture

topcat77

#8
That worked - Thanks v m
profile picture

lukeallen63

#9
Due to my lack of programming experience, I cannot implement successfully the above mentioned alternative to the Keltner EMA ATR bands. I don't know where to insert the EMA part to the ATR bands. Any Help?

PS, according the stockcharts.com, this indicator doesn't seem too complex. I understand from the posts before that to modify the current Keltner bands indicator is not a good solution, why can't you just create a whole new indicator where you can specify the ATR multiple and period? It seems like Ninjatrader and Multicharts both have this capability coded right into the indicator. Again, this is probably due to my lack of programming expertise, but any commment on that?

here is the link to simple parameters of the indicator...

http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:keltner_channels

Thanks,


profile picture

Eugene

#10
Are you looking for something like this?

CODE:
Please log in to see this code.


Since this is simple, I hope that understanding it will add to your programming experience. For the basics, please read the WealthScript Programming Guide > DataSeries.
profile picture

lukeallen63

#11
Thanks Eugene, seems to be exactly what I was looking for!
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).