stop loss based on ATR
-
Hello,
Does someone know how i can set a stop loss based on Average True Range indicator?
The problem is the returned value of ATR is in money not pips and the input for stop loss is pips or price level.
I also couldn't figure out how to do it with variables.
Thank you,
A -
@akulus ATR is a price fraction. You may use the adjust field an enter there
*MathPow(10,_Digits-1)
in order to get the fraction as pips.
You also may consider the search function as ATR based SL is one of the top requests here. -
thank you @trader-philipps ,
that does something but i am just a novice user and probably i don't use it correctly.
it gives a sl of just a pip or two.
just to be sure, for 'stop loss mode' do i need to select 'custom (pips)'?
thank you,
ALE: if i multiply it with 10 it gives me the ATR value '*MathPow(10,_Digits-1)x10'
I have another question please how can i use a constant and the MathPow in the adjust field, something like '*MathPow(10,_Digits-1)x[multiplicationfactorconstant]'thank you very much,
A -
@akulus Actually "*MathPow(10,_Digits-1)" should give you the Pip multiplocator for price sections. Keep in mind that for a 5 digits broker 1 Pip is 10 points!
However, if you create a constant of type double named cdSLAtrMultiplicator, in the adjust field you would put ...
cdSLAtrMultiplicatorMathPow(10,_Digits-1)
The good thing about the Mathpow approach is that it works on 2 or 3 digits instruments such as gold or jpy pairs as well!
-
@trader-philipps thank you,
i will use it mostly on 2 digits pairs (penny stocks). it works perfect if i multiply with 10.
i will try it now.
-
@trader-philipps said in stop loss based on ATR:
@akulus Actually "*MathPow(10,_Digits-1)" should give you the Pip multiplocator for price sections. Keep in mind that for a 5 digits broker 1 Pip is 10 points!
However, if you create a constant of type double named cdSLAtrMultiplicator, in the adjust field you would put ...
cdSLAtrMultiplicatorMathPow(10,_Digits-1)
The good thing about the Mathpow approach is that it works on 2 or 3 digits instruments such as gold or jpy pairs as well!
Somehow the editor changed my formular.
*cdSLAtrMultiplicator * MathPow(10,_Digits-1)