Reputation: 3953
I'm fairly new to Meta Trader 5. I would like to know how I can determine the number of digits behind the decimal point for a market for the price calculation.
Example: The DAX is traded as of 1 point. There is also a decimal place, but if I put, for example, one euro per point, I receive 1 euro when the DAX rises from 15000 to 15001.
With gold it is different. There I also have a decimal place. Here, however, the point is fixed at 0.1, i.e. if I put one euro per point, I get 10 € when the gold price rises from 2000 to 2001.
I already found out that there are some infos, but currently not what I need:
#include <Trade/PositionInfo.mqh>
CSymbolInfo symbolInfo;
SymbolInfoDouble(_Symbol,SYMBOL_POINT); //DAX = 0.1 - Why?
SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_STEP);
symbolInfo.Digits(); //0.0 always - Why?
...
and so on. But no one of these provided me the market information I need. I mean
DAX = 1
Gold = 0.1
Forex = 0.0001
...
So how do I get this information out of the Meta Trader system?
Upvotes: 0
Views: 528
Reputation: 1403
You have two options in MQL5.
You can get the number of digits for the current chart symbol using
Or you can get the digits for any chart using
long SymbolInfoInteger(symbol, SYMBOL_DIGITS);
Upvotes: 0