Download MetaTrader 5

Open charts for open positions

To add comments, please log in or register
zubr
172
zubr  

Hi,

is there a function in MT5 or a script that opens for all my open positions (displayed in the Trade window) a Chart (using the default template)?

 

Thank you.

 

Best,

Chrs 

Balachandran Chandrasekar
44125
Balachandran Chandrasekar  
zubr:

Hi,

is there a function in MT5 or a script that opens for all my open positions (displayed in the Trade window) a Chart (using the default template)?

 

Thank you.

 

Best,

Chrs 

There is no function by default to do it automatically.

You can write an EA for that using this function

long ChartOpen(

string symbol, // Symbol name

ENUM_TIMEFRAMES period // Period

); 

zubr
172
zubr  
chandra100:

There is no function by default to do it automatically.

You can write an EA for that using this function

long ChartOpen(

string symbol, // Symbol name

ENUM_TIMEFRAMES period // Period

); 

Thank you. 

How can I iterate through my open positions (the Trade window) to get the symbols for ChartOpen? 

Balachandran Chandrasekar
44125
Balachandran Chandrasekar  
zubr:

Thank you. 

How can I iterate through my open positions (the Trade window) to get the symbols for ChartOpen? 

PositionsTotal function returns the number of open positions.

int PositionsTotal();

 

 Use a for loop looping from 1 to  PositionsTotal()

 

PositionGetSymbol function returns the symbol corresponding to the open position and automatically selects the position.

string PositionGetSymbol(

int index // Number in the list of positions

); 

Documentation on MQL5: Trade Functions / PositionGetSymbol
Documentation on MQL5: Trade Functions / PositionGetSymbol
  • www.mql5.com
Trade Functions / PositionGetSymbol - Documentation on MQL5
To add comments, please log in or register