6 Digit Forex Quotes and MetaTrader Expert Advisors
Many Forex brokers have started to offer 6 digit Forex quotes to via the MetaTrader 4 terminal recently. It has a lot of benefits for the scalping traders and opens up many new trading possibilities for others. But there seems to be a problem with almost all expert advisors that are applied to the MetaTrader 4 platform, which uses 6 digit Forex quotes instead of the more conventional 5 digit format. As the most expert advisors use the "Point" variable for pips to denominate stop-loss and take-profit, there are two major problems with the 6 digit quotes. First, both stop-loss and take-profit values have very strong chances to come to close to the current pair’s price and MT4 will generate an Error 130, if they are to close. Second, the whole strategy embedded into the given EA will stop working properly because all the profits and losses will probably be divided by 10.
Let’s look at the following example. With a 5 digit quote EUR/USD rate is 1.5703 and one Point in MetaTrader 4 is 0.0001 — a conventional pip for EUR/USD pair. Our expert advisor buys EUR/USD, setting stop-loss at 20 pips — 1.5683, and take profit at 40 pips — 1.5743. Everything goes fine and we win 40 pips when the rate reaches 1.5743. But for a 6 digit quote things are completely different. E.g. the rate above might have been 1.57032 and one Point in your MT4 would have been 0.00001 — ten times less than the conventional pip for EUR/USD. The same expert advisor would have set the stop-loss at 1.57012 and take-profit at 1.57072. Not only 99% of the brokers wouldn’t allow such a close stop-loss and take-profit setting, but if allowed this position wouldn’t be very rational and of course it wouldn’t be according to the initial strategy rules.
So how to correct this problem without completely rewriting the expert advisor and, of course, without changing a broker (to one with the 5 digit quotes)? First, I’d like to tell you that all MetaTrader expert advisors that are featured on my site have been already modified to work with both 5 and 6 digit quotes. Second, here is the way to make any EA to work properly with 6 digit quotes:
- Open the .mq4 of the expert advisor that you want to change in MQL Editor.
- Add a new global variable declaration (it should be in the beginning of the code, along with other variable declarations):
double Poin; - Add the following code to the init() function of the EA. This function is usually present in all EAs (it contains various initialization routines), but if it’s not there, create it and include this code:
//Checking for unconventional Point digits number
if (Point == 0.00001) Poin = 0.0001; //6 digits
else if (Point == 0.001) Poin = 0.01; //3 digits (for Yen based pairs)
else Poin = Point; //Normal - Replace all further occurrences of "Point„ in the code with “Poin„ (except those in the init() function). This will change the system MT4 variable “Point„ to our declared variable “Poin", which now contains the standard 5 digit pip value.
- That’s all. Compile it and you are ready to run it on the 6 digit quotes in MetaTrader. Of course, it will still work with standard 5 digit quotes too.
Tags: EA, Forex quotes, MetaTrader expert advisors, MT4


August 28th, 2008 at 4:41 pm
Can you please contact me to fix a problem with that error?. I did what you post here but I am not getting results, maybe I am not doing it well.
Thanks
August 29th, 2008 at 12:04 pm
Jose, what’s your problem?
February 12th, 2009 at 7:06 am
Hey thanks, nice and fast ! The first and only tutorial about this when i googled…Thanks you.
Alex.
April 26th, 2009 at 8:30 pm
Thanks for this Andrei, when I install it in my EA, I get the following error list when I compile it:
‘if’ – semicolon expected C:\Program Files\MetaTrader 4\experts\indicators\Vegas Currency 60 Min Test.mq4 (39, 1)
This is for the first instance of “if” in the init() function
And then I get this for the ‘double Poin’ expression:
‘Poin’ – expression on global scope not allowed C:\Program Files\MetaTrader 4\experts\indicators\Vegas Currency 60 Min Test.mq4 (39, 23)
When I try to load this indicator anyway, it no longer shows up as a custom indicator to load onto a chart, due to the errors I’m guessing.
Any insights are appreciated,
Thanks
Tony
April 26th, 2009 at 8:40 pm
Andrei,
I fixed the problem after a little diagnosis, thanks Andrei for posting this, I was stuck for a while on this issue.
T