MT5, calculate open positions
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...
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!