Extension Supported Parameter Types

Extension objects must declare an interface that may only contain methods (no properties or events). These methods may only accept as parameters the types listed below, and only as input. The methods may only return a value that is one of the simple types with the exception of object. A method may also have a return type of void - to return nothing at all.

Simple types

bool (IDL: VARIANT_BOOL)
int (IDL: long)
double (IDL: double)
string (IDL: BSTR)
DateTime (IDL: DATE)
object (IDL: VARIANT)
The object type should only be used when a function accepts different types for a specific parameter. The actual type of these parameters may change from call to call and can be of any of the supported types including extension objects (IEquillaExtension). Determining the actual type present is therefore a task for the extension object author. The object type is not the same as a parameter that accepts an extension object which should use the IEquillaExtension type (see below).

Extension Object types

Any object that implements the IEquillaExtension interface can be passed to a method that has an IEquillaExtension parameter.

Series types

Accepting a series type as input allows the extension object to access historic values of the parameter. There is no length value associated with the series types because the BackBuffer of the Equilla Script will be determined by how much historic data is accessed by the script and any extension objects. So for example if a script only needs 14 bars of data to process, this value should be provided to the extension object to ensure it does not blindly access historic data on a series variable and artificially elongate the BackBuffer (which could lead to severe performance problems).

In each of the below interfaces a single method exists, that when called will return the value at the supplied offset in the series variable. An offset of zero (0) implies the current value, one (1) the prior value and so on.
interface IDateTimeSeries
{
    DateTime GetDate( int Offset );
}

interface IDoubleSeries
{
    double GetValue( int Offset );
}

interface IIntegerSeries
{
    int GetValue( int Offset );
}

interface IStringSeries
{
    string GetValue( int Offset );
}

interface IBooleanSeries
{
    bool GetValue( int Offset );
}

interface IVariantSeries
{
    object GetValue( int Offset );
}
The IVariantSeries should only be used when a variable can contain a mixture of the other basic types (which is never a good thing to do). Determining the actual type present is therefore a task for the extension object author.

Array types

Array types accept as input Equilla Arrays (declared using the Array: block in an Equilla script). The extension API provides dedicated support for one- and two-dimensional arrays, and a generic version for n-dimensional arrays.

For each basic type supported by an array there is a corresponding series type with the same behavior as described for series types above. Array interfaces have a method to access a value at a given index (and offset in the case of series) and a property for determining the maximum index possible. Arrays are zero-based.

Arrays that hold Variant types should only be used when a variable can contain a mixture of the other basic types (which is never a good thing to do). Determining the actual type present is therefore a task for the extension object author.

One-dimensional arrays

interface IDateTimeArray
{
    DateTime GetDate(int Index);
    int MaxIndex { get; }
}

interface IDateTimeArraySeries
{
    DateTime GetDate(int Offset, int Index);
    int MaxIndex { get; }
}

interface IDoubleArray
{
    double GetValue(int Index);
    int MaxIndex { get; }
}

interface IDoubleArraySeries
{
    double GetValue(int Offset, int Index);
    int MaxIndex { get; }
}

interface IIntegerArray
{
    int GetValue(int Index);
    int MaxIndex { get; }
}

interface IIntegerArraySeries
{
    int GetValue(int Offset, int Index);
    int MaxIndex { get; }
}

interface IStringArray
{
    string GetValue(int Index);
    int MaxIndex { get; }
}

interface IStringArraySeries
{
    string GetValue(int Offset, int Index);
    int MaxIndex { get; }
}

interface IBooleanArray
{
    bool GetValue(int Index);
    int MaxIndex { get; }
}

interface IBooleanArraySeries
{
    bool GetValue(int Offset, int Index);
    int MaxIndex { get; }
}

interface IVariantArray
{
    object GetValue(int Index);
    int MaxIndex { get; }
}

interface IVariantArraySeries
{
    object GetValue(int Offset, int Index);
    int MaxIndex { get; }
}

Two-dimensional arrays

interface IDateTimeArray2D
{
    DateTime GetDate(int Row, int Column);
    int GetMaxIndexOfDimension(int Dimension);
}

interface IDateTimeArray2DSeries
{
    DateTime GetDate(int Offset, int Row, int Column);
    int GetMaxIndexOfDimension(int Dimension);
}

interface IDoubleArray2D
{
    double GetValue(int Row, int Column);
    int GetMaxIndexOfDimension(int Dimension);
}

interface IDoubleArray2DSeries
{
    double GetValue(int Offset, int Row, int Column);
    int GetMaxIndexOfDimension(int Dimension);
}

