Good afternoon! I can't figure out how to do one simple thing in MQL5. I need to declare a class level variable (type three-dimensional array double) and then make its late initialization in constructor. In C# it would look like this:
public class MyClass {
private double[,,] myArray;
public MyClass(int dimension1, int dimension2, int dimension3)
{
myArray = new double[dimension1, dimension2, dimension3];
}
}
How to achieve the same result in MQL5? I can declare a three-dimensional dynamic array. But with ArrayResize function I can allocate memory only for the first dimension, what about the other two?
Good day! I do not quite understand how to use the function
for (int i=0;i<10;i=i+0.1){ Print( "i ",i);
boolOrderCalcMargin(
action=ORDER_TYPE_SELL, // тип ордера
symbol=_Symbol, // имя символа
volume=i, // объем
price=last_tick.bid, // цена открытияdouble& margin // переменная для получения значения маржи
);
Print( " margin ", margin ); }
OrderCalcMargin' - function can be declared only in the global scope deposit.mq5 86 Something is wrong, in short.
In general, I want to create a function that uses a percentage of the deposit. For example, 50% is a deal on half of my deposit. I want to understand how much 1 lot is? Can it be calculated programmatically? I have been thinking and reading for the third day now. And lots may be different everywhere - it depends on the type of transaction and on the account!
Dimka-novitsek: I want to understand, how much is 1 lot? Is it possible to calculate it programmatically? I have been thinking and reading for three days now. And lots may be different everywhere - it depends on the type of transaction and on the account!
If your answer to the second question, try to find the article"The ABCs of Currency Trading" by its title. It seems to be written for MT4, but it's not too special.
It still frowns... Let's say action=ORDER_TYPE_SELL, it says 'action' - undeclared identifier. OrENUM_ORDER_TYPE action=ORDER_TYPE_SELL, it says 'action' - unexpected token.
It's everywhere... And in English...
for (int i=0;i<10;i=i+0.1){ Print( "i ",i);
OrderCalcMargin(
ENUM_ORDER_TYPE action=ORDER_TYPE_SELL, // тип ордера
symbol=_Symbol, // имя символа
volume=i, // объем
price=last_tick.bid, // цена открытия
margin // переменная для получения значения маржи
);
Print( " margin ", margin ); }
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.
Good afternoon! I can't figure out how to do one simple thing in MQL5. I need to declare a class level variable (type three-dimensional array double) and then make its late initialization in constructor. In C# it would look like this:
public class MyClass
{
private double[,,] myArray;
public MyClass(int dimension1, int dimension2, int dimension3)
}
How to achieve the same result in MQL5? I can declare a three-dimensional dynamic array. But with ArrayResize function I can allocate memory only for the first dimension, what about the other two?
ERR_TRADE_SEND_FAILED
4756
Failed to send trade request
Why didn't it work? Maybe the professionals can tell me quickly where to look, otherwise I'll be guessing till tonight...
Good day! Dear forum users, can someone give you some tips here?
ERR_TRADE_SEND_FAILED
4756
Failed to send a trade request
Why didn't it work? Maybe professionals will quickly tell you where to look, otherwise I'll be guessing till evening...
You do not need to guess, you need to look at information in MqlTradeRequest request, you created it for a reason.
Well, for starters you have not specified the price at which you plan to sell
OrderCalcMargin' - function can be declared only in the global scope deposit.mq5 86 Something is wrong, in short.
In general, I want to create a function that uses a percentage of the deposit. For example, 50% is a deal on half of my deposit. I want to understand how much 1 lot is? Can it be calculated programmatically? I have been thinking and reading for the third day now. And lots may be different everywhere - it depends on the type of transaction and on the account!
Good day! I do not quite understand how to use the function
OrderCalcMargin' - the function can be declared only in the global scope of deposit.mq5 86 Something is wrong.
Dmitry!
Read carefully what a function is and what a function call is
You've got a complete mess of declarations and uses
Thank you!
Yes, the double-pred function is my fault...
It still frowns... Let's say action=ORDER_TYPE_SELL, it says 'action' - undeclared identifier. OrENUM_ORDER_TYPE action=ORDER_TYPE_SELL, it says 'action' - unexpected token.
It's everywhere... And in English...