Strange value of calculated lot

To add comments, please log in or register
Iulian Astalus
37
Iulian Astalus  

Hello there,

I have the following formula:

int tp=50;
double lot = (8 /tp)/(SymbolInfoDouble(Symbol(), SYMBOL_TRADE_TICK_VALUE)); 
// fyi SymbolInfoDouble(Symbol(), SYMBOL_TRADE_TICK_VALUE) =1

When I print the value of lot is always 0.


I don't understand why...


Thanks,

Anthony Garot
1957
Anthony Garot  
Iulian Astalus:

Hello there,

I have the following formula:

When I print the value of lot is always 0.


I don't understand why...


Thanks,

Put a decimal point after the 8.
double lot = (8. /tp)/(SymbolInfoDouble(Symbol(), SYMBOL_TRADE_TICK_VALUE));

By the way, you probably want to take into account the tick size when doing LOT calculations.

https://www.mql5.com/en/forum/126450/page9#comment_3278417

To add comments, please log in or register