Trevor Harnett
posted this on February 23, 2010 13:58
The MarketDelta Software Developer's Kit (SDK) is a toolkit for developing plug-in technical indicators and trading signals for use in MarketDelta. Plug-ins are written in either the C or C++ programming language. Plug-ins are implemented as "Dynamic Link Libraries" (DLL's). The SDK includes a manual and sample code for a plug-in that calculates two moving average lines and generates signals where the two moving average lines intersect.
The SDK is available at no additional charge but only to licensed users of MarketDelta. MarketDelta will provide developer support by email or telephone (if necessary) on a fee basis of $150/hr. To receive the SDK request our SDK Non-Disclosure Agreement by emailing ps [at] marketdelta.com or calling 1.312.922.7800. Once completed and approved the SDK will be emailed to you.
More About Plug-In Indicators
A MarketDelta "plug-in" is a computer program for calculating a technical indicator or trading signal. Plug-ins are not built into MarketDelta directly. Plug-ins can be developed externally by users having the requisite computer programming skills or by third party software vendors wishing to market proprietary technical indicators and/or trading signals to MarketDelta users.
Typically, plug-ins are written in either the C or C++ programming language. Plug-ins are implemented as "Dynamic Link Libraries" (DLL's). These DLL files are placed into the "plugins" folder located inside the MarketDelta startup folder. At startup, MarketDelta inspects the plugins folder and creates a list of the DLL's located there. Just like any of the built-in indicators, each plug-in becomes available for use in MarketDelta.
Plugins are supported in all versions of the software, however, if a plugin requires calculations from an indicator that requires a specific edition of the software, then that edition would be required to run the plugin. Ex. If a plugin indicator was developed as a DLL that required the Profile Indicator as a means of calculation, then a user would need to license an edition of the software that had that indicator enabled.
Programmers interested in developing plug-in indicators for use in MarketDelta may acquire the "MarketDelta Software Developer's Kit (SDK)". The MarketDelta SDK contains complete instructions for developing plug-ins, along with sample code. Interested parties must execute a non-disclosure agreement (NDA). The NDA is attached to this article on the right side bar. Download, complete, and fax back. The SDK is available at no additional charge but only to licensed users of MarketDelta. MarketDelta will provide developer support by email or telephone (if necessary) on a fee basis of $150/hr. More details are here under the Professional services section.
Using Plug-In Indicators
To demonstrate how these indicators are implemented, we will use MarketDelta's sample plug-in called "IRTSAMPLE".
Windows users: In the "plugins" directory, locate the file called IRTSAMPLE.DLL. This file contains the programming for this simple indicator (IRTSAMPLE computes two simple moving averages of user-specified periods and produces a signal for each bar where the two moving averages crossover on another.).
Go to Setup: Preferences: Charts: Technical Indicators. From the list of indicators, select "Plug-in Indicator” and view the settings. A list of available plug-ins is shown at the top. Select "IRTSAMPLE" from the list and the description of the plug-in will appear in the scrollable text box. This text is supplied to MarketDelta by the plug-in itself. It is used to convey a description of what the plug-in does and how to enter any required user parameters. The Parameters entry box accepts up to 80 characters of arbitrary text that is made available to the plug-in for the purpose of setting preferences for the indicator.
In this simple example, IRTSAMPLE expects the user to enter two numbers into the parameter box indicating the desired periods of the simple moving averages.
A plug-in indicator can be drawn as a continuous line, a connected line or as a solid/hollow histogram. Signals computed by a plug-in appear on the chart as “markers” showing each bar where the signal is true. A color control allows specification of the line or histogram color properties. If the plug-in requests it, two optional reference line checkboxes are provided, similar to the setup for MarketDelta custom indicators. In this example the plug-in does not require reference lines.
Adding a Plug-In Indicator to a Chart
To add a plug-in indicator to the current chart window, click the "Add Technical Indicator" button on the chart's toolbar and select "Plug-in Indicator". Choose IRTSAMPLE from the list and enter the desired period into the parameter box. By default, all plug-in indicators are graphed in a new pane. To overlay the indicator on the instrument data, select the pane before adding the indicator, or simply drag and drop the indicator later. Press OK and the plug-in will be added to the chart. The Plug-in settings are edited in the same way as any indicator. To access the settings, right-click on the line, change the parameters and click OK.
Using Plug-In Indicators in Scans, Signals, or Custom Indicators
Any plug-in indicator can be used as a token in the RTL language. In the setup window for scans, signals or custom indicators, select "PLUGIN" from the list of available tokens. The setup for the Plug-in Indicator will appear. Choose the IRTSAMPLE plug-in, set the period parameters and press OK. In the list of token on the right, a token called PLUGIN will appear. You can rename the token, e.g., call it SMA for "simple moving average". When using several plug-in indicators within the same scan, signal or custom indicator, you must give each one a unique token name to be able to reference each plug-in in your formula. When a plug-in calculates more than one array results as in this example, the scan setup window for the plug-in has a menu button with which to specify which of the array results to reference. If you wish to reference just the signal array for example, you would specify array3 since array1 and array2 represent the two simple moving average. If you have a plug-in that calculates multiple arrays and you wish to reference more than one of the resulting arrays, you will have to add the PLUGIN indicator two (or more) times to the scan, specifying a different array for each instance and specifying a unique name for each plug-in token to you can reference them unambiguously in the scan formula.
Plugins are essentially single entry point DLL's written in C or C++. They are passed an array bar date and can return up to 4 result arrays. A result array can be plotted as a line or signal. The DLL can call or do anything with the Windows API, so there are no limits.
Plug-in indicators have exactly the same functionality as built-in indicators. The only difference is that the computation is programmed externally and "linked" into the MarketDelta system using the plug-in mechanism.
Using Plug-ins in Custom Columns
Plug-in indicators can be used as the source for custom columns in quote pages. By setting up the custom column as the technical indicator "Plug-in Indicator", the indicator can be referenced directly. You can also create custom columns that reference the results of scans and/or custom indicators using the plug-in's capabilities.
Securing Your Plugins
An SDK developer of proprietary plugin indicators can deliver his plugins to customers stamped uniquely with a 30 character code to uniquely deliver the DLL(s) to a specific customer. This code is unique to each subscriber and found in the User Profile. This can be accessed by clicking Control | System Status. The customer will supply the SDK Plugin vendor with his 30 character code and the vendor in turn will send the DLL to the customer stamped with that unique id. At run time, Marketdelta will supply the 30 character code for the customer via the SDK so that DLL can know who (anonymously) is running the software. The SDK developer could also do an http to his own web site to validate that his indicator(s) are OK for this unique user identification ID.
Comments
If using version 10.0 or higher of the SDK, creating a Visual Studio project on the Win 7 64 bit platform is done as follows: (in this example we are using VS 2008, earlier versions may differs but the steps will be similar)
1. File | New | Project
2. In the New Project window, under Project Types: in the Visual C++ section, select “Win32” (plugins must be built as 32-bit DLLs)
3. In the New Project window, under Templates: choose “Win32 Project”
4. Provide a name and location for the solution and click OK. The Win32 Application Wizard will appear
5. Click on “Application Settings”
6. Select “DLL” as the Application type; checkmark “Empty Project”.
7. This will create a solution with one project and with no file content.
8. Add irtsdk.h to the header files for the new project.
9. Add irtsdk.c and irtsample.cpp to the source files for the project
It is recommend setting up the project to build the DLL directly to the \Users\username\MarketDelta\Plugins\ folder.
Build the solution then start Marketdelta and add the Plugin Indicator to a chart to see it work.
On Windows 7, user plugins are not accessed from the Program Files directory. The sample plugin, irtsample.dll, is installed there to make it available to you, but when Marketdelta runs, it expects to find all plugin dlls in the *local* working directory’s plugins folder, not Program Files. The reason for this is that the UAC restrictions in Windows Vista and Windows 7 require administrative approval to update files within the Program Files directory. To see the irtsample plugin in action, copy the dll
Copy From: C:\Program Files\Mktdelta\Plugins\irtsample.dll
Copy To: C:\Users\yourUserName\Marketdelta\Plugins\irtsample.dll
We refer to the C:\Users\yourUserName\Marketdelta\ folder as your “Local Working Directory”. You have read and write permissions to this folder so as you use the SDK to build your own plugins you can build your dlls directly into the Plugins folder inside this local working directory. This is far more convenient than having fight UAC for permission to copy files into the C:\Program Files\mktdelta directory.
If your Marketdelta local working directory folder does not contain a Plugins directory, just create one. Once the irtsample.dll is in place, open a chart and add a Plugin Indicator to any chart, where irtsample is the selected plugin name.
The irtsample plugin calculates two moving average lines and 1 signal line. The signal line marks each bar where the two moving averages cross over. Two numbers, provided as textual parameters to the plugin in the setup dialog, are used as the moving average periods.