# Calculate Pip Difference - confused

I am searching for an Indicator or a way to get the Tenkan-Sen Kijun-sen distance (from eachother).
e.g Tenkan-Sen is at 0.75780 and Kijun-sen is at 0.75760 so the distance is 20 pips, correct?

I tried it myself but I got a problem because of the different price structure (not sure if that is the right word for it): how to calculate it automatically, because e.g. currency pair AUD/USD: 0.75780-0.75760=0.0002. While on e.g. USDJPY 111.622-111.585=37.

How to calculate the value for in all different pairs correctly?

Starting with MQL and not sure how to solve this.

Any help is highly appreciated.

(I am coding in MQL4)

Regards,

Why did you post your MT4 question in the Root / MT5 Indicators section instead of the MQL4 section (bottom of the Root page?) General rules and best pratices of the Forum. - General - MQL5 programming forum
First define what a PIP is (adjusting SL, TP, and slippage; for 4/5 digit brokers and for JPY pairs.) Then your calculation is simple.

``````double changePrice = toPrice - fromPrice;
double changePIPs  = changePrice / pip;
``````

``cpp
string symb=“AUDUSD”;
double point = MarketInfo(symb,MODE_POINT);

int pip = (0.75780-0.75760) / point;

``````int pip = (0.75780-0.75760) / point;
A pip is not a point.
``````