I am not sure if I have done the right thing here. I have used MarketPosition.Flat instead of StrategyPosition.Flat.
// Resets the stop loss to the original value when all positions are closed
if (Position.MarketPosition == MarketPosition.Flat)
{
SetStopLoss(CalculationMode.Ticks, Stop);
barcounter = 0;
}
Found this in the help centre
int StrategyPosition(string strategyId)
Gets the position for a strategy. Returns 0 for flat, negative value for short and positive value for long.
What would be the correct method to use I came up with this.
int StrategyPosition(string strategyId)
if (StrategyPosition > 0)
{
SetStopLoss(CalculationMode.Ticks, Stop);
barcounter = 0;
}
Any help appreciated.

Thanks Raef

Comment