Nico.Muselle

[NM] EMADiff v01 - an indicator for everyone !

Allright gang, we are here with a new indicator that should help you with determining the direction to trade or whether you should trade at all.
It uses the close of the candle and 2 EMAs.
The faster moving line is the difference between the close and the Slow EMA, while the slower moving line shows the difference between the Fast EMA and the Slow EMA.

There are a couple of ways you can use this indicator, depending on your trading style :

For the quick profit, in and out :
- enable the safer trading option and keep smoothing at the default setting, buy when both lines are green, sell when both line are red and get out when one of the lines changes color (or when profit target is reached) (see the top option)

For longer trades :
- you can increase the smoothing, use a higher Slow EMA and disable the Safer trading option, enter either when both lines have the same color, either on a crossover. (the bottom option)

In both cases, if both lines hover around the zero line, the trend is definitely not strong.

Much more options are available so I would love to hear how you use this indicator. A thumbs up if you like it would be highly appreciated :)

Works nicely together with my other indicators below :
[RS][NM]Improved Linear Regression Bull and Bear Power v01

[NM]Improved Linear Regression Bull and Bear Power v02


To add this indicator (or any other) to your chart, click the "Add to favorites" button. Then while having the chart you wish to apply it to open, click on Indicators > Favorites > EMADiff v01 (or any other indicator that you favorited.
Remove from Favorite Scripts Add to Favorite Scripts
//@version=1
// this code uses the difference between the close of a candle and the slow EMA on one hand
// and the difference between the slow EMA and the fast EMA on the other hand
// Use : if both lines color green : buy, if both lines color red : sell
// Advice : 
// - watch price action and eventual support/resistance to try and eliminate false entries
// - use an ADX indicator in order to determine what moves are backed by momentum
// - for safer entries wait till both lines are above zero for buying, below zero for selling
// You can select to smoothen both lines by enabling it in the settings
// You can adapt the EMA settings to your likings, higher EMAs will smoothen out more and thus show less color changes


study(title='[NM] EMADiff v01', shorttitle='EMADiffv01', overlay=false)
fastEMA = input(title = 'Fast EMA (default = 12)', type = integer, defval = 12)
slowEMA = input(title = 'Slow EMA (default = 26)', type = integer, defval = 26)
smooth = input(title='Smooth ? (default = Yes)', type=bool, defval=true)
smap = input(title='Smooth factor (default = 10)', type=integer, defval=10, minval=2, maxval=20)
sigma = input(title='Sigma default = 6)', type=integer, defval=6)
safer = input(title='Show safer trades (default = yes)', type = bool, defval = true)


emadiff = ema(close,fastEMA) - ema(close,slowEMA)
emadiffp = close - ema(close,slowEMA)



ep = smooth ? alma(emadiffp, smap, 0.9, sigma) : emadiffp
ef = smooth ? alma(emadiff, smap, 0.9, sigma) : emadiff
pcolor = safer ? (ep[0] > ep[1] and ef[0] > ef[1] ? green : ep[0] < ep[1] and ef[0] < ef[1] ? red : yellow) : ep[0] > ep[1] ? green : red
fcolor = safer ? (ef[0] > ef[1] and ef[0] > 0 ? green : ef[0] < ef[1] and ef[0] < 0 ? red : yellow) : ef[0] > ef[1] ? green : red


plot(title='EMA Difference', series=ef, style=line, linewidth=2, color= fcolor)
plot(title='Difference to close', series=ep, style=line, linewidth=2, color= pcolor)
plot(0,title='zero line', color= gray, linewidth=1)


Good stuff Nico
+1 Reply
Nico.Muselle MOD Akil_Stokes
a year ago
Hey thanks Akil ! I like to share the stuff that helps me being profitable :)
Reply
This is similar to CCI actually.
+1 Reply
Nico.Muselle MOD IvanLabrie
a year ago
Yes, it is quite similar, but I prefer this one as I'm able to smooth it to my liking :)
Reply
IvanLabrie TOP Nico.Muselle
a year ago
Sure thing, no need to stick to the factory defaults. ;)
Cheers.
Reply
Freeeze
a year ago
Great stuff :)
A suggestion : I would just change when it wants to goes up with another color, a blue color for example...If you see what I mean lol
+1 Reply
Nico.Muselle MOD Freeeze
a year ago
You can freely choose your colors from the settings of the indicator, so have fun with it ;)
Reply
Freeeze Nico.Muselle
a year ago
Great :) Have a good one ;)
Reply
Nico.Muselle MOD Nico.Muselle
a year ago
Example
snapshot
Reply
Freeeze Nico.Muselle
a year ago
AH I see, but what I meant was: 4 color states: orange, red, blue and green... when it tends to drop(orange), when it drops(red), when it tends to goes up(blue) and finally when goes up in green ;)
Is it actually possible? Need to change in pcolor and fcolor I guess...and add a few conditions in that part certainly, is it C language?
Reply
Nico.Muselle MOD Freeeze
a year ago
it is definitely possible to add colors for different states, I myself prefer it to be simpler (I do not use the Safe setting) ... but there is a possibility to expand of course, You can always give it a try.
The script is pine script, you can find a reference for it here : https://www.tradingview.com/study-script-reference/
Reply
Freeeze Nico.Muselle
a year ago
Thanks Nico, I will definitely have a look and put my hands on it ;)
Reply
Freeeze Nico.Muselle
a year ago
Just need to change the p or fcolor line where it is written 'red:yellow' to 'red:blue' I guess ;)
+1 Reply
Nico.Muselle MOD Freeeze
a year ago
Just give it a try ... don't hesitate to share ;)
Reply
Freeeze Nico.Muselle
a year ago
Just tried Nico, it doesn't do as expected as we found somehow long transition period in yellow for this example. I need to code one by myself :P
It could be nice to do what I want directly in the candlesticks...But maybe it has been done already lol
Reply
Freeeze Nico.Muselle
a year ago
Coded: the CM SLING SHOT SYSTEM by Chris Moody :)
Reply
Freeeze Nico.Muselle
a year ago
Associated with your EMA indicator, a NO_lagMACD, vwap, zig zag, scalper buy/sell arrows and sequence counter would be a killer scalping framework :)
+1 Reply
Freeeze Nico.Muselle
a year ago
Orange and blue would be good indicators to short or long if used as scalper ;)
Reply
AndrewHook
a year ago
Merci Nico, have a good one.
+1 Reply
Ivan Ivanov0f
a year ago
Hello Guys, when I copy the code and safe it, then it does not want to work and show on the graph, Anyone can help me with this? Thanks
Reply
Nico.Muselle MOD Ivan Ivanov0f
a year ago
To add this indicator (or any other) to your chart, click the "Add to favorites" button. Then while having the chart you wish to apply it to open, click on Indicators > Favorites > EMADiff v01 (or any other indicator that you favorited.
Reply
Ivan Ivanov0f
a year ago
Oh, I see, this is not a MT4 platform indicator. Thanks. I would not work I guess.
+1 Reply
Nico.Muselle MOD Ivan Ivanov0f
a year ago
indeed, it's only for use on the TradingView platform :)
Reply
gianfranco60
a year ago
Thank you for your useful indicator . I was trying something
+1 Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener 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 Billing Sign Out