if ((Position.MarketPosition == MarketPosition.Long)
&& (LongTrades == true)
&& (TradeStableBars == true)
&& (Position.Quantity > 0)
&& (BarsSinceEntryExecution(0, "", 0) == 1)
&& (Close[1] > Open[1])
&& (SellPositionFIRSTBar == false)
&& (BarsSinceExitExecution(0, "", 0) != 0)
&& (UseExitScaleOutBar2thru5 == true))
{
ExitLong(Convert.ToInt32(ContractsorSharestoScaleO ut), @"L Scale2 Exit", @"");
ProfitTargetMode1 = 5;
}
// Set 99
if ((Position.MarketPosition == MarketPosition.Long)
&& (LongTrades == true)
&& (TradeStableBars == true)
&& (Position.Quantity > 0)
&& (BarsSinceEntryExecution(0, "", 0) == 2)
&& (Close[1] > Open[1])
&& (SellPositionFIRSTBar == false)
&& (UseExitScaleOutBar2thru5 == true)
&& (BarsSinceExitExecution(1, "", 0) == 0))
{
ExitLong(Convert.ToInt32(ContractsorSharestoScaleO ut), @"L Scale3 Exit", @"");
ProfitTargetMode1 = 5;
}
************************************************** ***********
above i am beginning the exit process on bar 2 in the Set 98, this works as expected, how ever I cannot get the Next bar exit to work as expected
the stategy is running OnPriceChange
I am using this additional line of code to keep the second exit from sending out more that ONE exit order
&& (BarsSinceExitExecution(1, "", 0) == 0))
ior this as well && (BarsSinceExitExecution(0, "", 0) == 0))
either of these back test showing exits as expected, but in live data sim accounts only the First exit occurs, if i omit the && (BarsSinceExitExecution(1, "", 0) == 0)) line of code then the second exit will continue to send out orders until the complete position is sold
Comment