Hello,
Can someone kindly help this this code for a screener?
the criteria…Please see screenshot example..
For buys..
A bar/ candle that opens and closes fully in the top +50% (or greater )and 8 ema line is above a 20 ema
and candle must have touched either of the 8 or 20 EMA lines
For sells..
A bar/ candle that opens and closes in the -50% or less and 8 ema is below a 20 ema and has touched either of the moving averages.
Thanks very much
There you go:
Ema8 = average[8,1](close)
Ema20 = average[20,1](close)
//
L1 = Ema8 > Ema20
S1 = Ema8 < Ema20
//
L2a = min(open,close) >= (low + (range / 2))
L2b = max(open,close) >= (low + (range / 2))
L2 = L2a AND L2b
//
S2a = min(open,close) <= (high - (range / 2))
S2b = max(open,close) <= (high - (range / 2))
S2 = S2a AND S2b
//
L3 = (low <= max(Ema8,Ema20)) AND (min(close,open) >= max(Ema8,Ema20))
S3 = (high >= min(Ema8,Ema20)) AND (max(close,open) <= min(Ema8,Ema20))
//
CondL = L1 AND L2 AND L3
CondS = S1 AND S2 AND S3
Cond = 0
IF CondL THEN
Cond = 1
ELSIF CondS THEN
Cond = 2
ENDIF
SCREENER[Cond](Cond AS "1=↑, 2=↓")
Wonderful. Thanks very much for your help 🙂