Order vs Deal vs Position vs TRADE (yes, again -- but more than past answers).

 

Hi all.  Thanks for all the help so far with a few questions I've posted recently.  Here's another.  Well, a bunch of related ones...

I've read a number of posts and the doc'n about Order vs Deal vs Position, including this documentation, and this, and others.  A few things I'm unclear on, and I'd really like to sort it out definitively. 😊  

1. Order vs Deal vs Position is almost clear, I think, but not quite... 

  1. Order: From everything I've found (with one exception), "Order" seems to a request or instruction we send to the broker. It might be an order to open a trade, close a trade, update a trade (eg. new stop loss), etc.  A single instruction/request for a single event in time -- but just the instruction/request not the event itself..  
  2. Deal: this seems to simply be the execution of a single order -- ie. the event itself: If the order is to Open a trade, then the deal is the actual opening of the trade. If the order is to close the trade, then the deal is the actual closing of the trade.  Not sure where that fits with updating a trade (eg. adjust stop loss) -- is that a deal also?
  3. Position:  This has me confused.  I think it's, kind of, the "state" of one or more open trades on one instrument.  If the above two (Order, Deal) are correct, then I think the following example should be correct...?
    1. Send the following Orders -- instructions to the broker to take these actions, each with their own conditions (market vs pending, price, SL, TP, etc.): 
      1. Order #1: open a SHORT trade for EURUSD.
      2. Order #2: open a second SHORT trade for EURUSD.
      3. Order #3: open a third SHORT trade for EURUSD.
      4. Order #4: open a SHORT trade for AUDUSD.
      5. Order #5: open a LONG trade for AUDUSD.
      6. Orders #6, #7, #8, #9, #10: close each of the trades (presumably) opened by Orders #1-#5 in that order.
    2. Deals: Broker executes each of those orders one by one: 
      1. Order #1 (open short EURUSD) is successful and becomes Deal #1
      2. Order #2  (open short EURUSD) is successful and becomes Deal #2
      3. Let's say Order #3  (open short EURUSD) is unsuccessful (eg. not enough in account to cover it).  This does not become a deal...?
      4. Order #4  (open short AUDUSD) is successful and becomes Deal #3
      5. Order #5  (open short AUDUSD) is successful and becomes Deal #4
      6. Order #6  (close trade created by Order #1) is successful and becomes Deal #5
      7. Order #7  (close trade created by Order #2) is successful and becomes Deal #6
      8. Order #8  (close trade attempted by Order #3) is unsuccessful (the trade didn't happen) and does not become a deal...?
      9. Order #9 (close trade created by Order #4) is successful and becomes Deal #7
      10. Order #9 (close trade created by Order #5) is successful and becomes Deal #8
    3. Positions: 
      1. Order #1 -> Deal #1 creates Position #1 (for EURUSD)
      2. Order #2 -> Deal #2 adjusts Position #1 (for EURUSD)
      3. Order #3 has no effect on positions
      4. Order #4 -> Deal #3 creates Position #2 (for AUDUSD)
      5. Order #5 -> Deal #4 adjusts Position #2 (for AUDUSD)
      6. Order #6 -> Deal #5 adjust Position #1
      7. Order #7 -> Deal #6 closes Position #1
      8. Order #8 has no effect on positions
      9. Order #9 -> Deal #7 adjusts Position #2
      10. Order #10 -> Deal #8 closes Position #2

