Auto Rerun Exploration When Error

Hello! On Auto-Repeat if exploration returns an error in the Analysis window, is there a way to rerun the Exploration one or two times more automatically (ignoring the error) and then if the error still persists to stop it?

Alternatively - when an error is produced in Exploration, the Analysis window only shows "Error 10....." for example. Is it possible to add more information to this message to show the ticker for which this error was produced?

@trongart Error 10 means:

Subscript out of range. You must not access array elements outside 0..(BarCount-1) range. Occurs when you attempt to access array elements with subscripts below 0 (zero) or above BarCount-1.

So first of all, you should make sure, that your code is protected against producing this error. Forcing AmiBroker to repeat a possibly faulty code is not a solution. Here you can find some possible ways of resolving this issue:

http://www.amibroker.com/guide/errors/10.html

1 Like

Is it possible to see right away which symbol produces this error in Exploration? When I have 300 symbols and this happens to 1, it becomes difficult to find the problem. All I get is the just the Error, but not which symbol causes it.

This is not the most important issue, because as you can read in the explanation of "Subscript out of range Error" - your code should be protected against producing such errors and should work properly no matter if the stock's barcount is 5 or 5K or 5M.

1 Like

It cannot be protected against this unfortunately and it randomly happens to any ticker: Force Backfill from AFL

You need to fix your code. The only way to avoid error 10 is to write proper code. Knowledge Base has article on that:
http://www.amibroker.com/kb/2014/09/22/do-not-make-assumptions-on-number-of-bars/

Hello! Is it possible to "Force Backfill" eSignal with an AFL code or any other way with AFL?

No, you can't because eSignal (and other RT vendors too) terms and conditions specifically disallow doing repeated backfill requests automatically. By their rules such resource consuming actions need to be triggered only manually.

1 Like

This is problematic as sometimes data/bars do not get updated during Exploration which produces Error 10 in my code. Only a manual Force Backfill resolves this...

1 Like

You need to scan once (at the start of the day) with "wait for backfill" option turned ON. That way you won't need to do force backfill at all.

1 Like

This is always turned on and it still happens.

In addition to what Tomasz wrote: If you want to scan live market being connected via plugin, you should start your session from doing a pre scan (or pre exploration) allowing AmiBroker to subscribe all necessary issues (and give some time to download the data). Usually when AmiBroker is downloading lots of data, the plugin Status area changes color and is flashing. When the download/update is finished and everything is OK, it changes color to green.

obraz

You should wait for that before running next scans/explorations. This first scan or exploration usually takes some time, but the following ones should be performed much quicker.

I additionally recommend reading this:

You can also find lots of useful information and tips (regarding this topic) in this article:

How to work with Real-Time data plugins:
https://www.amibroker.com/guide/h_rtsource.html

1 Like

You should cure the disease, not symptoms. The disease is formula error - accessing array elements outside bounds. This has to be fixed first http://www.amibroker.com/kb/2014/09/22/do-not-make-assumptions-on-number-of-bars/

There is another thing that you should check. The fact that you get few bars suggests that your database is not saving PREVIOUSLY backfilled data. In File->Database Settings you must have "local data storage" enabled. This is crucial to have it turned ON.

image

This is always enabled.

If it is enabled, and software is registered so data are stored on disk, then all previously backfilled data (i.e. from PREVIOUS days) are already in the database and there is practically NO chance that you would have "too few bars" because you would always have data from previous days.
If you randomly get errors and randomly lose data then something may be wrong with the computer/harddisk.

Overall the systen is reliable as this error occurs about twice a week of nonstop operation, but it essentially stops everything when it does. I strongly believe it is becase of rare connection issues with eSignal. I cannot automatically do a force backfill nor see which symbol causes the problem and it takes ages to sort through all symbols to find the cause.

You can for example use _TRACE() to learn which symbols were the last ones processed before the exploration hangs. For instance:

_TRACE("Stock: " + Name());

or:

_TRACE("Stock:  " + Name() + "   -   ThreadID:  " + Status("ThreadID"));

... but if the reason of these problems is as you suggest: rare connection issues with eSignal, it doesn't matter which symbols were the last one processed. I won't speculate further, because I have no experience with eSignal.

1 Like

Thanks @Milosz! Tried the Trace method, but this doesn’t help much unfortunately when MultiThreading is used. And it shows the last stock that did not have the error so it leaves me guessing which stock came after that caused the error.