if (Position.MarketPosition == MarketPosition.Flat)
{
SetStopLoss("", CalculationMode.Ticks, 8, false);
}
// If a long position is open, allow for stop loss modification to breakeven
else if (Position.MarketPosition == MarketPosition.Long)
{
// Once the price is greater than entry price + x ticks, set stop loss to breakeven
if (Close[0] > Position.AvgPrice + 3 * TickSize)
{
SetStopLoss(CalculationMode.Price, Position.AvgPrice);
}
if (Close[0] > Position.AvgPrice + 8 * TickSize)
{
SetStopLoss(CalculationMode.Price, Position.AvgPrice + 4 * TickSize);
Is it possible to switch CalculateOnBarClose from true to false. ex: it is set to true unless (Position.MarketPosition != MarketPosition.Flat) and then switch it back to true when Flat?

Comment