That's my understanding so far.  Some questions: 

  1. Some things I've read seem to contradict some of that which suggests I may have some of it wrong: 
    1. Order: The exception is this statement in the documentation: "...in some cases, execution of an order can result in several deals." -- I don't understand how that might be possible, unless one Order can in fact be multiple event instructions?  If so, when might that be possible/allowed?  What circumstances?  Or have I just got something about Orders wrong here?
    2. Deal: I read somewhere (though I can't find it now) suggested that a deal might be the entire process of the trade, from open to close (with possible adjustments along the way)...?  If this is the case I think that would mean Orders #6, #7, #9, #10 above would adjust Deals #1 - #4 instead of resulting in new Deals...?  Which is it?  I suspect this is wrong and the first description and example above are correct, but really wanting to confirm/be sure.
    3. Position: I'm not sure if a position is direction-dependent.  ie. Does Order #4's SHORT order for AUDUSD create one position ("AUDUSD Short"?) and Order #5's LONG order for AUDUSD create a separate position ("AUDUSD Long"?), or do Orders #4 & #5 create and adjust the same position ("AUDUSD Position"?)...?




2. Finally, if through all the above questions, and their answers, we comprehensively define Order, Deal, and Position.  Then what's a Trade?  

  • As I started writing this question I couldn't figure out the difference between Deal and Trade, but that was because I thought Deal "might be the entire process of the trade", from open to close.
  • I think now I understand the "Trade" to be everything from open to adjustments to close. That entire process is the Trade, and it is made up of multiple deals (one to open it, zero or more to adjust it, one to close it).  So this question is simply asking to confirm if that's actually correct.
  • And that's different to position because a position might be made up of multiple trades...?  So:  Orders #1 and #2 are actions/events/deals for two separate trades that both contribute to one position (on an instrument, EURUSD in that case)...?  

Is this correct?




    I think that's everything.

    Thank you!



    A couple of requests please: 

    I welcome/encourage anyone who knows for sure to answer.  For both my sake, and the sake of anyone else reading this in the future, could I ask anyone who does not know for sure, not to answer (so no "I think it's..." answers pease). 

    Also, Please don't yell at me for not reading the documentation, or "this is already answered" etc. I've read everything I can find. those things I've read elsewhere are either not completely clear on, or don't cover, some of the more nuanced specifics I've asked about above. I've outlined above both my understandings and my confusions, based on everything I've read. I'm pretty sure I'm not the only person confused on these nuances, so I'm hoping the answers provided here clear these things up for others as well as myself.



    The new concept of position, orders and deals is too confusing. Need some help!
    The new concept of position, orders and deals is too confusing. Need some help!
    • 2010.08.18
    • www.mql5.com
    An order becomes a deal. A long deal open or increases a position...
     

    So... really?  No one knows?

    (😜)

     
    Detnator #: So... really?  No one knows? (😜)

    It's not that no one knows. It's that the your post is so long winded, with too much to decipher and then too much to answer.

    People, such as myself are here to offer quick help, not to offer tutoring. I'm not trying to be arrogant of offensive, just stating our general mindset when we take our time to answer posts.

     
    Fernando Carreiro #:

    It's not that no one knows. It's that the your post is so long winded, with too much to decipher and then too much to answer.

    People, such as myself are here to offer quick help, not to offer tutoring. I'm not trying to be arrogant of offensive, just stating our general mindset when we take our time to answer posts.

    I would like an answer to this also Fernando... please..take your time .

    Thanks!

     

    You go to Starbucks and request a Cappuccino withe 2 sugars, and the barrister mixes coffee and milk in just the right amount, but no longer has any sugar and puts it all into a paper cup and gives it too you.

    • Order: Your request for a Cappuccino and sugar
    • Deals: Coffee and milk
    • Position: The fine drink in the paper cup without sugar.

    Yes, I know I am just have some fun here, but in essence and in a very simplified way, that is basically it.

    You request a 100 shares of Starbucks and the broker goes and acquires 50 shares from Adam and 40 shares from Eve, but no one else wants to sell, so the broker hands over the 90 shares in an envelope.

    • Order: Your request for 100 shares of Starbucks
    • Deals: 50 shares from Adam and 40 from Eve
    • Position: An envelope containing the 90 shares.
    Notice how I have just hinted to one of the types of "Filling Policy"? 😉
       

      Hi, please read 

      https://www.mql5.com/en/articles/211


      May be helpful for clarification.


      Matthias

      Orders, Positions and Deals in MetaTrader 5
      Orders, Positions and Deals in MetaTrader 5
      • www.mql5.com
      Creating a robust trading robot cannot be done without an understanding of the mechanisms of the MetaTrader 5 trading system. The client terminal receives the information about the positions, orders, and deals from the trading server. To handle this data properly using the MQL5, it's necessary to have a good understanding of the interaction between the MQL5-program and the client terminal.
       
      Fernando Carreiro #:

      It's not that no one knows. It's that the your post is so long winded, with too much to decipher and then too much to answer.

      People, such as myself are here to offer quick help, not to offer tutoring. I'm not trying to be arrogant of offensive, just stating our general mindset when we take our time to answer posts.

      Hi Fernando.  I've deliberated over how to reply to this...  Couple of things...

      First, I appreciate you mentioning it, although no worries, I don't feel your comment was arrogant or offensive.

      Second, yes, you take time to answer posts, and it's appreciated.  You in particular are very generous with your time and knowledge. You've been one of the first to answer every one of my questions so far, and I've seen you give answers to nearly every other question I've read on these forums when I'm looking up answers before I post a question if I can't find an answer already here. I wonder how anyone would have the time to give as much as you do. Needless to say thank you.

      Third, yes, my post was long and complex. I probably should have broken it into more than one post. It's been a little frustrating trying to figure all this out. The documentation gives a basic explanation, but there are nuances the documentation doesn't cover. Whenever I've asked MetaQuotes support for any help, guess what they usually say?  "Ask your question on the forums".  Lol. But other answers don't address the nuances either.

      I tried to figure out how to word my post to ask about those specific nuances. I could probably have done better, and I'll give that some more thought. 

      In the meantime, I reached out to a contact I have that sometimes has answers. He's not really a friend or the kind of person who I could ask anything any time, but he'll be helpful occasionally if I don't bother him too much, so I'm very selective about when I do reach out to him. I considered this one of those times. Interestingly, I piqued his curiosity because he wasn't entirely sure of some of the fine details either. I shared with him your two examples (the coffee one gave us a chuckle, thank you, lol) and between the two of us, plus a bunch more research, I think we figured out most of it.

      In doing so I see that some of the assumptions I made in my post are wrong (particularly Trade v Position -- it seems they are actually the exact same thing?), and I can see how that has made my post even more confusing/complicated. So my apologies for that.

      There's still one or two fine details I'm not quite sure about, but I won't ask them here, since it will make this post even more complicated/confusing. I'll see if I can post another much simpler question or two at some point soon specifically about those.

      Thank you again for all your generosity with your time and knowledge.

       
      Detnator #: Hi Fernando.  I've deliberated over how to reply to this...  Couple of things... Thank you again for all your generosity with your time and knowledge.

      You are welcome, but remember this ... one learns best (and is way more satisfying) when one figures things out on ones own.

      So, use the Strategy Tester to run small pieces of your code, where you play around with Orders, Deals and Positions (yes, read up on the article that @Dr Matthias Hammelsbeck referenced too).

      Orders, Positions and Deals in MetaTrader 5
      Orders, Positions and Deals in MetaTrader 5
      • www.mql5.com
      Creating a robust trading robot cannot be done without an understanding of the mechanisms of the MetaTrader 5 trading system. The client terminal receives the information about the positions, orders, and deals from the trading server. To handle this data properly using the MQL5, it's necessary to have a good understanding of the interaction between the MQL5-program and the client terminal.
       
      Dr Matthias Hammelsbeck #:

      Hi, please read 

      https://www.mql5.com/en/articles/211


      May be helpful for clarification.


      Matthias

      Very helpful, although for different reasons than this post's questions.  Regardless, Thanks!

       
      Fernando Carreiro #:

      You are welcome, but remember this ... one learns best (and is way more satisfying) when one figures things out on ones own.

      So, use the Strategy Tester to run small pieces of your code, where you play around with Orders, Deals and Positions (yes, read up on the article that @Dr Matthias Hammelsbeck referenced too).

      Yes, you're absolutely right.

      I usually start asking questions here either when I've been banging my head against a wall on a topic consistently for a while, or I'm on a really tight deadline and just need to know something fast.

      But nearly everything I've learned about MT/MQL, over about six months now, has been through research accompanied with trial and error. It's a consistent ocean of waves varying from very frustrating to very satisfying!  I'm sure you can relate. 😉

       
      Fernando Carreiro #:
      ition: An envelope containing the 90 sh

      Good. Your example is perfect. 

      Order is a request from user.

      Deal is process from broker.

      Position is a result for discussion of the user and broker 

      Reason: