Cleasfifthy:
Can you see what is wrong here? I get some operator is needed when calling this function. I want to scan orders on other currency pairs on other charts and see what type the other orders are, and set it to a number of 1 if it is active. So I call it two times one for buy and one for sell. But it is not working
Try to get error() when coding, it will save you a lot of time.
I suggest to change the way you get the type of order. I use this type of code for getting a position. Do the same with orders. If you'll get more
than one order use count++ to get it's number.
double positionSell=0; double positionBuy=0; for(int i=PositionsTotal()-1; i>=0; i--) if(m_position.SelectByIndex(i)) // selects the position by index for further access to its properties if(m_position.Symbol()==m_symbol.Name() && m_position.Magic()==m_magic) { if(m_position.PositionType()==POSITION_TYPE_BUY) positionBuy=1; if(m_position.PositionType()==POSITION_TYPE_SELL) positionSell=1; }
![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
Can you see what is wrong here? I get some operator is needed when calling this function. I want to scan orders on other currency pairs on other charts and see what type the other orders are, and set it to a number of 1 if it is active. So I call it two times one for buy and one for sell. But it is not working