AmiVarFormat : A compact format designed for high-density intraday ticks to save memory bandwidth. Ensure your struct aligns exactly with the definitions in your specific ADK version. Minimize Memory Allocations
AmiBroker calls GetQuotesEx whenever a user opens a chart or runs a backtest. The plugin must populate the Quotes array allocated by AmiBroker.
#include "plugin.h" #include // Metadata Configuration __declspec(dllexport) int GetPluginInfo(struct PluginInfo *info) 0x02; // Flags denoting historical and real-time streaming support info->ID[0] = 'C'; info->ID[1] = 'U'; info->ID[2] = 'S'; info->ID[3] = 'T'; strcpy_s(info->Name, "Custom High-Performance Data Feed"); strcpy_s(info->Vendor, "Algorithmic Developer Network"); return 1; __declspec(dllexport) int Init(void) // Initialize background network connections, API clients, or database sockets here return 1; __declspec(dllexport) int Release(void) // Gracefully disconnect streams and release system resources return 1; Use code with caution. Step 3: Historical Data Retrieval Logic ( GetQuotesEx )
For quantitative traders and system developers, stands as a colossus of performance and flexibility. However, its true power is unlocked only when you connect it to a proprietary or specialized data feed. This is where the AmiBroker Data Plugin becomes the most critical piece of infrastructure in your trading stack.
What do you need (tick-by-tick, 1-minute, daily)? amibroker data plugin source code top
The entry point is a C/C++ DLL that exports specific functions AmiBroker calls during initialization. Here is the canonical structure of a high-performance plugin:
sscanf(line, "%f,%f,%f,%f,%f", open, high, low, close, volume); fclose(file); return 1;
// Read data from a file FILE* file = fopen("data.csv", "r"); if (file == NULL) return 0;
When a market tick arrives, the background thread parses the price data and pushes it into an internal circular queue. AmiVarFormat : A compact format designed for high-density
#include "Plugin.h" #include #include #include // Global Plugin Configuration const int PLUGIN_ID = 0x544F5031; // "TOP1" unique identifier std::mutex g_dataMutex; extern "C" __declspec(dllexport) int GetPluginInfo(struct PluginInfo* pInfo) if (pInfo->Size < sizeof(struct PluginInfo)) return 0; pInfo->Type = 1; // Data plugin type pInfo->Version = 10100; // Version 1.1.0 pInfo->ID = PLUGIN_ID; strcpy_s(pInfo->Name, "Top Performance Data Provider"); strcpy_s(pInfo->Vendor, "Algorithmic Trading Solutions"); pInfo->CertCode = 0; // Standard non-certified plugin code return 1; extern "C" __declspec(dllexport) int Init(void) // Initialize network stacks, threads, and internal caching systems return PLUGIN_STATUS_OK; extern "C" __declspec(dllexport) int Release(void) // Gracefully shut down background threads and close network handles return PLUGIN_STATUS_OK; extern "C" __declspec(dllexport) int GetPluginConfig(int Reason, void* pData) // Bitmask flags defining plugin capabilities // 1 = Supports real-time streaming, 2 = Supports historical backfill switch (Reason) case 1: // Capability Check return 1 Use code with caution. The Data Ingestion Engine ( GetQuotesEx )
The Quotation structure represents a single data point (a bar or a tick) in the time-series array.
AmiBroker data plugins are native Win32 dynamic-link libraries (DLLs) written in C/C++ or wrapped via .NET interop. They act as a translator, converting structural JSON, Protocol Buffers, or CSV feeds from an external API into binary memory structures that AmiBroker natively understands.
#include <Amibroker/Plugin.h>
struct Quotation DATE DateTime; float Price; float Open; float High; float Low; float Volume; float OpenInterest; ; Use code with caution.
Building a Custom AmiBroker Data Plugin: A Guide to Creating Your Own High-Performance Data Source
This function tells AmiBroker what your plugin is, who made it, and its capabilities.
Finally, when developing a trading interface alongside a data plugin, the two must be kept separate. It is strongly recommended to follow the design of the open-source IBController, which provides a clear separation between these concerns. The plugin must populate the Quotes array allocated