I am new to Forex but an experienced programmer. I am using MT4 and trying to develop a set custom indicators for my own trading. In one of my indicators everything is working fine except it always returns 0.00 for the margin amount for all currency pairs. I am using the SYMBOL_MARGIN_INITIAL enum to add the margin to a string that I later display on the chart. I have tried several of the margin enums with no sucess on any. There are five other values in the displayed string that are correctly returned by their enum references.
Below is the partial code line that appends the margin value to the string prior to display.
Yes. I did contact my broker (Forex.com). After several emails I got nowhere. Did some searching on the MLQ5 site and found some code that displayed margin $.
Here’s the code lines…
DoubleToStr(MarketInfo(Symbol(),MODE_MARGINREQUIRED * LotSize)) // Works
DoubleToStr(SymbolInfoDouble(Symbol(),SYMBOL_MARGIN_INITIAL) * LotSize // NG
I also tried some of the other margin enums from SymbolInfoDouble as well with no success.
Although the other five parameters my indicator grabbed by SymbolInfoDouble returned correctly, margin always returned 0.00. The MLQ4 documentation is clear and everything but margin seems to work fine. Guess there is some kind of glitch somewhere.