How to find the number of open positions with MQL4?

 
How to find the number of open positions with MQL4?
 
Josama Doland:
How to find the number of open positions with MQL4?

Read:

Simple Expert Advisor - Simple Programs in MQL4 - MQL4 Tutorial

Simple Expert Advisor - Simple Programs in MQL4 - MQL4 Tutorial
Simple Expert Advisor - Simple Programs in MQL4 - MQL4 Tutorial
  • book.mql4.com
Simple Expert Advisor - Simple Programs in MQL4 - MQL4 Tutorial
 
Josama Doland: How to find the number of open positions with MQL4?
  1. Total?

    Perhaps you should read the manual. OrdersTotal - Trade Functions - MQL4 Reference
       How To Ask Questions The Smart Way. (2004)
          How To Interpret Answers.
             RTFM and STFW: How To Tell You've Seriously Screwed Up.

  2. Current chart and by the EA?
    Do an OrderSelect loop and filter out the others and count. Show us your attempt (using the CODE button) and state the nature of your difficulty.
              No free help (2017)

 

In the documentation there are plenty of examples - to get all orders from the whole account use OrdersTotal().

If you want to count only trades from chosen symbol or strategy (defined by predefined magic number) – just go in loop for all trades and count only those with proper OrderSymbol or OrderMagicNumber

 
thank you very much for your help.
Reason: