Hi
I am stuck at creating buy condition.
Condition 1 = close above 52 week high
Condition 2 = while sell condition is NOT TRUE and price cross EMA(20)
Buy = Condition 1 AND Condition 2
Sell = Cross(EMA(20),EMA(10)
Problem with Condition 1 is after making close above 52 weeks, next week it will go below and conditon become false.
What I was trying to do was
-looking for stock that close above 52 week high
-And wait for the price to come down to EMA(20) and buy.
crss_hh52 = Cross(C,Ref(HHV(H,52),-1));
crss_ema = Cross(C,EMA(C,20));// or near above EMA or ...
Buy = crss_ema AND BarsSince(crss_hh52) > 0;
Sell = Cross(EMA(C,20),EMA(C,10));