Download - Tradesignal

Transcript
::
www.tradesignal.com
HOW TO WRITE AN EQUILLA EXTENSION IN MICROSOFT VISUAL C++ 2005
The Equilla Extension API is described in the EquillaApi.h file, which is located in the Include sub
sub--directory of your Tradesignal
installation. In order to create Equilla Extension libraries you have to add the directory to the Include files directory of Visual Studio
under Tools > Options > Projects and Solutions > VC++ Directories.
Follow these steps to create a sample project:
l
1.
2.
3.
4.
5.
l
Create a new Visual C++ DLL project
File > New > Project... > Visual C++ > Win32 Console Application
Type a name for the new project for example "MyEquillaExtension"
Press OK
Select the Application Settings and set the Application type to DLL
Press Finish
Include the Equilla interface description and dependencies by adding the following lines to the top of the
MyEquillaExtension.cpp file, below the #include "stdafx.h" line:
#include <wtypes.h> #include <oleauto.h> #include <EquillaApi.h> l
Add the following function to the bottom of the MyEquillaExtension.cpp file:
Note: All Equilla Extension functions must be declared with the following function prototype.
EQUILLA_API int MyMovingAverage( DWORD scriptID, int argc, EqVariable* variables[], VARIANT* result ) { // check that the number of parameters passed to this function is two (Price and Period) if (argc != 2) return EQUILLA_ARGUMENT_ERROR; // extract the period value from the second parameter VARIANT vPeriod; VariantInit(&vPeriod); variables[1]­>GetValue(&vPeriod); // read the latest value from the variable // ensure the period parameter is valid if (V_I4(&vPeriod) < 1) return EQUILLA_ARGUMENT_ERROR; // calculate the sum of all prices for the given period double sum = 0.0; VARIANT vPrice; VariantInit(&vPrice); for (int index = 0; index < V_I4(&vPeriod); ++index) Tradesignal GmbH
Page 395
Version 7.0