
How to start with MQL5
- 2020.12.19
- www.mql5.com
This thread discusses MQL5 code examples. There will be examples of how to get data from indicators, how to program advisors...

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,
Im having trouble with an EA. I am trying to calculate open positions for this EA (with a certain magic number)
For testing, I am adding one buy position with a different magic number so I can see if this is working or not.
In backtest I always get both position when I count, but they have different magic numbers.
Why is that? What am I doing wrong here?
Im used to MT4 where you put some code to identify a position first, I cant find that function for MT5.
I guess its something like that I just cant find and that is missing.
Code for counting:
some code for first buy:
Some code for second buy:
Why does it not just calculate the first order and not the second? Why does it calculate both?
Thanks for reply!