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
Benjamin Dixon
23787
Benjamin Dixon  
Is this true for everyone else or did I mess up my mt5 by connecting to other brokers?
Alain Verleyen
Moderator
32416
Alain Verleyen  
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
23787
Benjamin Dixon  
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
32416
Alain Verleyen  
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
32416
Alain Verleyen  
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
23787
Benjamin Dixon  
angevoyageur:

You didn't answer my question.

sry yes metaquotes demo server.
Alain Verleyen
Moderator
32416
Alain Verleyen  
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
23787
Benjamin Dixon  
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
23787
Benjamin Dixon  
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
32416
Alain Verleyen  
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
23787
Benjamin Dixon  

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