I would like to update my stoploss for my strategy automatically but it seems that it does not work. For example, if I start with an initial stoploss at -4% and once that I earn 3 % I move it to my average price+1%, the initial stoploss is cancelled but not updated.
Here is the code that I use to update it:
// Condition set 5 if (Position.MarketPosition == MarketPosition.Long && Position.GetProfitLoss(Close[0], PerformanceUnit.Percent)> 0.03) { SetStopLoss("Buy Signal", CalculationMode.Price, Position.AvgPrice*1.01, false); }
Thank you,
Manuel
Comment