when im in longtrade i want to exit trade and make a limit order
the strategy ignore limit order
here is the code
else if(((ab.ShortSignal[0] == 1 ) ) && !sell1 && BarsInProgress == 0 && Short && Position.MarketPosition != MarketPosition.Short){
ExitLong("Buy1");
ExitLong("Buy2");
if(true ){
if(GetCurrentBid() > c1[0]){
// Stop Loss
SetStopLoss("Sell1", CalculationMode.Price, GetCurrentBid() + isl*TickSize, false);
SetStopLoss("Sell2", CalculationMode.Price, GetCurrentBid() + isl*TickSize, false);
// Profit Target:
SetProfitTarget("Sell1", CalculationMode.Price, GetCurrentBid() - tp1*TickSize);
SetProfitTarget("Sell2", CalculationMode.Price, GetCurrentBid() - tp2*TickSize);
EnterShort(q1,"Sell1");
EnterShort(q2,"Sell2");
}
else{
SetStopLoss("Sell1", CalculationMode.Price, c1[0] + isl*TickSize, false);
SetStopLoss("Sell2", CalculationMode.Price, c1[0] + isl*TickSize, false);
// Profit Target:
SetProfitTarget("Sell1", CalculationMode.Price, c1[0] - tp1*TickSize);
SetProfitTarget("Sell2", CalculationMode.Price, c1[0] - tp2*TickSize);
EnterShortLimit(0, true, q1, c1[0], "Sell1");
EnterShortLimit(0, true, q2, c1[0], "Sell2");
}

Comment