Any ideas on how to isolate ChartSymbolperiod?

 
{
     ChartSetSymbolPeriod(0,"GBPUSD",PERIOD_H1);
     ChartSetSymbolPeriod(0,"US30",PERIOD_H4);
     ChartSetSymbolPeriod(0,"XAGUSD",PERIOD_M15);
     ChartSetSymbolPeriod(0,"US100",PERIOD_H1);
     ChartSetSymbolPeriod(0,"XAUUSD",PERIOD_M15);
     ChartSetSymbolPeriod(0,"EURUSD",PERIOD_H1);    
     ChartSetSymbolPeriod(0,"AUDUSD",PERIOD_M5); 
}

In this code, I was able to get the chart to open on my preferred timeframe but, it randomly chooses which chart to porpulate with it's respectivee timeframe. How can I get it to porpulate all charts at once with my preferred timeframes?

 
Mezzoforte Privilege Khoza:

In this code, it randomly chooses which chart to porpulate with it's respectivee timeframe. 

no it does not, it is applying the symbol and timeframe changes only to the chart you are running it on.

if you want to select a different chart you need to first get the chart id of the chart you want to change, instead of using chart id of 0

https://www.mql5.com/en/docs/chart_operations

Documentation on MQL5: Chart Operations / ChartFirst
Documentation on MQL5: Chart Operations / ChartFirst
  • www.mql5.com
ChartFirst - Chart Operations - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Paul Anscombe #:

no it does not, it is appling the symbol and timeframe changes only to the chart you are running it on.

if you want to select a different chart you need to first get the chart id of the chart you want to change, instead of using chart id of 0

https://www.mql5.com/en/docs/chart_operations

Thank you. Sso with the different chart id's, the logic is that it will open all charts at once?

 
Mezzoforte Privilege Khoza #: Thank you. Sso with the different chart id's, the logic is that it will open all charts at once?

If you want to open up a new chart, you have to use ChartOpen(). The function ChartSetSymbolPeriod() is for changing an already opened chart to a different symbol and/or time-frame.

Documentation on MQL5: Chart Operations / ChartOpen
Documentation on MQL5: Chart Operations / ChartOpen
  • www.mql5.com
ChartOpen - Chart Operations - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Fernando Carreiro #:

If you want to open up a new chart, you have to use ChartOpen(). The function ChartSetSymbolPeriod() is for changing an already opened chart to a different symbol and/or time-frame.

Great, makes a lot of sense. I can now complete my script.
 
Mezzoforte Privilege Khoza #:
Great, makes a lot of sense. I can now complete my script.
Thanks again 
Reason: