No, that will not work... one order - one lot, if you have opened an order with 3 lots then you cannot split the lot the way you want - first 1, then 1 and then 1 - the order closes the entire lot, i.e. the order closes with the same lot as it was opened, you cannot close orders in parts...
you are mistaken i have a trall which closes the order in parts.
hope писал(а)>> not the same. One third of the lot is closed (by one of the conditions - let's say the price has reached +150 bps). The second third will close, say, when +300pts from the opening, etc..
No, it doesn't work that way... one order - one lot, if you open an order with 3 lots then you can't split the lot in any way - first 1, then 1 and then 1 more - the order closes the whole lot, i.e. the order closes with the lot it was opened with, you cannot close orders piecemeal...
...........................
".... you cannot split the order into lots..." - why? Technically, it was implemented long ago, and thanks to Roger and KimIV on p.85 the error of 131 normalized lots was avoided. In addition, the statement "...one order, one lot, and if you open an order with 3 lots, then you can't split it as you want: first 1, then 1..." is incorrect: an order, as well as a lot, consists of the volume: 0.03, 0.3, 3... and is quietly closed by parts: 0.01, 0.1, 1... right?
And the point of my last request was this: is it possible to close ALL positions without resorting to arrays, but using standard calculations and adding them up like
BuyTotalOp=0;// Количество Buy ордеров
SellTotalOp=0;// Количество Sell ордеровfor(int i=1; i<=OrdersTotal(); i++)// Цикл перебора ордер{if(OrderSelect( i-1, SELECT_BY_POS)==true)// Если есть следующий{// Анализ ордеров:if(OrderSymbol()!= Symb)continue;// Не наш фин. инструмif(OrderType()>1)// Попался отложенный{Alert("Обнаружен отложенный ордер. Эксперт не работает.");return;// Выход из start()}if(OrderType()==OP_BUY){
BuyTotalOp++;// Счётчик ордеров Buy
I just have the feeling of a tired ship that has sailed the ocean hoping for a lighthouse to tell me whether it's necessary to sail in this direction or to turn around and try another way ...
I have studied all your functions, but there is one hitch, or hitch. Now, when I write functions, I write them from my brain, but your functions are in my head :-).
I have studied many of your functions since the very beginning of my programming career.
Please help me close an order at any condition you like and it just does not work.
Thanks in advance
Explanation
Any strategy to close an order is unimportant Please help close an order using Kim's functions
int start(){//----//Print (ExpertName);if(Bars<20)return(0);if( CheckNevBar)if(! NevBar())return(0);
TradesInThisSymbol = ExistPositions( sy);if( TradesInThisSymbol >0)return(0);if(AccountFreeMargin()< MarginMin){//Print("Not enough money to trade Strategy:", ExpertName);return(0);}
sy=Symbol();
Lots = GetSizeLot( sy, LotsWayChoice, LotsPercent, LotsDeltaDepo, LotsDepoForOne, LotsMax);if( CheckForOpen_Sell())
OpenPosition( sy,OP_SELL, Lots);// Тут работаетif( CheckForOpen_Buy())
OpenPosition( sy,OP_BUY, Lots);// Тут работаетif( CheckForClose_Buy())
ClosePositions( sy,OP_BUY);// Тут у меня что то неработаетif( CheckForClose_Sell())
ClosePositions( sy,OP_SELL);// Тут у меня что то неработает//----return(0);}//------------------------bool CheckForClose_Buy(){
Indicat_Var();if( ExistPositions( sy,OP_BUY, MagicNumber)){if( VininI_fast_trend ==-1)return(true); // Тут любое условие на закрытие//if(BB_MACD_2 > 0)return(true); // Тут любое условие на закрытиеelsereturn(false);}}//------------------------bool CheckForClose_Sell(){
Indicat_Var();if( NumberOfPositions( sy,OP_SELL, MagicNumber)>0){if( VininI_fast_trend ==1)return(true);// Тут любое условие на закрытие//if(BB_MACD_1 > 0) // Тут любое условие на закрытие//return(true);elsereturn(false);}}
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.
No, that will not work... one order - one lot, if you have opened an order with 3 lots then you cannot split the lot the way you want - first 1, then 1 and then 1 - the order closes the entire lot, i.e. the order closes with the same lot as it was opened, you cannot close orders in parts...
you are mistaken i have a trall which closes the order in parts.
no new orders of course ?
No, it doesn't work that way... one order - one lot, if you open an order with 3 lots then you can't split the lot in any way - first 1, then 1 and then 1 more - the order closes the whole lot, i.e. the order closes with the lot it was opened with, you cannot close orders piecemeal...
...........................
".... you cannot split the order into lots..." - why? Technically, it was implemented long ago, and thanks to Roger and KimIV on p.85 the error of 131 normalized lots was avoided. In addition, the statement "...one order, one lot, and if you open an order with 3 lots, then you can't split it as you want: first 1, then 1..." is incorrect: an order, as well as a lot, consists of the volume: 0.03, 0.3, 3... and is quietly closed by parts: 0.01, 0.1, 1... right?
And the point of my last request was this: is it possible to close ALL positions without resorting to arrays, but using standard calculations and adding them up like
I just have the feeling of a tired ship that has sailed the ocean hoping for a lighthouse to tell me whether it's necessary to sail in this direction or to turn around and try another way ...
Igor - are we trashing your branch for nothing?
You can close all one pair at a time, but different pairs, e.g:
1,2,1,2,2,1,2 total overlapped volume 1-2-1+2+2+1+2=3 lots
Summing up, we obtain the buy-summer 3 lots and set the counter of this volume sell 3 lots
and then we close the Close bi.
*
But to answer the question: is it possible to close all positions?
yes it is possible, one after another, it's fast with the script, aap!
The scripts themselves or the closing functions have been published more than once...
And by setting them up you can close both all at once and by criteria, e.g.:
- by a specific symbol
- only bai or only sell
- only profitable
Correspondingly, combinations of criteria are possible...
Please help close the order at any condition you like and it just does not work.
Thank you in advance
Will cover everything!!!
Will only close the open poses.
Example call.
Close script in full.
Kim you are the best. I take my hat off to you.
I have studied all your functions, but there is one hitch, or hitch. Now, when I write functions, I write them from my brain, but your functions are in my head :-).
I have studied many of your functions since the very beginning of my programming career.
Thank you.
Please help me close an order at any condition you like and it just does not work.
Thanks in advance
Explanation
Any strategy to close an order is unimportant Please help close an order using Kim's functions