The thing is that the OrderClose() function that closes the order takes the order number as the first parameter, and the order number can only be obtained by calling OrderSelect() on existing orders, so in the general case the closing looks like this...
If OrdersTotal() = 0, i.e., if there are no open orders, then the for loop is immediately finished.
Thanks for the answer, can you write the beginning of the OrderSend function? it should go right after the last brackets????
the result with some level, and it doesn't matter which level
positive or negative. And when asked
whether to take the level with or without the minus,
there's no clear distinction, unfortunately.
I may have made a mistake..........
The issue is that the beginner is asking what he DOES NOT KNOW. This example codes serves to understand the structure (correct structure) of the EA.
And what's embedded in this piece of code is built on a CLASSICAL trading principle. Both the Expert Advisor itself and the code samples are used to study the principles, and not to poke someone or catch him at something....... What I'm asking means that it's not clear. After all, you MUST understand theoretically what and how. And then create, sculpt, invent........
keekkenen 25.02.2009 11:34 1) Please explain, OrderSend(...) function has int type, and you define it as bool type, while bool type does not have -1 value, how correct is it? 2) In KimIV function of position opening the repeat is made through for(...), while in yours through while(...). which way do you think is better?
1. this is an error... you have to declare res as int and add another variable of bool type to return the value of success/failure to open the order...
2. I also used one of implementations of Igor's OpenPosition() function earlier, but later changed the function to make it easier to catch and report errors...
the result is the following structure
while( try !=0){// определение условий для открытыия позиции//..// открытие позициц
res =OrderSend(...);if( res >0){PlaySound("alert.wav");
try =0;Comment("Ордер открыт !");Sleep(2000);
ret =true;}else{/* блок определения ошибок и возврат
err - уровень критичности ошибки (0,1,2,3)
msg - описание ошибки (если showErrors = true)
уровни определяются по номеру ошибки
0-нет ошибки, 1-надо ждать и обновлять,
2-сделка бракуется,3-фатальная ошибка*/
ErrorBlock( showErrors, err, msg);if( err >1) try =0;// в данном случае 2 и 3 критичныComment("Ошибка - ", msg);Sleep(2000);}}
If I understand correctly in your function, if there are continuous requotes, then the number of attempts is unlimited, unlike in Igor's function? Is any limitation needed in this case?
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.
The thing is that the OrderClose() function that closes the order takes the order number as the first parameter, and the order number can only be obtained by calling OrderSelect() on existing orders, so in the general case the closing looks like this...
If OrdersTotal() = 0, i.e., if there are no open orders, then the for loop is immediately finished.
Thanks for the answer, can you write the beginning of the OrderSend function? it should go right after the last brackets????
Thanks for the answer, can you write the beginning of the OrderSend function? it should go right after the last brackets????
Well, here's an example
Can you tell me which function returns the value of the margin level (in percent) for open orders, which is shown in the "Trade" tab ?
In Help, none of the functions listed returns this value.
AccountMargin
AccountFreeMargin
AccountFreeMarginCheck
AccountFreeMarginMode
The Damiani_Volt indicator can be used.
Interesting stuff, thank you.
there it is
Thank you
I don't know why you think I'm angry.
It's just my way of explaining that
by taking any sign of inequality and running
>> in the tester you can get a positive
the result with some level, and it doesn't matter which level
positive or negative. And when asked
whether to take the level with or without the minus,
there's no clear distinction, unfortunately.
I may have made a mistake..........
The issue is that the beginner is asking what he DOES NOT KNOW. This example codes serves to understand the structure (correct structure) of the EA.
And what's embedded in this piece of code is built on a CLASSICAL trading principle. Both the Expert Advisor itself and the code samples are used to study the principles, and not to poke someone or catch him at something....... What I'm asking means that it's not clear. After all, you MUST understand theoretically what and how. And then create, sculpt, invent........
1. this is an error... you have to declare res as int and add another variable of bool type to return the value of success/failure to open the order...
2. I also used one of implementations of Igor's OpenPosition() function earlier, but later changed the function to make it easier to catch and report errors...
the result is the following structure