Maybe I'm getting it confused. Should I add language to set an initial stop loss at a certain amount of ticks, then have a trailing stop take over?
I'm new to the Algo game, so any help would be much appreciated.
// Update trailing stop logic
if (Position.MarketPosition == MarketPosition.Long)
{
double stopPrice = Low[0] - 6 * TickSize; // Calculate 6-Tick trailing stop
if (High[0] > High[1]) // Check if current high is greater than previous high
{
stopPrice = Math.Max(stopPrice, High[0] - 6 * TickSize); // Adjust stopPrice based on current high
}
SetTrailStop(CalculationMode.Price, stopPrice);
}
else if (Position.MarketPosition == MarketPosition.Short)
{
double stopPrice = High[0] + 6 * TickSize; // Calculate 6-Tick trailing stop
if (Low[0] < Low[1]) // Check if current low is lower than previous low
{
stopPrice = Math.Min(stopPrice, Low[0] + 6 * TickSize); // Adjust stopPrice based on current low
}
SetTrailStop(CalculationMode.Price, stopPrice);
}

Comment