ket314MQL4 :
Hello,
I would like to know how to open several charts in mql5 ?
I tried to do this but there is only one graph that opens
(I run the code I execute the program by doing ctrl + f5)
If there is no symbol in the "Market Watch" window, OpenChart will not work. To protect yourself, use SymbolSelect
//+------------------------------------------------------------------+ //| 1.mq5 | //| Copyright © 2020, Vladimir Karputov | //+------------------------------------------------------------------+ #property copyright "Copyright © 2020, Vladimir Karputov" #property version "1.00" //--- input parameters input string InpSymbol_0 = "EURUSD"; // Symbol 0 input string InpSymbol_1 = "EURJPY"; // Symbol 1 //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- SymbolSelect(InpSymbol_0,true); SymbolSelect(InpSymbol_1,true); Print(InpSymbol_0,",H1 chart ",ChartOpen("EURUSD", PERIOD_H1)); Print(InpSymbol_0,",H1 chart ",ChartOpen("EURJPY", PERIOD_H1)); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+
Documentation on MQL5: Market Info / SymbolSelect
- www.mql5.com
[in] Switch. If the value is false, a symbol should be removed from MarketWatch, otherwise a symbol should be selected in this window. A symbol can't be removed if the symbol chart is open, or there are open positions for this symbol.
Files:
1.mq5
4 kb
Hello,
thank for your help.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello,
I would like to know how to open several charts in mql5 ?
I tried to do this but there is only one graph that opens
(I run the code I execute the program by doing ctrl + f5)