Price has moved to far.
-
Hello,
I searched the forum before asking and I apologize if this has been asked before but.
I want the ea not to take a trade if previous candle or price has moved over 1x ATR and to wait for a new signal to form.
-
- Does 'previous candle' mean its body or from high to low.
- What do you mean by 'price'? Price compared to what exactly?
-
@ejsellers You can compare candle size of last candle with atr
-
@l-andorrà whole candle high and low
I refer to the value of the pair at the start of the candle. If eurusd price is 1.09409 and the ATR is 50 pips . If price rises or falls by 50 pips I want EA to wait til next signal. -
@trader-philipps can you tell me how?
Thank you
-
@ejsellers It's quiet simple. I like to calculate distances in pips. As ATR is a price fragment, I need to transform it to pips and compare afterwards to candle size.
So first I need to get the pips. As there are different digits per symbol possible, I first calculate the multiplicator and store it in a variable (I later use). This I do on the on Init tab, because it's not necessary to do re-calculation more than at start unless your EA trades more than the symbol you attached the EA on.- Create a double variable that you store the multiplicator in (I used vd_toPipsMulti).
- On the On Init tab create a custom MQL code block with the following code
//calculate PIPs multiplicator
vd_toPipsMulti = MathPow(10,_Digits-1);// Print to log
Print("PIPs Multiplicator: " + vd_toPipsMulti);

- Now you have different options. I show 2, but you'd just need 1
3.1. Simple one, just the condition block

3.2 If you want to keep the values maybe for different calculations, you may store them to variables and than do the condition block

If you use ATR for more purposes than candle-size comparison you may prefer alternative 2 maybe.
-
@trader-philipps WOW this is really advanced.
Thank you