Close deal instead of position

 

Hi,

I want my EA to open multiple deals. When price goes against me, I average in.

So when price went in my favour, can I select the individual deal in profit to close?

 
There is absolutely no difference, which deal to close :-). Consider you bought several gold bars at different price. Now they are lying in your strongbox all shiny and glittery. Will it matter, which one of them you sell first? No, what matters is the average price you've bought them all for.
Documentation on MQL5: Standard Constants, Enumerations and Structures / Indicator Constants / Price Constants
Documentation on MQL5: Standard Constants, Enumerations and Structures / Indicator Constants / Price Constants
  • www.mql5.com
Standard Constants, Enumerations and Structures / Indicator Constants / Price Constants - Documentation on MQL5
 
enivid:

There is absolutely no difference, which deal to close :-). Consider you bought several gold bars at different price. Now they are lying in your strongbox all shiny and glittery. Will it matter, which one of them you sell first? No, what matters is the average price you've bought them all for.

but can it be done?

closing deal instead of the position? 

 

deal is a consequence of order. you cannot close a deal.

you have to give another order, which will result in another deal (if the order is correct).

 

check the documentation :) 

 
doshur:

but can it be done?

closing deal instead of the position? 

No can't do https://www.mql5.com/en/articles/384#trading

Find the broker who can do - like hedging https://www.mql5.com/en/forum/8372/page2#comment_345054 

MetaTrader 5 - More Than You Can Imagine!
MetaTrader 5 - More Than You Can Imagine!
  • 2012.06.01
  • MetaQuotes Software Corp.
  • www.mql5.com
The MetaTrader 5 client terminal has been developed from scratch and far surpasses its predecessor, of course. The new trading platform provides unlimited opportunities for trading in any financial market. Moreover, its functionality keeps expanding to offer even more useful features and convenience. So, it is now quite difficult to list all the numerous advantages of MetaTrader 5. We have tried to briefly describe them in one article, and we got surprised with the result' the article is far from brief!
 
enivid:

There is absolutely no difference, which deal to close :-). Consider you bought several gold bars at different price. Now they are lying in your strongbox all shiny and glittery. Will it matter, which one of them you sell first? No, what matters is the average price you've bought them all for.

I agree, what matters is the average price...

By the way, if you want, you can also close the position a little by little, by lot size, if it goes in your favor. You can close each deal by the exact amount (lot size) used in the position you opened.

 
phi.nuts:

No can't do https://www.mql5.com/en/articles/384#trading

Find the broker who can do - like hedging https://www.mql5.com/en/forum/8372/page2#comment_345054 

as I guess so.

Another quick question.

If I open deals at price $3.00 - 1 lot, $2.00 - 1 lot, $1.00 - 1 lot

the average price is $2.00 - 3 lots. So if i close 2 lots at any price, is my average entry price still at $2.00? 

 
doshur:

as I guess so.

Another quick question.

If I open deals at price $3.00 - 1 lot, $2.00 - 1 lot, $1.00 - 1 lot

the average price is $2.00 - 3 lots. So if i close 2 lots at any price, is my average entry price still at $2.00? 

Yes, of course. The average entry price may be changed only with entry, not exit.
 
enivid:
Yes, of course. The average entry price may be changed only with entry, not exit.
Thanks for the info
 

I hope to bring this up again because some strategy I use need to close individual order instead of the whole position.

Can MQ give some info??? 

 
doshur:

I hope to bring this up again because some strategy I use need to close individual order instead of the whole position.

Can MQ give some info??? 

You cannot close an Order,  you can delete a Pending Order.  You can place an Order and once it is executed it becomes a deal,  that deal may create, add to or subtract from a position.  

If you are using and discussing MT5/mql5 you must use the correct terminology if you want to communicate effectively:  Orders, Positions and Deals in MetaTrader 5

Reason: