I have defined Buy Sell Conditions. Now i want to define one more condition for Sell if there is a Close below the Buy Candle. I am putting a sample code below. Now, whenever there is a close below the buy candle, i want the sell to occur. Its like reversing the failed buy trade.
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
_N( Title = Title +"\n" + _DEFAULT_NAME() );
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
Buy = Close > Open
AND MACD( 12, 26 ) > MACD( 6, 13 );
Sell = Close < Open
AND MACD( 12, 26 ) < MACD( 6, 13 );
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorBlue,0,Low,Offset=-15);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),coloryellow,0,Low,Offset=-50);