SamplePriceModification.zip and compiled it based on my specs, but the modification never gets executed when running a strategy. It seems to work when running a backtest, not entirely sure though. Is there something I'm missing? Lets say I simply want to lock in 4 ticks profit once 13 ticks profit is reached, is the following correct?// Resets the stop loss to the original value when all positions are closed
if (Position.MarketPosition == MarketPosition.Flat)
{
SetStopLoss(CalculationMode.Ticks, stoplossticks);
}
// 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 + # ticks, set stop loss to breakeven
if (Close[4] > Position.AvgPrice + 13 * TickSize)
{
SetStopLoss(CalculationMode.Price, Position.AvgPrice);
}
}
// If a short position is open, allow for stop loss modification to breakeven
else if (Position.MarketPosition == MarketPosition.Short)
{
// Once the price is less than entry price - # ticks, set stop loss to breakeven
if (Close[-4] > Position.AvgPrice - 13 * TickSize)
{
SetStopLoss(CalculationMode.Price, Position.AvgPrice);
}

Comment