Need help fixing my points/pips/digits problem in my mql4 EA. Any help would be really appreciated.
double MyPoint=Point; if(Digits==2 || Digits==3 || Digits ==5) MyPoint=Point*10;
What do you think that this does????
Did you write this code ?
This looks like the low quality code produced by an EA builder.
Try to exclude this line
// if(Digits==2 || Digits==3 || Digits ==5) MyPoint=Point*10;
What do you think that this does????
Did you write this code ?
This looks like the low quality code produced by an EA builder.
Yes, sorry if this is low quality code. I tried writing this code myself, and I learned how to write code all by myself.
- If your EA work on a single symbol you can do the Digits check in the OnInit function and not for each new tick because it do not change during EA execution.
- In cycles, always count down from OrdersTotal()-1 to 0 and not the opposite.
- Using MyPoint your values will be espressed in pips, not in point: you are working on a 5 digits symbol and you have a function to multiply *10 your points. Your TP = 30 will become 300. What's wrong?
So, I want my EA on my ECN broker for all currency to have S/L at 30 points and T/P at 60 point. Here's my input code:
I already write this:
And this is my Trailing Stop:
The PROBLEM is when I want something like this:
Currency: EURGBP
Price: 0.84605
S/L: 0.84575 (30 points difference)
T/P: 0.84665 (60 point difference)
This is what really happened:
Currency: EURGBP
Price: 0.84605
S/L: 0.84305 (300 points difference)
T/P: 0.85265 (600 point difference)
This error also happened to USDJPY and XAUUSD.
I am really confused, so I search problem like this in forum, and find some threads:
- https://www.mql5.com/en/forum/149177
- https://www.mql5.com/en/forum/124692
- https://www.mql5.com/en/forum/152849
- https://www.mql5.com/en/forum/141987
- https://www.mql5.com/en/forum/128770
- https://www.mql5.com/en/forum/141509
I already tried everything they said and fixed my code, to no avail.
Can someone in this forum give me the simple fixes in my Code?
Any help would be really appreciated, I would share my EA Code for free.
Try using MarketInfo(sym,...)
Where do I write the code into? Sorry I'm a newbie here... Your help would be really thankful.
- If your EA work on a single symbol you can do the Digits check in the OnInit function and not for each new tick because it do not change during EA execution.
- In cycles, always count down from OrdersTotal()-1 to 0 and not the opposite.
- Using MyPoint your values will be espressed in pips, not in point: you are working on a 5 digits symbol and you have a function to multiply *10 your points. Your TP = 30 will become 300. What's wrong?
If I'm not using *10, my code wouldn't set S/L and T/P (both values become 0). And How to do Digit check in OnInit function? Sorry I'm a newbie here... Your help would be really thankful.
You need to check distance from current price that need to be grater than STOP_LEVEL allowed by your broker.
I suggest to use bigger values for make a try. Use 100 and 100 for SL and TP. That are 10 pips (if you don't multiply *10) or 100 pips in the other case.
Yes, sorry if this is low quality code. I tried writing this code myself, and I learned how to write code all by myself.
Then it is an amazing coincidence that your code is uncannily similar to that generated by an EA builder.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
So, I want my EA on my ECN broker for all currency to have S/L at 30 points and T/P at 60 point. Here's my input code:
I already write this:
And this is my Trailing Stop:
The PROBLEM is when I want something like this:
Currency: EURGBP
Price: 0.84605
S/L: 0.84575 (30 points difference)
T/P: 0.84665 (60 point difference)
This is what really happened:
Currency: EURGBP
Price: 0.84605
S/L: 0.84305 (300 points difference)
T/P: 0.85265 (600 point difference)
This error also happened to USDJPY and XAUUSD.
I am really confused, so I search problem like this in forum, and find some threads:
I already tried everything they said and fixed my code, to no avail.
Can someone in this forum give me the simple fixes in my Code?
Any help would be really appreciated, I would share my EA Code for free.