Disable or programmatically flush in-memory cache?


I am reading price data from text files using a custom dll similar to the ASCII example from the ADK. I use a separate application to apply price adjustments and filtering, and construct the data file.

The AmiBroker in-memory cache prevents updated data files from being loaded if a symbol has already been viewed. I need to manually flush the cache using the Database Settings window to force a reload each time I update my files.

I see that I can reduce the number of cached symbols and cache memory using Preferences->Data, but have found no way to turn it off completely. AmiBroker does not allow the max number of symbols to be zero.

I’m looking for a way to either disable the in-memory cache or programmatically flush it when the data files change.

Does anyone know of a way to do this?

Thanks in advance!

I don’t know if it’s going to work in your case (maybe not), but you can try adding at the top of your formula:

#pragma nocache

I quote:

#pragma nocache causes that #included files are not cached so they are re-read with every execution


1 Like

No, AmiBroker does not prevent updated data from being loaded.

You just did not tell AmiBroker that you have new data inside your plugin.

To tell AmiBroker that you have new data you need to send a message to AmiBroker (WM_USER_STREAMING_UPDATE) as shown in QuoteTracker example sources,

// this tells AmIBroker that you have fresh data for given Ticker
::SendMessage( g_hAmiBrokerWnd, WM_USER_STREAMING_UPDATE, (WPRAM) Ticker, (LPARAM) &recentInfoStructureForGivenTicker );

If you just make AmIBroker aware that you have new data, it will call GetQuotesEx once again and you will get opportunity to fill the array with your updated quotes.

1 Like

Thank you Tomasz. I didn’t consider treating this as a real-time data source.


I have a similar query. Suppose I have two charts opened let us say A & B. Now suppose I get a quote for B, is it possible to intimate Amibroker that data for B has arrived and it can call GetQuotesEx to receive new data. I know it is possible to call WM_USER_STREAMING_UPDATE, but that tries to refresh ALL open charts when WPARAM & LPARAM are 0.

The QuoteTracker sample code is passing 0 values for both WPARAM & LPARAM.

Please explain how to use WPARAM & LPARAM.

1 Like

I answered already in post marked as "Solution" above. If you don't know what WPARAM and LPARAM are, you need to start with reading beginner book on Windows API or use Google to find out.
Really, Google search is your knowledge base: https://www.google.com/search?q=what+is+wparam
Also look into supplied example source code in ADK. Everything is there already. Ticker is a string (char *) and the other parameter is RecentInfo struct documented in ADK.

1 Like