Hi; I wonder if You can help me with this.
I would like to have a proscreener with the following conditions:
- An 8-day exponential moving average (EMA) that is turning upwards.
- The 8-day EMA must also be higher than the last time the 8-day EMA turned upwards.
There you go:
ONCE CurrTurn = 0
ONCE PrevTurn = 0
Cond = 0
Sma8 = average[8](close)
UPturn = (Sma8 > Sma8[1]) AND (Sma8[1] < Sma8[2])
IF UPturn THEN
PrevTurn = CurrTurn
CurrTurn = Sma8
IF CurrTurn > PrevTurn THEN
Cond = 1
ENDIF
ENDIF
SCREENER[Cond]
Thank you for helping me, but it doesn´t work for me. I gets all kind of different hits.
My bad, I incorrectly coded SMA instead of EMA.
This is correct:
ONCE CurrTurn = 0
ONCE PrevTurn = 0
Cond = 0
Ema8 = average[8,1](close)
UPturn = (Ema8 > Ema8[1]) AND (Ema8[1] < Ema8[2])
IF UPturn THEN
PrevTurn = CurrTurn
CurrTurn = Ema8
IF CurrTurn > PrevTurn THEN
Cond = 1
ENDIF
ENDIF
SCREENER[Cond]