Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
psychekiro: I use this code to count the total number of buy and sell orders for all my pairs but how can I change the code to make it count only individual pairs attached to each chart?
Positions are not associated with charts. They are, however, associated with symbols. So, check if the symbol matches the chart symbol.
Returns the requested property of an open position (string)
POSITION_SYMBOL
Symbol of the position
string
Or, instead of using "PositionGetTicket", you can use "PositionGetSymbol" to select and get the symbol, instead of the ticket number if you don't need it.
EDIT: Also, consider using a Magic Number to prevent the EA from clashing with other running EAs if it is only counting its own positions.
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
I use this code to count the total number of buy and sell orders for all my pairs but how can I change the code to make it count only individual pairs attached to each chart?