when I am implementing the stoploss-moving in my strategies, I am doing it like this:
if (BarsInProgress==1) { // 1-TICK TIMEFRAME if (Position.MarektPosition==MarketPosition.Long) { if (Close[0]>=myDoubleValueWhenIWantToMoveMyStopLossUP && dontMoveAnymore==false) { // moving of stopLoss myStopLossLine = myStopLossLine + anyCustomValueForHowMuchIWantToMoveTheStopLoss; dontMoveAnymore==true; } if (Close[0]<=myStopLossLine) { // exiting the position when price cross the moving stoploss ExitLong(); } } }
Is there any way (any function, any method, any class) how to implement this easier?
Because you can imagine how the source code looks like when I have more layers for the move of the stoploss.
For example:
1, On 1005 points move the SL for 5points more
2, On 1007 points move the SL for 6points more
1, On 1012 points move the SL for 10points more
... etc
Is there any less complicated way how to do the stoploss move on any specific price, or any specific unrealizedPnL, or move to BE and so on..?
Is there something for this moving of SL?
Thank you very much
Comment