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
Regarding SL and TP, you track it by TRADE_TRANSACTION_DEAL_ADD and the DEAL_REASON, depending on the DEAL_REASON the deal price may be SL or TP, if the reason as SL or TP.
Unknown! I found that it failed 100% of the times I have tested it in the Strategy Tester, but there may be conditions unknown to me where it will work correctly. Instead, when I need to test such functionality, I do so "live" on a demo account.
However, I seldom use or rely on only the OnTradeTransaction() for tracking trades. I use it only as a secondary measure, and instead track the History, Orders and Positions directly, whenever a OnTrade() event occurs, or when a tick value change indicates possible changes in trade state.Thanks for the response.
As an update, I only use Market orders, so I don't know how OnTradeTransaction() handles Pending orders in the Strategy Tester.
It is difficult to develop and debug an EA when you design the EA according to the MQL5 documentation and the Strategy Tester doesn't function that way.
It makes it very difficult.
The TRADE_TRANSACTION_ORDER_ADD is generated when the order is sent to the trading server (it is not sent to trading server in tester, so probably is why this event is not fired). At this point the order state is usually ORDER_STATE_STARTED. It does not mean the order has been accepted and/or executed. You can know that an order has been placed by the event TRADE_TRANSACTION_ORDER_UPDATE, where if the order was placed will change the order status to ORDER_STATE_PLACED.
Regarding SL and TP, you track it by TRADE_TRANSACTION_DEAL_ADD and the DEAL_REASON, depending on the DEAL_REASON the deal price may be SL or TP, if the reason as SL or TP.
Thanks.
ORDER_STATE_PLACED
Your suggestion didn't seem to work either, using the Strategy Tester.
What I see in the debugger:
Форум по трейдингу, автоматическим торговым системам и тестированию торговых стратегий
Новая версия платформы MetaTrader 5 build 5260: улучшения в Algo Forge, расширение OpenBLAS и новые правила наследования в MQL5
fxsaber, 2025.09.07 09:30
Thanks for that!
In my MetaTrader 5 Version 5.00 Build 5260 5 September 2025:
CDealInfo::TakeProfit in not defined and dealInfo.TakeProfit(); generates compile error undeclared identifier.
The same is true for CDealInfo::StopLoss.
How can I get an updated version of DealInfo.mqh and the other Includes for MT5 Build 5260?
Thanks for that.
In my MetaTrader 5 Version 5.00 Build 5260 5 September 2025:
CDealInfo::TakeProfit in not defined and dealInfo.TakeProfit(); generates compile error undeclared identifier.
The same is true for CDealInfo::StopLoss.
How can I get an updated version of DealInfo.mqh and the other Includes for MT5 Build 5260?
You did not read @fxsaber's post that he generously referenced, in which he describes that the class methods are missing, so he proposed the code to be added.
So, that is what you have to do—to copy his proposed code and add it yourself to the CDealInfo class implementations.
When people answer you and offer help, please be so kind as to properly follow up on it.
You did not read @fxsaber 's post that he generously referenced, in which he describes that the class methods are missing, so he proposed the code to be added.
So, that is what you have to do—to copy his proposed code and add it yourself to the CDealInfo class implementations.
When people answer you and offer help, please be so kind as to properly follow up on it.
I did not see and proposal in fxsaber 's post. I did not see any reference to a proposal in the post.
@ fxsaber seemed to say, in the post, that the improvements shown were already made in MetaTrader 5 Version 5.00 Build 5260 dated 2025.09.07 09:30.
I checked my MetaTrader 5 Version 5.00 Build 5260 dated 5 September 2025, and those improvements have not yet been made.
I was asking if I can get an update of the standard libraries with those improvements from somewhere.
I did see the code that should be added to the CDealInfo class,
but it is dangerous for me to add those changes to my copies of the CDealInfo class
because how do I know if in some future MT5 update those changes will not be included and cause my application to fail? I cannot risk that.
The MQL5 development team should make those improvements to the MQL5 Libraries for all to benefit.
Fernandom, please tone down the nastiness and ramp up the help and assistance a little. I would appreciate it. Thanks.
Using the Standard Library has always been "dangerous" since its conception for the very reason you describe. It has always been somewhat "buggy" and "incomplete", and has suffered updates on occasion causing havoc for existing programs dependant on it. However, that also happens to the MQL5 functions and the language itself too, but the impact is different.
So, here are some solutions that users have implemented to prevent the issue with the Standard Library (some good, some less):
Personally, I consider option 4 more of a temporary stop-gap, but it is still a valid solution. For myself, I use a combination of options 1 and 2.
Which solution will you adopt?
EDIT: If you ever plan to code for others, or you simply want to make your programmes self-contained, then I recommend option 1 (with or without some local OOP code). This way, the programmes have no dependencies—single source code file for each program with no need for "#includes".
Yes, I have been somewhat arrogant with you (and others), but with some reason, mostly because I consider that you don't put in the necessary effort. Maybe it is because I am old school, during a time where there was no Internet and one had no recourse but to read the documentation, and programme by trial and error, over and over, until one got it right. No one would come to our aid to figure it out quickly, but this has the advantage of one really learning things well. Really well! I truely recommend you take this approach. It might seem slower (it's not), and it will truely make you a better programmer.
However, I totally disagree that I have not been helpful nor that I have not offered you proper assistance. Real "nastiness" would have been for me to totally ignore your posts, even when I see you struggling.
Again, I recommend the "old school" way!