//Created by Chrismoody on 7/22/2014 By Request for user lucalucious //Modified Heikinashi with EMA Filter... //Choice To Plot EMA Trend Is Based Off Of study(title = "CM_Modified_Heik_Trend_Bars", shorttitle="CM_TrendBars",overlay=true) note = input(false, title="Lower Numbers = More Sensitive to Price Change...Higher Numbers = Less Sensitive") uema = input(34, minval=1, maxval=50, title="EMA UpTrend") dema = input(34, minval=1, maxval=50, title="EMA DownTrend") shema = input(false, title="Show EMA Trend is Based On?") haclose = (open + high + low + close)/4 haopen = na(haopen) ? (open + close)/2 : (haopen + haclose) / 2 upEma = ema(haclose, uema) downEma = ema(haopen, dema) emaAvg = (upEma + downEma)/2 heikUpColor() => hlc3 >= emaAvg heikDownColor() => hlc3 < emaAvg col = hlc3 >= emaAvg ? lime : hlc3 < emaAvg ? red : white barcolor(heikUpColor() ? lime: heikDownColor() ? red : na) plot(shema and emaAvg ? emaAvg : na, title="EMA UpTrend", style=line, linewidth=3, color=col)
- http://i.imgur.com/NbZRJBd.png (Amazon, weekly chart)
That's a screen shot of Amazon weekly. The top blue arrow points to the 4-week EMA that your indicator bases the bar color on. It's a 4 week EMA (up & down). The lower blue arrow points to a standard 4-week EMA plotted on price (blue line).
As of the close of this week (last week in Oct. 2014), price has closed above the standard 4-week EMA, but not above the 4-week EMA that is plotted by your indicator. Which is why I was wondering if there was some kind of smoothing or if it was based on the slope of the EMA or if the calculations were based on something other than the close of price because it isn't matching up to a generic, out-of-the-box EMA.
Any thoughts would be great. Thanks.
If you keep the defaults at 34...and check the last checkbox to show EMA.... and you plot a regular 34EMA as another indicator....Then the plots are almost identical. The difference is the EMA's I use are based on the True Heikin-Ashi Close. Hence the title....Modified Heikin-Ashi. Whereas the EMA from the the indicators you plot is based off the Close...Not the Heikin-Ashi Formula.
Excellent. That makes sense. Appreciate the reply and info. Thanks.
If i put a regular EMA on a standard bar/candle chart and then plot this indicator as well, there are times when price closes above or below the regular EMA and this indicator does not change color to reflect the fact that price has closed above/below the regular EMA. On weekly charts, it's quite a bit off.
Is there a smoothing applied to this or is it based on the slope of the EMA and not the price closing above/below the EMA? In the code, it appears to me, that the color change might be based off an EMA closing related to Heiken-Ashi bars. Is that the case?
I appreciate your work and time. Any thoughts on this would be great. Thanks.