How an external program to notified Amibroker to cal GetQuoteEx?

My Data Plugin read from a sqlite file which updated by a external program. Is there any way that the external program send a broadcast windows message to notified about updated data?

It is all documented in great detail with workflow charts on GitLab ADK page

1 Like

putting 2 sentences together,

If you mean:
How can the External program send a message to "notify" AB that there is new data and that it should call GetQuoteEx() in your data plugin so that plugin fetches the data from sqlite.

Short answer: there is no way to guarantee it, because if Symbol is not in any useful context, GetQuotesEx() will not be called.

What you can do is,

  1. Create either Batch file with Analysis like Exploration and call AB /runbatch from "external program"
    full_AB_path\Broker.exe" /runbatch "full_batch_path\UpdateDB.abb"

  2. use OLE from external program to run .APX
    NewA = AB.AnalysisDocs.Open( "C:\\analysis1.apx" );

  3. use OLE to select a particular Analysis window that's open an run it
    NewA = oAB.AnalysisDocs.Item(0);

The other view:
If you already have a batch or Analysis running, then you don't need to do any of the above because AB will at that frequency anyway call GetQuotesEX()
In GetQuotesEX() you pull the data,
and this is where ADK 3.4.1 shows you whether you will "block and fetch" OR "fetch asynchronously" and then store it in plugin to update on next call

The bottom line is that you need to have those symbols "active" in a particular context and they could also be active as open Charts too.

AmiBroker Object Model
Using a batch to start Shell_execute, which run batch every 1 minute - AFL Programming - AmiBroker Community Forum
Command Line Parameters - AFL Programming - AmiBroker Community Forum

No, I already gave the solution. Solution is documented in the ADK and in short plugin should send WM_USER_STREAMING_UPDATE
message when it has new data.

You guys need to understand one thing:

It is NOT the plugin that controls AmiBroker.

AmiBroker KNOWS WHAT IT NEEDS and would call GetQuotesEx when it is really needed. Plugin can notify that it has new data and that's it.

As I wrote before:

The whole sequence of interactions between AmiBroker and plugin is DOCUMENTED IN ADK in point #3.4.1

Note that those diagrams are NEW ADDITION and even if somebody read ADK a couple of months ago, his/her knowledge is outdated. So it is important to read the docs as they are presented now.

3 Likes

You are right, and also about WM_USER_STREAMING_UPDATE.

my interpretation of his question is he wants to send to AB but looks like his plugin is not bidirectional or actively connected.
Like in my websocket, I have active bidirectional open comm. So it speaks to server and "asks", when data comes plugin knows and send WM_USER_STREAMING_UPDATE

The technical way is as per docs, my interpretation is like a hack/workaround.
Not all can code like you :stuck_out_tongue:

1 Like

my plugin already sends WM_USER_STREAMING_UPDATE periodically to notify AB to call GetQuoteEx. But instead, I want my external program to notify AB about data updated after writing down data to SQLIte file. I am think of openning websocket from the plugin to the program but it will be the last choice.

you should always provide all info upfront.
Thats a hacky way I suggested which will surely work if you want a quick fix.

If you want a proper design, then you should follow technical documentation in ADK.
There are various IPC mechanisms, you can implement a suitable one.

My project is not yet ready for a closed beta, but you can keep a watch.

It is your plugin that should know when you write your database. It can do periodical check for timestamp field in your DB.