Calculating ADR in pips Wrong for JPY Pairs
-
Hi,
I'm creating an EA that uses ADR (average daily range) in it's strategy. I'm using the ATR for the daily candle to calculate this which is working fine.
I need the ADR figure in pips though and have worked out how to do that but my calculations dont work with JPY pairs as the digits are differnt.
This is the calculation I'm using.

Basically I get the ATR10 for the daily and *10,000. The raw ADR is shown on the chart and becomes a pip amount with my calculation. All good on pairs that have 5 digits.

With any JPY pair however with 3 digits the ADR raw is higher so my calculation is out. Need to be ATR * 1,000 NOT 10,000.

Is there a way to correct this or an easier way to achieve what I want?
Maybe an IF ESLE or something block I can use to store that variable differently by detecting if its an XXXJPY pair? -
@breakertrader why do you need pips? Simplest way would be to work with raw values
-
@roar I need an inpu to set a target which is an amount of pips but based off ADR.
i.e. half the ADR10 value if 50 would be 25. -
@breakertrader Digits() function returns the amount of decimals of the pair, so we can convert any point amount to raw value multiplying by MathPow(10,-Digits())
For example, 10 point to raw price: 10*MathPow(10,-Digits())
Then you can just use 1 pips = 10 points as a final calculation.
Works with all symbols. -
@roar So how would I implement that in the project?
https://fxdreema.com/shared/xZfhyTE4e
The modify variables there saves the ADR as a pip amount. Not sure how to use your formula, not a coder and just working visually with the system.
-
Anyone coming across this in the future I found the solution.
Searched for this but couldnt find it and stumbled across it while reading tutorials.
https://fxdreema.com/forum/topic/11003/atr-value-to-pips-tutorial/2
Handles JPY calculations perfectly.