You can use this command
Now your biggest issue is knowing where you have been .
So :
- when your ea is attached first you are looking for a "file" . If it exists you continue scanning if it does not exist you start scanning.
- The file does not exist : you do the scan of the market watch as you already have and store each symbol in an array
- Save the file with the number of total symbols on top , the current index second and , the list of symbols from the array next
- Navigate to the first symbol and anticipate that you may be already in a symbol from the list
- Then the ea reloads finds that a file exists reads it , advances the index (second write) and moves on to the next symbol
- When you reach the last symbol you delete the file and you probably leave a file to indicate you have scanned these symbols
![Documentation on MQL5: Chart Operations / ChartSetSymbolPeriod Documentation on MQL5: Chart Operations / ChartSetSymbolPeriod](https://c.mql5.com/36/80/documentation-on-mql5-chart-operations__4.png)
Documentation on MQL5: Chart Operations / ChartSetSymbolPeriod
- www.mql5.com
ChartSetSymbolPeriod - Chart Operations - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Lorentzos Roussos #:
You can use this command
Now your biggest issue is knowing where you have been .
So :
- when your ea is attached first you are looking for a "file" . If it exists you continue scanning if it does not exist you start scanning.
- The file does not exist : you do the scan of the market watch as you already have and store each symbol in an array
- Save the file with the number of total symbols on top , the current index second and , the list of symbols from the array next
- Navigate to the first symbol and anticipate that you may be already in a symbol from the list
- Then the ea reloads finds that a file exists reads it , advances the index (second write) and moves on to the next symbol
- When you reach the last symbol you delete the file and you probably leave a file to indicate you have scanned these symbols
thanks a lot, it helps a lot. Now it is clear. Regards
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
I need to develop an EA that will process several charts visible in the MT4 screen, like EURUSD-H1, USDCAD-D1, etc.
I can switch to each of these charts with such code as:
void Charts() {long curr,prev=ChartFirst();int i=0;
while(i<100) {Print(i,ChartSymbol(prev)," ID =",prev);Print("ChartSymbol=",ChartSymbol(prev));curr=ChartNext(prev); if(curr<0) break;prev=curr;i++;}}
So the names of the Charts are printed in the Experts window of MT4.... but it looks these names are simply seen in the screen. And I cannot transtition into these Charts by Navigate, or other similar commands...
For example, I can switch into the first Chart with the following function:
bool Chart1Goto() {long id=ChartFirst();return ChartSetInteger(id,CHART_BRING_TO_TOP,true);ChartRedraw();}
But in order to go to the next Charts, when I use the following code..... it only opens the new instances of the same Chart windows:
ChartNext() - does not help as well...
long ChartGoto(string sym,int per) {long ret=0;int Fw=WindowHandle(sym,per);Print("HANDLE=",Fw);if(Fw!=0)ret=ChartOpen(sym,per); return ret;} //open the same chart as a second one...
Any idea? Maybe Lorentzos again?))
Thanks in advance.
Regards