I have created one simple code where buying above first candle high and shorting below first candle low.
With this I want to add criteria which says that, for buy signal it should not break today's low and it should not break today's high for short signal before taking those trades. (It is fine if its breaks after trades are completed).
But it removes old buy or short signal if high/low is broken after trade completion.
FCL=ValueWhen(Day()!=Ref(Day(),-1),L); // Day first candle low FCH=ValueWhen(Day()!=Ref(Day(),-1),H); // Day first candle high Buy = Cross(H,FCH) AND L >= FCL; // Low should not be broken before buy Sell = Cross(EMA(C,10),C ); Short = Cross(FCL,L) AND H <= FCH; // High should not be broken before sell Cover = Cross(C, EMA(C,10));
Short signal screenshot before high was broken :
Please find the screenshots with
Signals removed after high is broken :
I have tried multiple options with valuewhen , timenum etc but not able to figure it out.
Could you please help to correct the same.