it is strange if you do not use the structure of the request for current prices then everything is calculated except for instruments like #AA in this case it returns zero, I wonder why? how then to calculate the margin for such instruments
voidOnStart()
{
int total=SymbolsTotal(false);
double marginbay;
double marginsell;
//MqlTick pr;for(int i=0;i<=total;i++)
{
if(OrderCalcMargin(ORDER_TYPE_BUY,SymbolName(i,false),1.0,SymbolInfoDouble(SymbolName(i,false),SYMBOL_ASK),marginbay))
Print("Маржа для покупки "+SymbolName(i,false)+" = ",DoubleToString(marginbay));
elsePrint("Ошибка № - ",GetLastError());
if(OrderCalcMargin(ORDER_TYPE_SELL,SymbolName(i,false),1.0,SymbolInfoDouble(SymbolName(i,false),SYMBOL_BID),marginsell))
Print("Маржа для продажи "+SymbolName(i,false)+" = ",DoubleToString(marginsell));
elsePrint("Ошибка № - ",GetLastError());
}
}
sergey1294: I figured out why the first version didn't work, I should have written the function in the loop body to get the quotes for the requested symbol.
You just decide to help... :)
PS
I don't know about others, but the market is kind of closed for #AA...
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
What's the point of compiling such a construction if it will lead to inability to load the MQL5 program?
What is the maximum number of dynamic arrays in an indicator?
What is the maximum number of dynamic arrays in an indicator?
Limitations are dictated by your hardware resources.
How much memory is available.
What is the maximum number of dynamic arrays in an indicator?
wrote this script to check the function
it returns error 4002, what did I do wrong?
it is strange if you do not use the structure of the request for current prices then everything is calculated except for instruments like #AA in this case it returns zero, I wonder why? how then to calculate the margin for such instruments
wrote this script to check the function
Returns error 4002, what did I do wrong?
I figured out why the first version didn't work, I should have written the function in the loop body to get the quotes for the requested symbol.
You just decide to help... :)
PS
I don't know about others, but the market is kind of closed for #AA...
I also have a question, do I understand correctly, that this type of code is an analogue of the MT4 function?