Colored EMA/SMA at Tradingview.com

BenTen

BenTen

Administrative
Staff
VIP
I don't have my ToS open, so here is the code for that, shared by @AlgoTrader77

Code:
plot myindicator=ExpAverage(close,20);
myindicator.SetDefaultColor(Color.White);
myindicator.AssignValueColor(if close>=myindicator then Color.Green else Color.Red);
myindicator.SetStyle(curve.LONG_DASH);
myindicator.SetPaintingStrategy(paintingstrategy.LINE_VS_SQUARES);
myindicator.SetLineWeight(5);
myindicator.setHiding(if close>open(period="DAY") then 0 else 1);
 
3AMBH

3AMBH

Member
2019 Donor
VIP
plot myindicator=ExpAverage(close,20); myindicator.SetDefaultColor(Color.White); myindicator.AssignValueColor(if close>=myindicator then Color.Green else Color.Red); myindicator.SetStyle(curve.LONG_DASH); myindicator.SetPaintingStrategy(paintingstrategy.LINE_VS_SQUARES); myindicator.SetLineWeight(5); myindicator.setHiding(if close>open(period="DAY") then 0 else 1);
Thank you Ben. Much appreciated.
 
3AMBH

3AMBH

Member
2019 Donor
VIP
Here is what it looks like after placed on a TOS Chart....The Red & Green dashed line and I have it set to default of 20. If you want to change the default setting go to the code and change the 20 to maybe 15.


Code:
plot myindicator=ExpAverage(close,15);
myindicator.SetDefaultColor(Color.White);
myindicator.AssignValueColor(if close>=myindicator then Color.Green else Color.Red);
myindicator.SetStyle(curve.LONG_DASH);
myindicator.SetPaintingStrategy(paintingstrategy.LINE_VS_SQUARES);
myindicator.SetLineWeight(5);
myindicator.setHiding(if close>open(period="DAY") then 0 else 1);


 
Last edited:

Similar threads

Top