Can someone help me adding buy and sell condition to this AFL.
Buy Condition :- IF Price closes above PDL from below after 9:30 am
Sell Condition :- IF Prices closes below PDH from above after 9:30 am
SL are Few points below PDH and PDL
To Clarify this is my complete requirement
I am looking for a failed breakout strategy where either the day opens below Previous day high.... Candles crossses above PDH during the day but anytime after 9:30 it comes and closes below PDH. I want the sell signal to be generated on the break of low of the candle which closes below PDH with a target profit till PDL and Stop few points above PDH or if it is a gapup then once crosses below PDH after 9:30 a sell signal should be generated and vice versa for gapdown
Appreciate if someone can help me in building the buy and sell condition in the attached AFL.... Appreciate your support!
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat(EncodeColor( colorGold) + "{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
SetChartOptions(0,chartShowArrows|chartShowDates);
Plot( C, "Price", colorDefault, styleCandle );
PDH = TimeFrameGetPrice("H",inDaily,-1);
PDL = TimeFrameGetPrice("L",inDaily,-1);
Plot(PDH,"Upper",colorGreen,styleLine | styleThick);
Plot(PDL,"Lower",colorRed,styleLine | styleThick);