Most EA’s Will Break When IBFX Upgrades. Fix Them Now!
IBFX (InterbankFX.com) has just announced that it will be changing it’s feed to 5 decimal places. This will have an impact on EVERYBODY that currently uses them as their prefered broker, including myself, so I thought I’d write a quick post to let you know what you’ll need to change in your EA’s so that they will function correctly.
First thing to say is don’t worry! It’s not too much hassle and if you take your time you’ll have no problem.
First at the top of your EA, just below the external variables declarations, put this line…
double dXPoint = 1;
Then in your init function add the following…
if(Digits==3||Digits==5){
dXPoint=10;
}
Find EVERY occurence of the ‘Point’ variable in your code (Ctrl-F, enter ‘point’ – no quotes – and then F3 for every other occurence). These will normally be your TAKEPROFIT or STOPLOSS variables.
Then instead of, for example…
TAKEPROFIT*Point;
…change it to…
(TAKEPROFIT*dXPoint)*Point;
The brackets/braces are VERY important so don’t leave them out!
Once you’ve done that you’ll be ok for most EA’s but some EA’s will use the brokers spread variable within the code. It might look like this…
double dSpread = MarketInfo(Symbol(), MODE_SPREAD);
…change it to…
double dSpread = MarketInfo(Symbol(), MODE_SPREAD)/dXPoint;
The other thing to remember is your SLIPPAGE variable. Now you can either change it manually by, for example, changing 3 to 300, or you can have it happen automatically. If you want it to be automatic just change what you added to the init function to look like this…
if(Digits==3||Digits==5){
dXPoint=10;
SLIPPAGE = SLIPPAGE*dXPoint;
}
That’s it!
Your EA should now be compatible with both 4 and 5 decimal place brokers.
Hope that helps you some.
Steve
PS: Remember to ALWAYS make a backup copy of your EA before you start editing the code.
Category: MQL Programming
Comments (0)
Trackback URL | Comments RSS Feed
There are no comments yet. Why not be the first to speak your mind.