Download MetaTrader 5

_Digits reports a 3 but is not accepting 3 digit prices when attempting to order (XAUSD on mql demo server)

To add comments, please log in or register
Do you need OpenCL? MQL5 can provide it!
Benjamin Dixon
23166
Benjamin Dixon 2015.01.25 01:49 
Is this true for everyone else or did I mess up my mt5 by connecting to other brokers?
Alain Verleyen
Moderator
30742
Alain Verleyen 2015.01.25 11:24  
bendex77:
Is this true for everyone else or did I mess up my mt5 by connecting to other brokers?

Nothing to do with connecting to other brokers. What is 'mql demo server' ? Metaquotes demo server ?

Please show your code.

Benjamin Dixon
23166
Benjamin Dixon 2015.01.25 15:30  
angevoyageur:

Nothing to do with connecting to other brokers. What is 'mql demo server' ? Metaquotes demo server ?

Please show your code.

it was working fine for a year then stopped working on gold. For instance, this works on all majors but not gold:

request.price=NormalizeDouble(CalcHigh-step+spread+cushion,_Digits);  

for gold only this works:

request.price=NormalizeDouble(CalcHigh-step+spread+cushion,2); 

in gold, _Digits is 3 but either of these gives invalid price:

request.price=NormalizeDouble(CalcHigh-step+spread+cushion,_Digits);  

request.price=NormalizeDouble(CalcHigh-step+spread+cushion,3);   

Alain Verleyen
Moderator
30742
Alain Verleyen 2015.01.25 15:36  
bendex77:

it was working fine for a year then stopped working on gold. For instance, this works on all majors but not gold:

request.price=NormalizeDouble(CalcHigh-step+spread+cushion,_Digits);  

for gold only this works:

request.price=NormalizeDouble(CalcHigh-step+spread+cushion,2); 

in gold, _Digits is 3 but either of these gives invalid price:

request.price=NormalizeDouble(CalcHigh-step+spread+cushion,_Digits);  

request.price=NormalizeDouble(CalcHigh-step+spread+cushion,3);   

You didn't answer my question.

What is 'mql demo server' ? Metaquotes demo server ?

Alain Verleyen
Moderator
30742
Alain Verleyen 2015.01.25 16:15  
bendex77:

it was working fine for a year then stopped working on gold. For instance, this works on all majors but not gold:

request.price=NormalizeDouble(CalcHigh-step+spread+cushion,_Digits);  

for gold only this works:

request.price=NormalizeDouble(CalcHigh-step+spread+cushion,2); 

in gold, _Digits is 3 but either of these gives invalid price:

request.price=NormalizeDouble(CalcHigh-step+spread+cushion,_Digits);  

request.price=NormalizeDouble(CalcHigh-step+spread+cushion,3);   

Anyway your price is not well normalized. It only works if a point (digits) is the same as ticksize.

You should use ticksize to normalize your price.

Benjamin Dixon
23166
Benjamin Dixon 2015.01.25 16:53  
angevoyageur:

You didn't answer my question.

sry yes metaquotes demo server.
Alain Verleyen
Moderator
30742
Alain Verleyen 2015.01.25 16:54  
bendex77:
it seems to be a bug in mt5 newest build, I shall report it.
Is it worth to answer you ? There is no bug in MT5, it's a bug in your code.
Benjamin Dixon
23166
Benjamin Dixon 2015.01.25 16:58  
angevoyageur:

Anyway your price is not well normalized. It only works if a point (digits) is the same as ticksize.

You should use ticksize to normalize your price.

oh no! I must have missed that memo.

Thank you ange

Benjamin Dixon
23166
Benjamin Dixon 2015.01.25 17:01  
angevoyageur:
Is it worth to answer you ? There is no bug in MT5, it's a bug in your code.
You're help is much appreciated, I'm just a bit slow to refresh/read my page.
Alain Verleyen
Moderator
30742
Alain Verleyen 2015.01.25 17:02  
bendex77:
You're help is much appreciated, I'm just a bit slow to refresh/read my page.
No worries. It can happen.
Benjamin Dixon
23166
Benjamin Dixon 2015.01.25 17:36  

I suppose something like:

SymTicSize=SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_SIZE);
priceinticks=NormalizeDouble(notnormalprice/SymTicSize,0);
normalprice=priceinticks*SymTicSize;

 
12
To add comments, please log in or register