How to get PositionsTotal by currency pair

 

Hi All,

I tried to make 1 EA which need to detect the PositionsTotal by currency pair. 

How to coding the PositionsTotal to detect the total of open position by currency pair.

I.e,  EURUSD detect 1 open position, USDCHF detect 1 open position.  Currently they give values 2 open position.

Please kindly help, thanks in advace.

 

You have to loop through all positions and count them individually.

For an example of such a loop search here for PositionsTotal and select CodeBase..

 
frbud:

Hi All,

I tried to make 1 EA which need to detect the PositionsTotal by currency pair. 

How to coding the PositionsTotal to detect the total of open position by currency pair.

I.e,  EURUSD detect 1 open position, USDCHF detect 1 open position.  Currently they give values 2 open position.

Please kindly help, thanks in advace.

Example: Calculate Positions and Pending Orders

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