Help with 5 digit pricing - page 3

 

Check the MA Channel EA thread. MA Channel EA

It has the code that make the EA works with 4 and 5 digits broker.

 

Use this function:

double GetPoint(string symbol = "")

{ if(symbol=="" || symbol == Symbol()) { if(Point==0.00001) return(0.0001); else if(Point==0.001) return(0.01); else return(Point); } else { RefreshRates(); double tPoint = MarketInfo(symbol,MODE_POINT); if(tPoint==0.00001) return(0.0001); else if(tPoint==0.001) return(0.01); else return(tPoint); }

}

 

Mt4 EA code for 5 digit Brokers

Hi All

I have an EA from an old thread that works on 4 digit brokers but not 5 digit brokers...Is it possible for anyone to add the code to make it work on a broker that has 5 digits. Any help appreciated.

 

Thanks to all of you that responded...Best rgds

 
df0132:
Hi All I have an EA from an old thread that works on 4 digit brokers but not 5 digit brokers...Is it possible for anyone to add the code to make it work on a broker that has 5 digits. Any help appreciated.

I'm a programmer and this is a very common problem, I'm wondering why not every EA is designed for both type of platforms. Anyway, depending on how things coded, sometimes it's usable even without any changes, simply multiply all pip number by 10. Say your take profit is 50 pips, instead of using 50, just use 500.

Or I can add a few lines in your code for you, so you don't have to do the above conversion. Let me know if you want.

Christina

 

4/5 digits

The best practice is making your EA working with 4/5 digits without bothering the user and this is very easy.

1- Use a global varaible call it mPoint.

2- In the initfunction use this code:

if(Digits==2 || Digits==3) mPoint = 0.01;

if(Digits==4 || Digits==5) mPoint = 0.0001;[/php]3- Replace any piece of code that uses Point with mPoint. For example:

[php]int spread = MathCeil((Ask-Bid)/mPoint); //mPoint instead of Point
christinaLi:
I'm a programmer and this is a very common problem, I'm wondering why not every EA is designed for both type of platforms. Anyway, depending on how things coded, sometimes it's usable even without any changes, simply multiply all pip number by 10. Say your take profit is 50 pips, instead of using 50, just use 500.

Or I can add a few lines in your code for you, so you don't have to do the above conversion. Let me know if you want.

Christina
 

Hi Guys

I have tried all the suggestions and still cant get the EA to work on a 5 digit broker...It works fine on 4 digit brokers

The alert window works but it wont open any trades.

I am obviosly getting something wrong...Could any coders out there have a look and add the correct code to get it going on a 5 digit broker?

Any help appreciated!

Attached is the EA

trendbreakea.mq4

Files:
 
df0132:
Hi Guys

I have tried all the suggestions and still cant get the EA to work on a 5 digit broker...It works fine on 4 digit brokers

The alert window works but it wont open any trades.

I am obviosly getting something wrong...Could any coders out there have a look and add the correct code to get it going on a 5 digit broker?

Any help appreciated!

Attached is the EA

trendbreakea.mq4

Should work on any digit broker now.

 

Thanks mrtools!

I will give it a go...

 

Hi All

No, it seems not to open any trades on a 5 digit broker ( I tried on two different ones)...One thing I noticed is that the comments now repeat over and over...Not sure if this would have anything to do with it....I just turned them off to make the issue go away.

Thanks for adding the slippage as well!!!

Your help is greatly appreciated!!!!

Does anyone have any ideas on how to get the order to open in a 5 digit broker?...it works great on a 4 digit broker...(I have double checked all of the EA settings in Metatrader to make sure they are active)

Daryl

trendbreakea.mq4

Files:
Reason: