Hello all:

I've always understood a position to be an aggregate of all open trades for a given symbol, but from what I can tell, I think: MT5/MQL5 considers a position and a trade to be the same thing.

eg. I send two distinct market buy orders, they get fulfilled into two deals. I thought that was supposed to produce two long trades making up one long position (the sum of the two).  However, I'm pretty sure I'm seeing that the Trades tab in the Terminal shows it as two distinct positions.

So... am I doing and reading this right?  Position == Trade?  Or am I missing something?

Thanks!

David _Detnator_ :

Hello all:

I've always understood a position to be an aggregate of all open trades for a given symbol, but from what I can tell , I think: MT5/MQL5 considers a position and a trade to be the same thing.

eg. I send two distinct market buy orders, they get fulfilled into two deals. I thought that was supposed to produce two long trades making up one long position (the sum of the two).  However, I'm pretty sure I'm seeing that the Trades tab in the Terminal shows it as two distinct positions.

So... am I doing and reading this right?  Position == Trade?  Or am I missing something?

Thanks!

You must remember that there are two types of trading accounts: netting accounts and hedge accounts. Please read the help (Basic Principles) - these two types of trading accounts are described in the help, as well as the basic concepts (order, deal, position) are described in the help.

Before you proceed to study the trade functions of the platform, you must have a clear understanding of the basic terms: order, deal and position...

David _Detnator_: I've always understood a position to be an aggregate of all open trades for a given symbol, but from what I can tell, I think: MT5/MQL5 considers a position and a trade to be the same thing.

eg. I send two distinct market buy orders, they get fulfilled into two deals. I thought that was supposed to produce two long trades making up one long position (the sum of the two).  However, I'm pretty sure I'm seeing that the Trades tab in the Terminal shows it as two distinct positions. So... am I doing and reading this right?  Position == Trade?  Or am I missing something?

Just as @Vladimir Karputov pointed out, on Netting accounts, every trade results in a single position for that symbol, irrespective of it being Buys or Sells. There is always ONLY ONE net position open on that symbol.

However, for a Hedging account, the individual trades are maintained in a similar way as MT4 and they are not merged into one.

By the way, if you want to know how a Netting account derives its "Net Position", it uses the same principal as the following calculations that you can use in hedging accounts to study the net effect of a basket of trades.

Average the entry price of the open trades

Fernando Carreiro, 2021.06.19 12:47

Please note that if your orders have different volumes (lots) and you are trying to calculate the net open price (that will be equivalent to a single order for the entire batch), then you have to apply the following calculations:

Any great idea about HEDGING positions welcome here

Fernando Carreiro, 2018.09.17 21:17

For those of you that want to learn to see the "light" and not fall into the trap of "hedging" and Grid strategies, here is the basic math:

:

Learn to do your research properly! Do not be blinded by false promises. Do the math!

You must remember that there are two types of trading accounts: netting accounts and hedge accounts. Please read the help (Basic Principles) - these two types of trading accounts are described in the help, as well as the basic concepts (order, deal, position) are described in the help.

Fernando Carreiro #:

Just as @Vladimir Karputov pointed out, on Netting accounts, every trade results in a single position for that symbol, irrespective of it being Buys or Sells. There is always ONLY ONE net position open on that symbol.

However, for a Hedging account, the individual trades are maintained in a similar way as MT4 and they are not merged into one.

OK... Thanks @Fernando Carreiro and @Vladimir Karputov.

Vladimir, I don't know why I've never seen that Help area before.  I've always been using the Documentation section.  Looks like that Help will be really .. well ... helpful. 😉. Thanks.

EDIT 10 minutes later: I wrote the above, and the below, even after reading the stuff in the help you pointed me to (Vladimir), because I wasn't sure I understood it.  However... I think the act of trying to explain it in this message has made something click.  At this point I'm pretty certain what I've explained below is correct (with the exception that a stop loss can also be part of a pending order, not only a position).

Feel free to ignore all this lengthy text now, if you like... unless I've still got something drastically wrong, then please correct me.  But I think I get it now.

