You must use the function SymbolInfoDouble
For example:
double val1 = SymbolInfoDouble ( Symbol (), SYMBOL_MARGIN_INITIAL ); double val2 = SymbolInfoDouble ( Symbol (), SYMBOL_MARGIN_MAINTENANCE ); double val3 = SymbolInfoDouble ( Symbol (), SYMBOL_MARGIN_LONG ); double val4 = SymbolInfoDouble ( Symbol (), SYMBOL_MARGIN_SHORT );
You must use the function SymbolInfoDouble
For example:
Marcelo Speaks!
or you can use the CSymbolInfo class, which provides access to all properties of the symbol you want, and CAccountInfo class , which provides access account properties.
Before creating objects of these classes, you must include the following libraries:
# Include <Trade\SymbolInfo.mqh>
# Include <Trade\AccountInfo.mqh>
For example:
CSymbolInfo symbolInfo;
CAccountInfo accountInfo;
symbolInfo.Name( Symbol ());
symbolInfo.Refresh();
symbolInfo.RefreshRates();
symbolInfo.MarginInitial();
symbolInfo.MarginMaintenance();
accountInfo.Margin();
accountInfo.FreeMargin();
Hug,
Romeu.
Fala Marcelo!
ou você pode utilizar a classe CSymbolInfo, que fornece acesso a todas as propriedades do símbolo que você desejar, e a classe CAccountInfo, que fornece acesso as propriedades da conta.
Antes de criar objetos dessas classes, você deve incluir as seguintes bibliotecas:
#include <Trade\SymbolInfo.mqh>
#include <Trade\AccountInfo.mqh>
Por exemplo:
Abraço,
Romeu.
Muito Obrigado ! [Thank you very much]
I got your point but I still cannot figure out how to solve this problem.
If I am trading 2 instruments @ same account, how can I separate its margings.
Example:
5 WINM14 (margin per contract is 500)
5 WDOM14 (margin per contract is 700)
If I am simultaneouslly positioned on both, total margin will be 5*500 + 5*700 = 6000.
Lets suppose I have I problem with WINM14 and I have 10 contracts. Margin will be 10*500 = 5000 < 6000.
If I am not positioned with the other instrument, the system will not be able to decect :(
Any idea ?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi there !
Can someone please give "best practices" on how to solve this problem!
If I run 2 instruments @ same account, how can I inform me EA to calculate the margin per instrument
I am using the folowing code but it is halting the system because it is adding all margins to my account