interface IIntegerArray2D
{
    int GetValue(int Row, int Column);
    int GetMaxIndexOfDimension(int Dimension);
}

interface IIntegerArray2DSeries
{
    int GetValue(int Offset, int Row, int Column);
    int GetMaxIndexOfDimension(int Dimension);
}

interface IStringArray2D
{
    string GetValue(int Row, int Column);
    int GetMaxIndexOfDimension(int Dimension);
}

interface IStringArray2DSeries
{
    string GetValue(int Offset, int Row, int Column);
    int GetMaxIndexOfDimension(int Dimension);
}

interface IBooleanArray2D
{
    bool GetValue(int Row, int Column);
    int GetMaxIndexOfDimension(int Dimension);
}

interface IBooleanArray2DSeries
{
    bool GetValue(int Offset, int Row, int Column);
    int GetMaxIndexOfDimension(int Dimension);
}

interface IVariantArray2D
{
    object GetValue(int Row, int Column);
    int GetMaxIndexOfDimension(int Dimension);
}

interface IVariantArray2DSeries
{
    object GetValue(int Offset, int Row, int Column);
    int GetMaxIndexOfDimension(int Dimension);
}

N-dimensional arrays

interface IDateTimeArrayND
{
    DateTime GetDate(int[] Indices);
    int GetMaxIndexOfDimension(int Dimension);
    int Dimensions { get; }
}

interface IDateTimeArrayNDSeries
{
    DateTime GetDate(int Offset, int[] Indices);
    int GetMaxIndexOfDimension(int Dimension);
    int Dimensions { get; }
}

interface IDoubleArrayND
{
    double GetValue(int[] Indices);
    int GetMaxIndexOfDimension(int Dimension);
    int Dimensions { get; }
}

interface IDoubleArrayNDSeries
{
    double GetValue(int Offset, int[] Indices);
    int GetMaxIndexOfDimension(int Dimension);
    int Dimensions { get; }
}

interface IIntegerArrayND
{
    int GetValue(int[] Indices);
    int GetMaxIndexOfDimension(int Dimension);
    int Dimensions { get; }
}

interface IIntegerArrayNDSeries
{
    int GetValue(int Offset, int[] Indices);
    int GetMaxIndexOfDimension(int Dimension);
    int Dimensions { get; }
}

interface IStringArrayND
{
    string GetValue(int[] Indices);
    int GetMaxIndexOfDimension(int Dimension);
    int Dimensions { get; }
}

interface IStringArrayNDSeries
{
    string GetValue(int Offset, int[] Indices);
    int GetMaxIndexOfDimension(int Dimension);
    int Dimensions { get; }
}

interface IBooleanArrayND
{
    bool GetValue(int[] Indices);
    int GetMaxIndexOfDimension(int Dimension);
    int Dimensions { get; }
}

interface IBooleanArrayNDSeries
{
    bool GetValue(int Offset, int[] Indices);
    int GetMaxIndexOfDimension(int Dimension);
    int Dimensions { get; }
}

interface IVariantArrayND
{
    object GetValue(int[] Indices);
    int GetMaxIndexOfDimension(int Dimension);
    int Dimensions { get; }
}

interface IVariantArrayNDSeries
{
    object GetValue(int Offset, int[] Indices);
    int GetMaxIndexOfDimension(int Dimension);
    int Dimensions { get; }
}

Example: Passing an array to an extension DLL

C# interface and code for the extension DLL (all other series and array types are used in much the same way):
public interface ISoundAverage
{
    [Description("Asynchronously plays the .WAV files specified by the array of file names")]
    void PlaySounds(IStringArray paths);
}

[ProgId("SoundAverage.Class1")]
public class Class1 : ISoundAverage, EquillaExtension.IEquillaExtension
{
    void ISoundAverage.PlaySounds(IStringArray paths)
    {
        for(int i = 1; i < paths.MaxIndex; ++i)
        {
            System.Media.SoundPlayer player = new System.Media.SoundPlayer(paths.GetValue(i));
            player.Play();
        }
    }

    void EquillaExtension.IEquillaExtension.Attach(EquillaExtension.IEquillaHost Host)
    {
    }

    void EquillaExtension.IEquillaExtension.Detach()
    {
    }
}
Usage from Equilla:
Inputs:
    Price( Close ),
    Length( 14, 1 );


Array:
    pathArray[]();


Object:
    soundAverage( "SoundAverage.Class1" );


If CurrentBar = 1 Then
    FillArray( pathArray, "c:\file1.wav", "c:\file2.wav" );

If Price Crosses Over Average( Price, Length ) Then
    soundAverage.PlaySound( paths );