Im trying to create a dynamic stop loss based on a moving average. In my example i use the 20 period Simple Moving average as my SL level. To this
function i would like to add a "max SL value in pips" and "minimum SL value in pips".
if
20 SMA is more than x pips away from entryprice, use "max sl value" instead.
And
if
20 SMA is closer than x pips away from entry price, use "min sl value" instead..
I have defined the SMA stoploss value with a variable using the iMA function.
So far so good.
But i can't get my head around how to add the min and max values.
If anyone has any ideas i will be happy to hear them;)
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.
Im trying to create a dynamic stop loss based on a moving average. In my example i use the 20 period Simple Moving average as my SL level. To this function i would like to add a "max SL value in pips" and "minimum SL value in pips".
if 20 SMA is more than x pips away from entryprice, use "max sl value" instead.
And
if 20 SMA is closer than x pips away from entry price, use "min sl value" instead..
I have defined the SMA stoploss value with a variable using the iMA function.
So far so good.
But i can't get my head around how to add the min and max values.
If anyone has any ideas i will be happy to hear them;)