Is there a possibility for the stoploss to remain fixed in its new position once the trigger is activated? although the strategy is on each tick? Thank you for your help it would help me a lot
private void AdjustTrailingStop()
{
if (Position.MarketPosition != MarketPosition.Flat && !isStopLossAdjusted)
{
double entryPrice = Position.AveragePrice;
double currentPrice = Close[0];
double tickSize = TickSize;
if (Position.MarketPosition == MarketPosition.Long)
{
if (currentPrice >= entryPrice + TriggerTicks * tickSize)
{
double newStopPrice = entryPrice + TrailingTicks * tickSize; // TrailingTicks ticks above entry
SetStopLoss(CalculationMode.Price, newStopPrice);
isStopLossAdjusted = true;
}
}
else if (Position.MarketPosition == MarketPosition.Short)
{
if (currentPrice <= entryPrice - TriggerTicks * tickSize)
{
double newStopPrice = entryPrice - TrailingTicks * tickSize; // TrailingTicks ticks below entry
SetStopLoss(CalculationMode.Price, newStopPrice);
isStopLossAdjusted = true;
}
}
}

Comment