Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
- If you show your attempts and describe your problem clearly, you will most probably receive an answer from the community. Use the CODE button (Alt-S) when inserting code.
- To learn MQL programming, you can research the many available Articles on the subject, or examples in the Codebase, as well as reference the online Book and Documentation
- Remember also, that you can debug your code with MetaEditor's own debugging functionality.
- Finally, you also have the option to hire a programmer in the Freelance section.
Orders, Positions and Deals in MetaTrader 5
MetaQuotes, 2011.02.01 16:13
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. skrantz71:
Hi,
I been struggling for some evenings now trying to get the proffit/loss from the last closed order and have tried alot of different codes.
When a run my Strategy Tester it feels like it misses orders?
and i read somewhere that you can use it in Tick() or in Trade() function??
Should not this be an easy thing in a trading plaform?
Anyone that can point in right direction or have tips on how to get proffit / Loss on last closed order and so I get it everytime an order is closed?
Thanks in advance.
Stefan-Sweden
You can loop through all closed deals and get the profit of the last closed deals
I've been using it for my code
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
I been struggling for some evenings now trying to get the proffit/loss from the last closed order and have tried alot of different codes.
When a run my Strategy Tester it feels like it misses orders?
and i read somewhere that you can use it in Tick() or in Trade() function??
Should not this be an easy thing in a trading plaform?
Anyone that can point in right direction or have tips on how to get proffit / Loss on last closed order and so I get it everytime an order is closed?
Thanks in advance.
Stefan-Sweden