When using Brokers that have 5 digits in price, selecting to show profit as "points" is not correct. The "points" have an extra "0".
- Problems with a calculation
- NEED HELP! RSI EA does not work
- ERROR 130/STOPLEVEL
When using Brokers that have 5 digits in price, selecting to show profit as "points" is not correct. The "points" have an extra "0".
From the mathematics, we know that least significant "0", following decimal point, has no effect on the value. i.e. 1.0020 is same as 1.00200000
There is no decimal point, instead of 10 points , it will show 100 points.... Points constant variable also is /= 10 btw
int diff_digits = 4 - MarketInfo("EURUSD", MODE_DIGITS); double PIP = 1 / MathPow(10, (MarketInfo(Symbol(), MODE_DIGITS) + diff_digits));
This is a small formula hack to autodetect a multiplier in order to get PIPs. Knowing that EURUSD has 4 digits normally. Instead of multipling/dividing the price with Point variable, use PIP as replacement.
EURUSD (5 digits broker):
Point = 0.00001 PIP = 0.00010
EURUSD (4 digits broker):
Point = 0.0001 PIP = 0.0001
GBPJPY (5 digits broker):
Point = 0.001 PIP = 0.010
GBPJPY (4 digits broker):
Point = 0.01 PIP = 0.01
May be I'm doing it the hard way, but if anyone has a non-hack solution please share :)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register