// Resets the trailing stop to the original value when all positions are closed
if (Position.MarketPosition == MarketPosition.Flat)
{
SetTrailStop(CalculationMode.Ticks, TrailingStop);
}
// If a long position is open, allow for trailing stop modification
else if (Position.MarketPosition == MarketPosition.Long)
// Once the price is greater than entry price+50 ticks, set trailing stop to half of use input
Close[0] > Position.AvgPrice + 50 * TickSize)
{
SetTrailStop(CalculationMode.Price, TrailingStop/2);
}
Comment