Errorhandling in MQL5 - page 2

 
Marco vd Heijden:

the purpose of symbols without a tick feed is for you to do a scan over symbolstotal false, to get an error, because there is no tick feed,

no i do not mean you do a scan over symbols total false you never do a scan over sysmbols total false you only do a scan over symbols total true because then you can be sure there will be a active tick feed for all those symbols.

what i mean is that you compare to filter the symbols you want to use.

you will get it eventually. 

If I loop over symbolstotal(true) there is only one symbol, namely the one selected to test. Here is the code I used, you will easily be able to correct it to show all forex symbols, I suppose:

for(int i=0;i<SymbolsTotal(true);i++)
     {
      string thisSymbolName=SymbolName(i,true);
      if(!SymbolInfoString(thisSymbolName,SYMBOL_PATH,thisSymbolPath))Print("Error getting path!");
      Print("Symbol ",i," Name=",thisSymbolName," Path=",thisSymbolPath);
     }
 

its correct.

you get only one symbol to test and it will show all available symbols on live market. 

 
Marco vd Heijden:

its correct.

you get only one symbol to test and it will show all available symbols on live market. 

No this is not correct. Here is a picture of Strategy tester with multiple charts on multiple symbols.

As you can see there is one Symbol "Nor25Oct15" that has no Quotes, and throws an error when trying to Sync the history.

As it turns out, this is not directly a Metatrader issue. I contacted my Broker (which provides the history data), they said the Symbol was set up wrong and corrected it in a matter of minutes.

However, since the history sync happens before any part of the EA is executed, there is no way to catch this error. This cannot be bad programming since my program is not even executed when the error occurs.

If any of you has a creative way to solve this problem, please go ahead. I already tried writing all working symbols into a file and reading it from another tester instance, but that did not really cut it.

As far as I can tell, this should better be resolved on a lower level directly in the metatrader software. 

Multiple Symbols&Charts in Strategy Tester 

 

the fact that you are looking for a symbol that has no feed makes it your mistake.

you should check on forehand which symbols are available to prevent this error.

it is your mistake. 

your broker can make a mistake too, but it is your responsibility to capture it.  

 
Marco vd Heijden:

the fact that you are looking for a symbol that has no feed makes it your mistake.

you should check on forehand which symbols are available to prevent this error.

it is your mistake. 

You can't check for this error to prevent it. If you check for it (accessing the symbol), the automatic download will start and you will get the error.

obay is right, though it's more an MT5 issue than mql5. As it happens in the Strategy Tester independently of the running code.

 
Marco vd Heijden:

the fact that you are looking for a symbol that has no feed makes it your mistake.

you should check on forehand which symbols are available to prevent this error.

it is your mistake. 

your broker can make a mistake too, but it is your responsibility to capture it.  

I suggest you to report this to ServiceDesk, you are right.
 
Alain Verleyen:

You can't check for this error to prevent it. If you check for it (accessing the symbol), the automatic download will start and you will get the error.

obay is right, though it's more an MT5 issue than mql5. As it happens in the Strategy Tester independently of the running code.

you simply wait for a first tick, if it never comes you can conclude the symbol is inactive.

just blindly assuming that a symbol is active is wrong.

if this happens before ever running any code then i can only agree because then there would not be any option to prevent this from happening. 

 

@ Alain Verleyen: 

I already reported it, they seem to be aware of it.

@ Marco vd Heijden:

You do not seem to understand. The Symbol has data in normal live terminal. There simply is no history data which causes an error that cannot be resolved.

You will get it eventually ;) 

 
Marco vd Heijden:

you dont do loops over symbolstotal false only over symbolstotal true.

when you do a loop over symbolstotal false you try to work with none existent symbols.

this is a serious flaw indeed, but it's not metatraders, it's your personal flaw.

Saved me from a lot of debugging. Thanks!
Reason: