Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Can someone code a trailing stop indicator in the style of the parabolic SAR.
Modifying the existing code of the parabolic may be a shortcut to getting the idea working.
So, if the condition is "long", then we want the stop moved to the midpoint of the lows of the two previous bars.
the psuedo code::: val = (low(-1) - low(-2))/2 + low(-2);
and if, the condition is "short", then we want the stop moved to the midpoint of the highs of the two previous bars.
the psuedo code::: val = (high(-2) - high(-1))/2 + high(-1);
It should act like the current parabolic where the long/short dots are drawn as the stop is hit. SAR.
Happy coding