ATR strategy, I'm confused. Help me please.
-
I would like to create a stop loss using the ATR strategy but i can't figure out how to set it up.
In layman's term it would be;
1.Stop loss: 2.6 * (ATR for instance 0.00036) - current market price.
2.Take profit: would be the pips between the current price and Stop loss *2 -
@mieyhr I like to use pips rather than price fragments. So how I do it in my projects is:
- on Init tab: create a custom MQL code block. Create an double variable (here: dPipsMultiplicator)
enter the foloowing code:
//
dPipsMultiplicator = MathPow(10,_Digits-1);
//

- Create 2 double constants (here: cdSLAtrMult and cdTPAtrMult), so you can change the multiplicator from the EA settings.

- on Tick: Create the following sequence

I created a comment block that shows me the values of the variables and it looks like that on the chart:

Finally you can use the SL and TP eg in a modify Stops block like that

As I took the parts from my actual project, the last part isn't tested, yet. But I think it will work like that.
- on Init tab: create a custom MQL code block. Create an double variable (here: dPipsMultiplicator)