Download MetaTrader 5

Open charts for open positions

To add comments, please log in or register
Create Forum topics and improve your rating!
zubr
172
zubr 2013.09.21 18:23 

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 

KoT 009
44107
KoT 009 2013.09.21 18:48  
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 2013.09.22 12:00  
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? 

KoT 009
44107
KoT 009 2013.09.22 13:26  
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