SymbolInfoDouble(Symbol(), SYMBOL_MARGIN_INITIAL)

 
Hi, can someone tell me how to get Margin Required in MQL5. I ve try SymbolInfoDouble(Symbol(), SYMBOL_MARGIN_INITIAL) but I get 0.0
 
belido:
Hi, can someone tell me how to get Margin Required in MQL5. I ve try SymbolInfoDouble(Symbol(), SYMBOL_MARGIN_INITIAL) but I get 0.0

Did you check error number ? GetLastError().

Which symbol is it ?

 
angevoyageur:

Did you check error number ? GetLastError().

Which symbol is it ?

Sorry friend, I missed this topic. I am looking for equivalent of MarketInfo(symbol(),MARGIN_REQUIRED) in MQL5. I know it can be calculated but if it is already there it is better. The aforemention function I have tried it with no error and for all symbol. Perhaps I use wrong  function? Thanks.
 
belido:
Sorry friend, I missed this topic. I am looking for equivalent of MarketInfo(symbol(),MARGIN_REQUIRED) in MQL5. I know it can be calculated but if it is already there it is better. The aforemention function I have tried it with no error and for all symbol. Perhaps I use wrong  function? Thanks.

I don't know why these values return 0.0.

Anyway you can probably get what you need with :

   MqlTick tick;
   double margin;
   if(!SymbolInfoTick(Symbol(),tick) || !OrderCalcMargin(ORDER_TYPE_BUY,Symbol(),1.0,tick.ask,margin)) return;
   printf("Margin =%f,margin);
 
angevoyageur:

I don't know why these values return 0.0.

Anyway you can probably get what you need with :

Ok, will try it. Thanks.