Expert Advisors and Five Digit Quotes
A lot of Forex brokers have introduced the ability to use five digit quotes in MetaTrader 4 terminals lately. Such ability is very useful and advantageous for all traders, and especially for the forex scalping traders, but there are some problems concerning expert advisors for the MetaTrader 4 terminal, which is based on five digit Forex quotes instead of the more widespread format of four digit Forex quotes. As a rule, two serious problems are singled out in connection with the use of five digit quotes, which arise because of use of the “Point” variable by expert advisors for pips to denominate stop-loss and take-profit. The first problem is a possibility of generation of an “Error 130” by the MetaTrader 4 terminal in case of stop-loss and take-profit values coming too close to the price of the current currency pair, and these chances are very strong. The second problem is the need to completely review and adjust the trading strategy of your expert advisor, because all the profits and losses will be divided by 10.
Here is a simple telling example. Let’s imagine that we trade using the EUR/USD currency pair with the four digit quote rate of 1.5703; one Point in MetaTrader 4 is 0.0001, i.e. one usual pip of the EUR/USD pair. We set the following parameters for our expert advisor: stop-loss = 20 pips (1.5683), take-profit = 40 pips (1.5743). If everything is all right, we will 40 pips after the rate reaching 1.5743. But in case of use of five digit quotes everything will be totally different. For instance, we have the EUR/USD currency pair with the five digit quote rate of 1.57032; in this case one Point in MetaTrader 4 is 0.00001, i.e. it is ten times less than in case of four digit quote. So if we set the same parameters for our expert advisor as in case of four digit quote, the result will be the following: stop-loss = 20 pips (1.57012), take-profit = 40 pips (1.57072). First of all, almost all brokers simply won’t allow you to use such a close stop-loss and take-profit setting. Secondly, even in case you were allowed to use such settings, you should understand that there is no rational kernel in such approach and it is completely different from the initial strategy rules.
What should you do to correct the situation without complete readjustment of your expert advisor or change of a broker for the one with four digit Forex quotes? Here is the way to adjust your expert advisor for proper work with five digit quotes:
• Firstly, use MQL Editor for editing the .mq4 of the expert advisor you want to adjust;
• Secondly, you should add a new global variable declaration in the beginning, next to other variable declarations:
double Point;
• Thirdly, copy the following code and paste it to the init() function of the expert advisor. As a rule, all expert advisors have this function. In case there is no such function in your expert advisor, you should create it and paste the following code:
//Checking for unconventional Point digits number
if (Point == 0.00001) Poin = 0.0001; //5 digits
else if (Point == 0.001) Poin = 0.01; //3 digits (for Yen based pairs)
else Poin = Point; //Normal
• Fourthly, find all occurrences of “Point” in the code and replace them with “Poin”, apart from those in the init() function. You do it in order to change the system variable “Point” of the MT4 platform to the variable “Poin”, which contains the four digit pip value.
That’s it. These four steps is your way for adjustment of the expert advisor to run it in MetaTrader with five digit quotes. Moreover, your EA will still have support of standard four digit quotes.
2011 © http://iticsoftware.com
This entry was posted on Tuesday, June 14th, 2011 at 9:06 am and is filed under expert advisor, metatrader expert advisor, metatrader expert advisors. You can follow any responses to this entry through the RSS 2.0 feed. Responses are currently closed, but you can trackback from your own site.








SALVADOR July 29th, 2011 at 2:35 pm
Cheap@Abilify.Online” rel=”nofollow”>..…
Buygeneric meds…