hello. I needed help with a code in ema so that it will buy when ema 5.8.13.21 is in sequence just as I show in the picture. I have written examples 5>8 and 13>21 but I don’t really think it makes the right inputs on the script. Can I write something else?
This is an indicator, just remove the last 5 lines and use UPtrend and DNtrend to tell the position of EMAs:
src = CustomClose
Ema5 = average[5,1](src)
Ema8 = average[8,1](src)
Ema13 = average[13,1](src)
Ema21 = average[21,1](src)
UPtrend = (Ema5 > Ema8) AND (Ema8 > Ema13) AND (Ema13 > Ema21)
DNtrend = (Ema5 < Ema8) AND (Ema8 < Ema13) AND (Ema13 < Ema21)
x = UPtrend
IF x = 0 THEN
x = -DNtrend
ENDIF
RETURN x coloured by (x) Style(Histogram,1) AS "Trend, 1=UP, 2=DOWN"
Thanks for quick reply it is appreciated