bool CTradingEngine31::SearchTradingSignals(void) { MqlRates rates[]; ArraySetAsSeries(rates,true); if(CopyRates(_Symbol, _Period, 0, 3, rates) != 3) { Print("CopyRates of ",_Symbol," failed, no history"); return(false); } if(rates[1].close >whatever) --do something-- }
You are copying rates from the current chart only, Where are your other symbols engaged?
I was expecting something like this
bool CTradingEngine31::SearchTradingSignals(void) { MqlRates rates[]; ArraySetAsSeries(rates,true); for (int i=0; i<ArraySize(Symbols_Array); i++) if(CopyRates(Symbols_Array[i], _Period, 0, 3, rates) != 3) { Print("CopyRates of ",Symbols_Array[i]," failed, no history"); return(false); } if(rates[1].close >whatever) --do something-- }
Omega J Msigwa #:
You are copying rates from the current chart only, Where are your other symbols engaged?
I was expecting something like this
You mean this?
int CTradingEngine31::OnInit(string _TradeSymbol ) { ResetLastError(); if(!m_symbol.Name(_TradeSymbol)) // sets symbol name return(INIT_FAILED); RefreshRates(); -------code------- }So _TradeSymbol should be Symbols_Array?
Omega J Msigwa #:
Hold on! I don't know your entire code, just check your entire copy rates method call to ensure you copy all the symbols in a loop
Raw code without data
Files:
Example.mq5
82 kb
Sorry, I can read your entire code to spot bugs I can point out what's wrong in a very specific areas so that you fix it yourself. If you can't open a freelance work for me or anyone else available by the way I have checked the code there are multiple imports and include files that I don't have in my pc so nobody can compile and debug the file anyway. I think you are better off asking about the issue than sharing the entire code
Could be, I don't know, I just found empty ea template and trying to fill it with my own data.
This code works well but there I also didn't find anything about copying rates. So my question remains same.
Something similar maybe?
string Tradesymbol[]; MqlRates rates[]; ArraySetAsSeries(rates,true); for (int i=0; i<ArraySize(TradeSymbol); i++) if(CopyRates(TradeSymbol[i], _Period, 0, 3, rates) != 3) { Print("CopyRates of ",TradeSymbol[i]," failed, no history"); return(false); }

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'm using multi symbol ea with classes and need to get close of last bar but through the usual method with MqlRates I get last close only for the 1st pair in list.