# Thread: Modifications for a 5 digits broker

1. Originally Posted by przem81621
double HMAA=iCustom(Symbol(),0,"HMA",HMAPeriod1,HMAMethod 1,HMAPrice1,2,0);
double HMAB=iCustom(Symbol(),0,"HMA",HMAPeriod2,HMAMethod 2,HMAPrice2,2,0);

hma indicator
OK, so it's a form of moving average although I don't know what sort of value is returned from Buffer 2.

On the basis that it's a price then yes, you would need to re-process your distance value for 3/5-digit brokers.

One small tip if you're ever unsure about what values are being returned inside your EA. Just have the EA return those values in the form of a debug comment so that you can see what's happening.

You simply set up an external bool called debug on Global Scope and a text string (maybe call it txt) containing the results of HMAA - HMAB and distance * Point.

Then:

if(debug) Comment(txt);

You will be able to see straight away if it's working correctly or not and, if it's not working, you'll be able to see what's going wrong.

2. Another alternative for the 5 digits broker "compatibility" :

In the code, find all :

Code:
`Digits`
And replace them by :

Code:
`digits`
In the code, find all :

Code:
`Point`
And replace them by :

Code:
`point`
After the extern parameters, add :

Code:
```int digits;
double point;```
In the init() function, add before return(0); :

Code:
```if(Digits<4)
{
point=0.01;
digits=2;
}
else
{
point=0.0001;
digits=4;
}```

3. Another guide :

After the extern parameters, add :

Code:
`double point;`
In the init function add :

Code:
`point=GetPoints();`
If there is no init function, add this before the start body :

Code:
```int init()
{
point=GetPoints();

return(0);
}```
After the init function, add :

Code:
```//|---------x digits broker

double GetPoints()
{
if(Digits==3 || Digits==5)point=Point*10;
else point=Point;
return(point);
}```

4. rather than multiplying this and that for a 5 digit broker, can we just not make the EA compatible with 4 and 5 digit brokers in the first place.

For example fapturbo and megadroid will automatically adjust to your broker and work with 4 and 5 digits, so you dont need to change anything. I know there are a lot of EAs out there that also do this, i was just using fapturbo and megadroid as an example!

Is this easy to do, or not really!

5. Originally Posted by wannaberich
rather than multiplying this and that for a 5 digit broker, can we just not make the EA compatible with 4 and 5 digit brokers in the first place.

For example fapturbo and megadroid will automatically adjust to your broker and work with 4 and 5 digits, so you dont need to change anything. I know there are a lot of EAs out there that also do this, i was just using fapturbo and megadroid as an example!

Is this easy to do, or not really!
This is exactly what both mine and Funyoo's code is doing. These blocks of code that have been posted adjust SLs, TPs, etc automatically within the EA code so that the user doesn't have to do anything.

6. Ok sounds good. So does that mean any new EAs that are put up will automatically work with 5 digit brokers

Originally Posted by jezzer1961
This is exactly what both mine and Funyoo's code is doing. These blocks of code that have been posted adjust SLs, TPs, etc automatically within the EA code so that the user doesn't have to do anything.

7. ## auto SL TP adjustment for digits

--------
int HalfDigits,DoubleDigits;
HalfDigits=MathFloor(MarketInfo(Symbol(),MODE_DIGI TS)/2);
DoubleDigits=HalfDigits*2;
if(DoubleDigits!=MarketInfo(Symbol(),MODE_DIGITS))
-------
some brokers are going 6 digit - yes 6 digit! will this code work for 6 digit brokers or just for 5 digit brokers only?

and what about JPY which has only 3 digits after the dec point? will your code work for JPY?

what a mess!
dph

8. no one is going to use a 6 digit broker, look at all the EAs out there that are going to be redone, you would have to be stupid to turn your self into a 6 digit broker now!

I was quite happy with 4 digits, all my EAs worked just fine, now my broker is 5 digits many of then no longer work and some had to get the code changed. So there is no way i could be bothered going through this process again.

Originally Posted by dph
--------
int HalfDigits,DoubleDigits;
HalfDigits=MathFloor(MarketInfo(Symbol(),MODE_DIGI TS)/2);
DoubleDigits=HalfDigits*2;
if(DoubleDigits!=MarketInfo(Symbol(),MODE_DIGITS))
-------
some brokers are going 6 digit - yes 6 digit! will this code work for 6 digit brokers or just for 5 digit brokers only?

and what about JPY which has only 3 digits after the dec point? will your code work for JPY?

what a mess!
dph

9. Which brokers exactly are going 6 digits? This sounds a bit strange to me.

10. dear funyoo,
Does "Slippage" we need to multiply too?
regards,
MANSTIR