I believe you can use the following algorithm:
1. Find opening deal with correct magic.
2. Remember DEAL_POSITION_ID.
3. Select all deals of this position with HistorySelectByPosition( pos_id ) .
4. Continue working in accordance to your algorithm, knowing for sure that all deals you have selected belong to correct position.
Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Deal Properties
- www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Deal Properties - Documentation on MQL5
Hi hasayama,
hasayama:
I believe you can use the following algorithm:
Thanks very much for what certainly looks as though it will be the answer to all our problems.
Cheers,
Jim
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
We've made a last minute decision to enter the competition. We've been working over the weekend to port one of our MT4 EAs, and we've hit a problem.
The EA Magic Number is not being applied to any of the closing deals, only to the opening deals. Here's an extract from a log:
Deal 1 is just the opening balance in the tester. The markets are closed at the moment, but in a few hours we'll discover whether the problem applies trading a demo account too. Whether it does or not, we'd still like to able to test our converted EA before submitting it!
Can anyone suggest what the problem is, and a way around it. I guess just not bothering to check the magic number at all would get us going in the short term, but that's definitely not a good long term solution!
Jim