To insert the code, please use the button .
If you are not working on a hedge account, then you cannot increase the position size, you can only open a new position. If you work on a netting account, then increasing the position size is very easy: you need to send a new trading order.
To insert the code, please use the button .
If you are not working on a hedge account, then you cannot increase the position size, you can only open a new position. If you work on a netting account, then increasing the position size is very easy: you need to send a new trading order.
Thanks, I use it.
/*---------------------------OTWIERANIE I ZAMYKANIE POZYCJI--------------------------*/ //sprawdzanie jaka wartość została przypisana do zmiennej signal i ZAWARCIE TRANSAKCJI if(dif_TA=="TA---buy" && position=="sell-in" && PositionsTotal()>0) { trade.PositionClose(positionticket); } if(dif_TA=="TA---buy" && PositionsTotal()==0) { trade.Buy(0.60, NULL, Ask, NULL /*(Ask -200 * _Point)*/, NULL, "eu20m-v.101.x005"); } if(dif_TA=="TA---sell" && position=="buy-in" && PositionsTotal()>0) { trade.PositionClose(positionticket); } if(dif_TA=="TA---sell" && PositionsTotal()==0) { trade.Sell(0.60, NULL, Bid, NULL /*(Bid +200 * _Point)*/, NULL, "eu20m-v.101.x005"); } /*-------------------------------------------------x001----------------------------------------------------------------------*/ /*---------------------WARUNKI MODYFIKACJI POZYCJI--------------------*/ if(account.Profit() > 100 /*&& positionvolumen==0.6*/) { trade.PositionClosePartial(positionticket,0.2,-1); } if(difprice_AMA < 100 && position=="sell-in" && positionvolumen == 0.4) { trade.Buy(0.20, NULL, Ask, NULL /*(Ask -200 * _Point)*/, NULL, "eu20m-v.101.x005"); } if(difprice_AMA < 100 && position=="buy-in" && positionvolumen == 0.4) { trade.Sell(0.20, NULL, Bid, NULL /*(Bid +200 * _Point)*/, NULL, "eu20m-v.101.x005"); }
Look at the situation on the screen. You think it's the account's fault? I have a demo account - hedge.
I did not find the reverse PositionClosePartial command and as I wrote the minus parameter does not work :) but I also had to check.
Please run this code.
I have this result: there is a position SELL. After PositionClosePartial, the SELL position remains, only with a smaller volume.
- 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,
I can't solve the problem.
The code snippet works to close partial positions with the same ticket, but how can I increase the position ???
I looked everywhere, I tray with the negative - but it doesn't work.
Anyone got any idea? Or it's impossible in mql5?
I know I can open a position with a new ticket, but this requires more management.
Thansk for help **#