Amibroker Data Plugin Source Code Top ((top)) -
// 3. GetQuotesEx: The core data delivery engine __declspec(dllexport) int GetQuotesEx(LPCTSTR ticker, int period, int nSize, struct Quotation *pQuotes, struct RecentInfo *pRecentInfo) // period defines the interval (e.g., daily, 5-minute, tick) // nSize is the maximum number of bars AmiBroker can accept in the current buffer // Example mock data generation loop // In a real plugin, replace this with your API/Database fetch logic int barsToReturn = (nSize > 100) ? 100 : nSize; for (int i = 0; i < barsToReturn; i++) // Populate timestamps (Example: Daily bars stepping backward) pQuotes[i].DateTime = GetAmiBrokerPackedDateTime(i); pQuotes[i].Open = 100.0f + i; pQuotes[i].High = 105.0f + i; pQuotes[i].Low = 95.0f + i; pQuotes[i].Price = 102.0f + i; // Close price pQuotes[i].Volume = 10000.0f; // Return the actual number of bars written to the array return barsToReturn; Use code with caution. Step 3: Managing Workspace and Configuration
Unlike standard software that constantly queries an external database for every chart refresh, AmiBroker caches data in RAM using a specialized array structure. Your plugin must populate these arrays swiftly to prevent UI freezing. Plugin Types: Streaming vs. On-Demand
The data plugin bridges AmiBroker with the OpenAlgo ecosystem, offering:
public: // Mandatory overrides HRESULT __stdcall GetQuotesEx(QuoteRequestEx *pRequest, QuoteEx *pQuote) override; HRESULT __stdcall GetStatic(TickerRequest *pTicker, StaticInfo *pStatic) override; HRESULT __stdcall StartRealTimeUpdate(RealTime rt) override; HRESULT __stdcall StopRealTimeUpdate() override; amibroker data plugin source code top
Find the on GitHub, which is broker-agnostic and supports historical backfilling.
: The primary function for data retrieval. It handles the actual request for price bars (OHLCV) and allows for 64-bit date/time stamps and floating-point volume.
Every DLL plugin must export GetPluginInfo , Init , and Release . These are one‑liners in most cases. Your plugin must populate these arrays swiftly to
If you prefer working with C# or .NET rather than native C++, this open-source SDK allows you to create data plugins more easily.
GetPluginInfo : Returns the plugin name, developer information, version, and type.
. To make it talk to the main program, every plugin must expose three core functions: GetPluginInfo : Tells AmiBroker who you are (your plugin's name and ID). : The primary function for data retrieval
The GetQuotesEx function must return E_PENDING if data isn't ready, not block. Blocking causes AmiBroker’s UI to freeze. The best plugins use overlapped I/O or IOCP (I/O Completion Ports) on Windows.
What (ticks, 1-minute bars, daily) will your data require? Share public link