is this section of the script correct if I want to move the trailstop to the low or high of the bar once the positions moves?
if (Position.MarketPosition == MarketPosition.Long)
{
// For long positions, trail the stop below the low of the previous bar
double low = Lows[0][1]; // The low of the previous bar
SetTrailStop(CalculationMode.Price, low);
}
else if (Position.MarketPosition == MarketPosition.Short)
{
// For short positions, trail the stop above the high of the previous bar
double high = Highs[0][1]; // The high of the previous bar
SetTrailStop(CalculationMode.Price, high);
Thank you for your help

Comment