What could cause GetQuotesEx to return nLastValid -1 after 2nd explore

What could cause amibroker to remove data in database, and return nLastValid = -1 on GetQuotesEx ?

I have a situation for my own plugin, using explore function from analysis page.
This happened only to 1-2 symbols when exploring 1000 symbols.

On first click Explore, when GetQuotesEx show -1,
I have inserted all data into pQuotes,
so the data show on the explore table after that second click to Explore.

On third time click to Explore, the GetQuotesEx show -1 again,
so I have inserted all data into pQuotes again. No data show on table on third click.

On 4th click, the data is shown again on table.
It keep alternating like so.

PLUGINAPI int GetQuotesEx( LPCTSTR pszTicker, int nPeriodicity, int nLastValid, int nSize, struct Quotation *pQuotes, GQEContext *pContext  )

What puzzle me is that if I open stock chart for that symbol, GetQuotesEx never return nLastValid = -1.
How can I prevent amibroker to remove data from data base during Explore click?

I have found that the reason Amibroker return -1 is due to setting in

Preferences > Data >
in memory cache size

may be too small for the explore activities.
It will kill some symbols on the fly without saving into database.

This is only my guess. Is this possible?

nLastValid is an INPUT argument, not output. So it is incorrect to say that it is returned.

What is returned from GetQutoesEx is the value that next to C++ return statement.
You have to RETURN the number of valid quotes from your GetQuotesEx. If your GetQuotesEx returns ZERO, then next time it gets called, the nLastValid INPUT parameter will be -1

And your assumptions regarding "killing" are wrong.

AmiBroker SAVES data to the database when it flushes symbol from in-memory cache.
But it has to be REGISTERED version (purchased).
Unregistered version does NOT save the data.

1 Like

Thank you, for clarification.

Here is what I have found, for Non Registered version by increasing in memory cache size, the symbols will not be gone suddenly as before.

However, for Registered version, there is still 1-2 symbols just simply not saved in database, no mater what cache setting is. It shows when open chart (and open editor), but it will disappear after that.

Just reporting. Many Thanks,

No, that is NOT how it is working. All symbols are saved in registered version.
If they did not, I would hear about it 20 years ago from hundreds of people.