Signal functions are mostly used for generating signals and accessing signal script instances. For performance reasons signals should only be created from the OnInitialize function and never from the OnBarUpdate function or any other frequently called function.


Read more: Signal Scripts


Sections


Functions

Function Details


Functions


Name

Description

SignalRemove(Signal)

Removes a specified signal from memory. Note that calling this function is rarely required since memory is automatically freed when the script shuts down.

Signal SignalSetSymbol(Signal, int)

Copies a specified signal from the OnInitialize parameters and assign it a symbol. The function is required since the signal parameters of Multi-Symbol Trading Strategy scripts do not have an underlying symbol assigned to them.

int SignalSymbolIndex(Signal)

Gets the underlying symbol index of a specified signal.

double SignalValue(Signal, int)

Gets the trading signal generated by a specified signal for a specified bar, which is equivalent to signalIdentifier[barshift]. (-100 Strong Sell to 100 Strong Buy)

int SignalValueCount()

Gets the number of signal values set thus far, or the number of data bars processed thus far.


Function Details


SignalRemove(Signal signal)

Removes a specified signal from memory. Note that calling this function is rarely required since memory is automatically freed when the script shuts down.


Parameters


Type

Identifier

Description

Signal

signal

The signal to remove


Scripts


TradeManagementStrategy, Drawing, Indicator, MultiSymbolTradingStrategy, Pattern, PositionSizing, Signal, TradingStrategy


Signal SignalSetSymbol(Signal signal, int symbolIndex)

Copies a specified signal from the OnInitialize parameters and assign it a symbol. The function is required since the signal parameters of Multi-Symbol Trading Strategy scripts do not have an underlying symbol assigned to them.


Returns


A copy of the specified signal over the specified symbol.


Parameters


Type

Identifier

Description

Signal

signal

The signal to copy

int

symbolIndex

The symbol index to be assigned to the new signal


Scripts


MultiSymbolTradingStrategy


int SignalSymbolIndex(Signal signal)

Gets the underlying symbol index of a specified signal.


Returns


The underlying symbol index of the specified signal.


Parameters


Type

Identifier

Description

Signal

signal

The signal


Scripts


TradeManagementStrategy, Drawing, Indicator, MultiSymbolTradingStrategy, Pattern, PositionSizing, Signal, TradingStrategy


double SignalValue(Signal signal, int barShift)

Gets the trading signal generated by a specified signal for a specified bar, which is equivalent to signalIdentifier[barshift]. (-100 Strong Sell to 100 Strong Buy)


Returns


The trading signal generated by the specified signal for the specified bar. (-100 Strong Sell to 100 Strong Buy)


Parameters


Type

Identifier

Description

Signal

signal

The signal from which to get the trading signal value

int

barShift

The shift relative to the last bar, such that 0 is the latest bar, 1 is the bar preceding it, etc.


Scripts


TradeManagementStrategy, Drawing, Indicator, MultiSymbolTradingStrategy, Pattern, PositionSizing, Signal, TradingStrategy


int SignalValueCount()

Gets the number of signal values set thus far, or the number of data bars processed thus far.


Returns


The number of signal values set thus far, or the number of data bars processed thus far.


Scripts


Signal