if (
((Position.MarketPosition == MarketPosition.Long)
&& ((Position.AveragePrice - (StopLoss * TickSize)) <= (Low[0] + (-1 * TickSize)) )
&& ((Position.AveragePrice + (1 * TickSize)) > Low[0])
&& (Breakeven == false)))
{
SetStopLoss(@"Long" , CalculationMode.Ticks, StopLoss, false);
}
// Set 2
if (
((Position.MarketPosition == MarketPosition.Long)
&& ((Position.AveragePrice - (StopLoss * TickSize)) <= (Low[0] + (-1 * TickSize)) )
&& ((Position.AveragePrice + (1 * TickSize)) > Low[0])
&& (Breakeven == false)))
{
SetStopLoss(@"Long" ,CalculationMode.Ticks, 6, false);
}
// Set 3
if (
((Position.MarketPosition == MarketPosition.Long)
&& ((Position.AveragePrice + (1 * TickSize)) <= (Low[0]) )
&& (Breakeven == false)))
{
SetStopLoss(@"Long" ,CalculationMode.Ticks, 2 , false);
Breakeven = true;
}
// Set 4
if (Position.MarketPosition == MarketPosition.Flat)
{
Breakeven = false;
}
The problems I am having is in Playback.
On Current candle 0, my order executes but with Set 3 Stoploss, the Original StopLoss is 13 , not 2SL as it is in set 3.
The next Candle closes , and then the StopLoss is updated to Set 2 Stoploss of 6SL.
The next candle closes and the StopLoss is back to Set 3 of 2SL, and never resets again.
If Set 3 is valid, then the flag should have been flipped on "Breakeven" to true in Set 3 , and Set 2 could have never been executed.
When I remove Set 4 all together , Set 3 holds and the SL never moves. I am so confused.
Please help.
Basically I am simply trying to follow the bottom of the candle until the LOW is greater than BE +1 , that is all. And if the initial SL is greater than the first candle LOW.

Comment