Still, I'll leave the rest of this here for anyone else it might help.  And once again to the two of you who answered here, thank you!

[Remainder of this original message:

Fernando, I'm not really familiar with MT4 enough to get the comparison you're making there, but I think I've realized the word "Trade" is pretty irrelevant, and I might be asking the wrong question (but I was trying to keep things simpler). Let me come back to that in a sec.  If I stick to the terms MT5 has in its functions, I think you're both saying:

• Netting accounts:  I send an open ORDER on a given symbol. When executed, that creates a POSITION on the symbol. If I send another open ORDER on the same symbol, that then adds to/gets absorbed into the existing POSITION on the symbol.
• Hedging accounts: I send an open ORDER on a given symbol. When executed, that creates a POSITION on the symbol.  If I send another open ORDER on the same symbol, it creates another, separate POSITION on the symbol.

Is that correct?

I'm hoping I'm understanding that correctly now. Can you/anyone let me know if I've got that right, now, or not?

(If I've got it right now, then I think I have one more question on this after that, but I'm learning to ask one thing at a time. 😉)

Thank you again!

PS. I'm not seeking lengthy explanatory answers to this.  I'm hoping your answers will be as simple as "yep, you got it now".  Though if I haven't please feel free to point me to relevant documentation or whatever else.  I'm not trying to be lazy here.  Just can't ever seem to FIND these answers.]

MQL5 Reference - How to use algorithmic/automated trading language for MetaTrader 5
• www.mql5.com
MQL5 Reference - How to use algorithmic/automated trading language for MetaTrader 5

David _Detnator_ #: If I stick to the terms MT5 has in its functions, I think you're both saying:

• Netting accounts:  I send an open ORDER on a given symbol. When executed, that creates a POSITION on the symbol. If I send another open ORDER on the same symbol, that then adds to/gets absorbed into the existing POSITION on the symbol.
• Hedging accounts: I send an open ORDER on a given symbol. When executed, that creates a POSITION on the symbol.  If I send another open ORDER on the same symbol, it creates another, separate POSITION on the symbol.

Yes, that is correct!

David _Detnator_ #: And so regardless of the account type (hedging or netting), if I want to read and possibly adjust a stop loss, I read it (the stop loss) from the POSITION, and I send an order to do that adjustment to the stop loss... on the POSITION.

Not really! You won't actually send out a physical order. You would use the OrderSend() function with the trade operation type TRADE_ACTION_SLTP, to carry out a modification of the stops of an open position.

PS! These modifications don't appear in the deal history. They are just position modifications.

By the way, all the documentation that has been referenced thus far is available to you via the applications' "Help → Help Topics" (whether that be on the main MetaTrader terminal application, or on the MetaEditor application), as well as "Help → MQL Reference" on the MetaEditor (or via F1 context help when editing code in the editor and you need help on a specific function, etc.).

For example, the documentation reference that @Vladimir Karputov gave you is there in MetaTrader help:

Fernando Carreiro #:

Yes, that is correct!

Not really! You won't actually send out a physical order. You would use the OrderSend() function with the trade operation type TRADE_ACTION_SLTP, to carry out a modification of the stops of an open position.

PS! These modifications don't appear in the deal history. They are just position modifications.

OK.  I think that makes sense, on all counts.  Thanks again Fernando!

Fernando Carreiro #:

By the way, all the documentation that has been referenced thus far is available to you via the applications' "Help → Help Topics" (whether that be on the main MetaTrader terminal application, or on the MetaEditor application), as well as "Help → MQL Reference" on the MetaEditor (or via F1 context help when editing code in the editor and you need help on a specific function, etc.).

For example, the documentation reference that @Vladimir Karputov gave you is there in MetaTrader help:

Good point. With all the documentation at mql5.com/en/docs it never occurred to me that the Help might be different.  Good to know. Thanks!

MQL5 Reference - How to use algorithmic/automated trading language for MetaTrader 5
• www.mql5.com
MQL5 Reference - How to use algorithmic/automated trading language for MetaTrader 5
Reason: