Created By Request for lucalucious

Allows for EMA Smoothing with different values for Up and Down Trend.

Ability to Plot EMA to see Trend Filter
Remove from Favorite Scripts Add to Favorite Scripts
//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[1]) ? (open + close)/2 : (haopen[1] + haclose[1]) / 2

upEma = ema(haclose, uema)
downEma = ema(haopen, dema)

emaAvg = (upEma + downEma)/2

heikUpColor() => hlc3 >= emaAvg
heikDownColor() => hlc3 < emaAvg

col = hlc3 >= emaAvg[1] ? lime : hlc3 < emaAvg[1] ? red : white

barcolor(heikUpColor() ? lime: heikDownColor() ? red : na)
plot(shema and emaAvg ? emaAvg : na, title="EMA UpTrend", style=line, linewidth=3, color=col)
AWESOME indicator, I will test it with my EURAUD idea
HamzaLeith HamzaLeith
On the daily you can see that drop from wave 3 to 4 not on the weekly though how come??
HamzaLeith HamzaLeith
ChrisMoody PRO HamzaLeith
Not sure what you mean....It's not a wave pattern's a modified Heikin-Ashi with EMA's that smooth out the trend...The ema's can be adjusted to be more sensitive or less sensitive...Just use the checkbox on the inputs tab to add the EMA and adjust to see if you can get what your looking for...but the indicator isn't designed for your specific use...

Let me know if I misread what you were saying...But thanks for the reply....

This would be an excellent Indicator for you if you trade anything besides forex
Indicator: Weis Wave Volume [LazyBear]

HamzaLeith ChrisMoody
Hi Chris, I meant wave iii to iv according to my own count. Another example is the drop from the beginning of 2014 till can see on the weekly the bearish candles are in the beginning green. But on the daily It is much more sensitive. Thank you for the feedback, I'll play around with the sensitivity and let you know. This momentum based indicator is very complimentary to my strategy for extra confirmation. Thanks again for sharing
ChrisMoody PRO HamzaLeith
Thanks for the comment...I'm here to help in any way possible.
Thank you for sharing!!
ChrisMoody PRO HamzaLeith
No problem...Thanks for the comments
Kudos to lucalucious for a good idea and thank you Chris, will put this in the tool box.
ChrisMoody PRO ProphetProfit
always a pleasure to hear from you...thanks
Nice... One. I am new to tradingview... how can insert this indicator to my chart window... Please help me
If 'll get a video recorded tonight. If your around feel free to PM me and I'll be happy to do a quick Screen share.
I just uploaded a new video. Go to and the first video Titled "The Basics" Importing Custom Indicators is the one you want to watch.
+2 Reply
Hello Chris;

Thanks for the indicator. I love it and I appreciate your time and effort.

One question: what happens if I add this to regular candles/bars? Does it paint the standard candles/bars with the calculations based off Heiken-Ashi or does it paint the bars calculating the moving average as if it were on standard candles/bars (e.g., a 13-EMA based off Heiken-Ashi candles vs. a 13-EMA based off regular candles/bars)?

Thanks. Cheers.

No...This indicator is ONLY to be applied to regular Candlestick/Bar charts....NOT Heikin-Ashi Bars. On Regular Candles/Bars it just shows the same Color the Heik candles would show. This indicator allows you to see the actual Price Action of the regular candles...Like Gaps, and Candle patterns.

I started using it 10 years ago b/c regular Heikin-Ashi candles mess up other indicators...b/c they don't show the true Open...High...Low Values.
Shepard PRO ChrisMoody
Awesome. Appreciate your reply and your work here. Cheers.

I completely gave you the wrong answer. This code simply highlights the bars based on being above or below a Moving average. You could use this code on any type of bars.

The code that I was thinking this was is my Heikin-Ashi Paint Bars. That is the Indicator that plots exactly the same colors as true Heikin-Ashi Bars.

Here is that Indicator:
CM Heikin-Ashi Candlesticks_V1

Shepard PRO ChrisMoody
Ah, gotcha... cool. :-)
Hmmm... this indicator definitely does not highlight bars based on being above or below a regular EMA (a standard EMA pulled from the "Built In" section). At least, not on standard bar/candle charts.

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.

For example:

- (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.

Cheers. :-)
All you have to do is go to the Inputs Tab. It defaults to a 34 EMA for the up trend and down trend. you can modify the UpTrend eMA and the DownTrend EMA values in the inputs tab. If you select the last checkbox it plots the ema on the screen. You can clearly see if the Price (HLC/3) is above the EMA the bars color green. Or red if price is below the EMA. it uses a EMA Avg if you change the values so they are different on the UpTrend and Down Trend. So if you keep the values the same for both...then that is what they use.

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.
+1 Reply
Shepard PRO ChrisMoody
"...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.

Cheers. :-)
This is the script you were probably thinking of. still uses the HLC/3 to change the Bar color...this filters out false breaks above below the EMA.

CM EMA Trend Bars

+2 Reply
ChrisMoody PRO ChrisMoody
That will match any EMA you plot on the chart perfectly
Shepard PRO ChrisMoody
Awesome. Yep, this is exactly what I was thinking of. Much appreciated. :-)
Hello this is a great indicator!One question though ...I am new on this and i have tried out to create an alert when colours turn from red to green and the opposite.
Can it be done?
ChrisMoody PRO xariskontos
Funny You asked...I just posted a video on ho wto do this...Go to the thread below and check out the video...If you have trouble following the instructions for this indicator make a request on the link below...and I will help you out...

New Video On How To Create Alerts w/ Any Custom Indicator!!!

for what time frame?
United States
United Kingdom
Home Stock Screener Forex Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Account and Billing Sign Out