Extension Signals and Sinks

Extension objects can register interest in certain alerts and other events that may be generated by a chart (or portfolio) that are not directly related to an Equilla script evaluation. These signals are broken down into four main categories that can be independently hooked by the extension object: Equilla script alerts, tool alerts, strategy events and instrument events.

To register interest in a specific class of signals, the extension object must implements a Sink interface of the corresponding type:
interface IScriptSignal
{
    void ScriptSignalRaised( IScriptSignal Signal, bool MoreToFollow );
}
interface IStrategySignalSink
{
    void StrategySignalRaised( IStrategySignal Signal, bool MoreToFollow );
}
interface IToolSignalSink
{
    void ToolSignalRaised( IToolSignal Signal, bool MoreToFollow );
}
In each of the above cases, the implemented method will be called when a signal is raised, containing an interface to an object the contains details of that signal (see below), the MoreToFollow flag will indicate if more signals are pending, so that the signals may be queued and processed in a batch when MoreToFollow is set to false (this is of special importance with strategy orders).
interface ISymbolStateChangedSink
{
    SymbolStateChanged( string Symbol, string DisplayName, bool Active );
}
Implementation of the ISymbolStateChangedSink allows an extension object to respond when instruments transition from an active to an inactive state (inactive can mean the instrument is stale, or that the data connection has been lost).

IScriptSignal

Contains details about an Equilla alert that has occurred as the result of calling the Equilla Alert() function, or clicking on a chart hyperlink generated by DrawText() using the signal protocol.

Please refer to the sample project RSSExtension and the corresponding indicator RSS for how to hook and generate script alerts.
interface IScriptSignal
{
    string SourcePath { get; } // Unique workspace location of the event source
    string DisplaySource { get; } // User visible location of the event source
    string ScriptName { get; } // Name of the script that generated the event
    string SignalName { get; } // Name of the event
    string AlertText { get; } // Test specified in the Alert() function
    string ParentSymbolName { get; } // Symbol of the script parent instrument
    DateTime BarTimestamp { get; } // Chart timestamp of the bar on which the alert was generated
    double BarPrice { get; } // Parent instrument price when the alert was generated
    DateTime TimestampUTC { get; } // UTC Timestamp of the signal
    string ParentDisplayName { get; } // Display name of the script parent instrument
}
A simple way to generate an alert would be to use the following Equilla code:
If IsLastBar Then
    Alert( "It is the last bar: " + CStr( CurrentBar ) );
To generate script alerts from a user clicking on a hyperlink in the chart, do the following:
If IsLastBar Then
    DrawText( High, "LinkTest", "Click 4 Alert", Default, Default, AlignTop,
        "signal:It is the last bar: " + CStr( CurrentBar ) );

IStrategySignal

Contains details about a strategy event that has occurred. Strategy events are generated when a chart is running Equilla strategies that use the Buy, Sell, Short, Cover and ExitPosition functions to build and backtest a trading system.

Please refer to the sample project ExcelOrderTracker and the corresponding indicator OrderTracker for how to hook generated strategy alerts.
interface IStrategySignal
{
    EStrategySignalType SignalType { get; } // See below
    string SourcePath { get; } // Unique workspace location of the event source
    string DisplaySource { get; } // User visible location of the event source
    string ScriptName { get; } // Name of the script that generated the event
    string SignalName { get; } // Name of the event
    string OrderId { get; } // Unique ID of the order to which the event belongs (placed, filled, etc.)
    EStrategySignalOrderType OrderType { get; } // See below
    double OrderPrice { get; } // Price of the order (valid for limit and stop orders)
    double OrderQuantity { get; } // Size of the order
    string ParentSymbolName { get; } // Symbol of the traded security
    DateTime BarTimestamp { get; } // Chart timestamp on which the order occurred
    double BarPrice { get; } // Chart price at which the order occurred
    DateTime TimestampUTC { get; } // UTC timestamp of the order
    string RelatedOrders { get; } // XML list of orders that will be generated if this order is filled
    string ParentDisplayName { get; } // Display name of the traded security
}

enum EStrategySignalType
{
    eqSignalTypeLongEntryPlaced,
    eqSignalTypeLongExitPlaced,
    eqSignalTypeShortEntryPlaced,
    eqSignalTypeShortExitPlaced,
    eqSignalTypeOrderCancelled,
    eqSignalTypeOrderFilled,
    eqSignalTypeOrderModified,
    eqSignalTypeOrderModifiedTrailing,
}

enum EStrategySignalOrderType
{
    eqSignalTypeMarketLongEntry,
    eqSignalTypeMarketLongExit,
    eqSignalTypeMarketShortEntry,
    eqSignalTypeMarketShortExit,
    eqSignalTypeStopLongEntry,
    eqSignalTypeStopLongExit,
    eqSignalTypeStopShortEntry,
    eqSignalTypeStopShortExit,
    eqSignalTypeLimitLongEntry,
    eqSignalTypeLimitLongExit,
    eqSignalTypeLimitShortEntry,
    eqSignalTypeLimitShortExit
}

IToolSignal

Contains details about a tool alert that has occurred.
interface IToolSignal
{
    EToolSignalType SignalType { get; } // See below
    string SourcePath { get; } // Unique workspace location of the event source
    string DisplaySource { get; } // User visible location of the event source
    string ScriptName { get; } // Name of the script that generated the event
    string SignalName { get; } // Signal text associated with the tool
    string ParentSymbolName { get; } // Symbol of the script parent instrument
    DateTime BarTimestamp { get; } // Chart timestamp of the bar on which the alert was generated
    double BarPrice { get; } // Parent instrument price when the alert was generated
    EToolSignalToolType ToolType { get; } // See below
    EToolSignalLine Line { get; } // See below
    EToolSignalPriceDirection PriceDirection { get; } // See below
    string ToolText { get; } // Text associated with the tool
    DateTime TimestampUTC { get; } // UTC Timestamp of the signal
    string ParentDisplayName { get; } // Display name of the script parent instrument
}

enum EToolSignalType
{
    eqSignalTypeCrossed,
    eqSignalTypeBreakIn,
    eqSignalTypeBreakOut,
}

enum EToolSignalLine
{
    eqToolLine,
    eqToolUpperLine,
    eqToolMiddleLine,
    eqToolLowerLine,
    eqToolLineChannel,
    eqToolLineFibo1,
    eqToolLineFibo2,
    eqToolLineFibo3,
    eqToolLineFibo4,
    eqToolLineFibo5,
    eqToolLineFibo6,
    eqToolLineFibo7,
    eqToolLineFibo8,
    eqToolLineFibo9,
    eqToolLineFibo10,
    eqToolLineFibo11,
    eqToolLineFibo12,
    eqToolLineFibo13,
    eqToolLineFibo14,
    eqToolLineFibo15,
    eqToolLineFibo16,
};

enum EToolSignalToolType
{
    eqToolTypeTrendLine,
    eqToolTypeFiboRetracement,
    eqToolTypeStopLine,
    eqToolTypeTrendChannel,
    eqToolTypePitchfork,
    eqToolTypeRegressionChannel,
};

enum EToolSignalPriceDirection
{
    eqDirectionUpwards,
    eqDirectionDownwards,
    eqDirectionSideways,
};