Broker functions are mostly used for creating, modifying and cancelling orders. The platform can generate and backtest a wide selection of standard and advanced order types, but those must actually be supported by your broker in order to be traded live. 


Sections


Functions

Function Details


Functions


Name

Description

BrokerAllowDuplicateOrders(bool)

Specifies whether duplicate orders should be processed or cancelled (the default is 'false', i.e. duplicate orders are cancelled). Duplicate orders are orders that share the same symbol, action type and order type. Call the function once from OnInitialize.

BrokerCancelOrder(int, string)

Submits a cancel order request, of a specified pending order, to the broker. The order will be cancelled if possible.

BrokerCancelOrder(int, int, string)

Submits a cancel order request, of a specified pending order, to the broker. The order will be cancelled if possible.

BrokerCloseAllPositions(string)

Submits market orders that will close all of the open positions of all of the symbols.

BrokerCloseAllPositions(int, string)

Submits market orders that will close all of the open positions of all of the symbols.

BrokerClosePosition(string)

Submits a market order that will close the open position of the underlying symbol, if such a position exists.

BrokerClosePosition(int, int, string)

Submits a market order that will close a specified position.

int BrokerDiscretionary(C_ActionType, double, C_TIF, double, double, string)

Submits a specified discretionary order to the broker.

int BrokerDiscretionary(int, int, C_ActionType, double, C_TIF, double, double, string)

Submits a specified discretionary order to the broker.

int BrokerIceberg(C_ActionType, double, double, C_TIF, double, string)

Submits a specified iceberg order to the broker. Iceberg orders display a specified part of their quantity, while hiding the rest.

int BrokerIceberg(int, int, C_ActionType, double, double, C_TIF, double, string)

Submits a specified iceberg order to the broker. Iceberg orders display a specified part of their quantity, while hiding the rest.

int BrokerLimit(C_ActionType, double, C_TIF, double, string)

Submits a specified limit order to the broker. Limit orders are executed only at the specified limit price or better.

int BrokerLimit(int, int, C_ActionType, double, C_TIF, double, string)

Submits a specified limit order to the broker. Limit orders are executed only at the specified limit price or better.

int BrokerLimitIfTouched(C_ActionType, double, C_TIF, double, double, string)

Submits a specified limit-if-touched order to the broker.

int BrokerLimitIfTouched(int, int, C_ActionType, double, C_TIF, double, double, string)

Submits a specified limit-if-touched order to the broker.

int BrokerLimitOnClose(C_ActionType, double, C_TIF, double, string)

Submits a specified limit-on-close order to the broker. Limit-on-close orders are executed only at the market close at the specified limit price or better, and cancelled otherwise.

int BrokerLimitOnClose(int, int, C_ActionType, double, C_TIF, double, string)

Submits a specified limit-on-close order to the broker. Limit-on-close orders are executed only at the market close at the specified limit price or better, and cancelled otherwise.

int BrokerLimitOnOpen(C_ActionType, double, C_TIF, double, string)

Submits a specified limit-on-open order to the broker. Limit-on-open orders are executed only at the market open at the specified limit price or better, and cancelled otherwise.

int BrokerLimitOnOpen(int, int, C_ActionType, double, C_TIF, double, string)

Submits a specified limit-on-open order to the broker. Limit-on-open orders are executed only at the market open at the specified limit price or better, and cancelled otherwise.

int BrokerMarket(C_ActionType, double, C_TIF, string)

Submits a specified market order to the broker. Market orders are executed at the current market price.

int BrokerMarket(int, int, C_ActionType, double, C_TIF, string)

Submits a specified market order to the broker. Market orders are executed at the current market price.

int BrokerMarketIfTouched(C_ActionType, double, C_TIF, double, string)

Submits a specified market-if-touched order to the broker.

int BrokerMarketIfTouched(int, int, C_ActionType, double, C_TIF, double, string)

Submits a specified market-if-touched order to the broker.

int BrokerMarketOnClose(C_ActionType, double, C_TIF, string)

Submits a specified market on close order to the broker. Market on close orders are executed at the next market close at the closing price.

int BrokerMarketOnClose(int, int, C_ActionType, double, C_TIF, string)

Submits a specified market on close order to the broker. Market on close orders are executed at the next market close at the closing price.

int BrokerMarketOnOpen(C_ActionType, double, C_TIF, string)

Submits a specified market on open order to the broker. Market on open orders are executed at the next market open at the opening price.

int BrokerMarketOnOpen(int, int, C_ActionType, double, C_TIF, string)

Submits a specified market on open order to the broker. Market on open orders are executed at the next market open at the opening price.

BrokerModifyOrder(int, double, double, double)

Modifies a specified pending order before it is executed. Note that the order modification won't take place until the next call.

BrokerModifyOrder(int, int, double, double, double)

Modifies a specified pending order before it is executed. Note that the order modification won't take place until the next call.

int BrokerRelative(C_ActionType, double, C_TIF, double, double, string)

Submits a specified relative/pegged-to-primary order to the broker.

int BrokerRelative(int, int, C_ActionType, double, C_TIF, double, double, string)

Submits a specified relative/pegged-to-primary order to the broker.

BrokerSetAllOrNone(int)

Sets a specified order as an all or none order, meaning that the broker should execute it all in one fill or not at all.

BrokerSetAllOrNone(int, int)

Sets a specified order as an all or none order, meaning that the broker should execute it all in one fill or not at all.

BrokerSetAllowETH(int)

Allows a specified order to be processed during ETH.

BrokerSetAllowETH(int, int)

Allows a specified order to be processed during ETH.

BrokerSetDestination(int, string)

Sets the routing destination of a specified order using one of the broker's routing identifiers.

BrokerSetDestination(int, int, string)

Sets the routing destination of a specified order using one of the broker's routing identifiers.

BrokerSetFAGroup(int, string, C_FA_Method, double)

Sets the financial advisor group and method for a specified pending order (IB only).

BrokerSetFAGroup(int, int, string, C_FA_Method, double)

Sets the financial advisor group and method for a specified pending order (IB only).

BrokerSetFAProfile(int, string)

Sets the financial advisor profile for a specified pending order (IB only).

BrokerSetFAProfile(int, int, string)

Sets the financial advisor profile for a specified pending order (IB only).

BrokerSetHidden(int)

Sets a specified limit order to be a hidden order.

BrokerSetHidden(int, int)

Sets a specified limit order to be a hidden order.

BrokerSetOCA(int, string, C_OCA_Type)

Sets a specified order as part of an OCA group. Note that this function must be called at the same strategy call in which the order is first created, prior to it being submitted to the broker.

BrokerSetOCA(int, int, string, C_OCA_Type)

Sets a specified order as part of an OCA group. Note that this function must be called at the same strategy call in which the order is first created, prior to it being submitted to the broker.

int BrokerSetStopLoss(int, double, string)

Submits a specified stop loss order to the broker. Stop loss orders are attached orders. They are attached to an entry order and are executed only when the trade that resulted from the entry order reaches a specified loss. If a trade is closed before its attached stop loss order is executed, the order is cancelled.

int BrokerSetStopLoss(int, int, double, string)

Submits a specified stop loss order to the broker. Stop loss orders are attached orders. They are attached to an entry order and are executed only when the trade that resulted from the entry order reaches a specified loss. If a trade is closed before its attached stop loss order is executed, the order is cancelled.

int BrokerSetStopLossPercent(int, double, bool, string)

Submits a specified stop loss order to the broker, with the stop loss price specified as a percent from the current price. Note that the percent offset isn't from the order execution price, but from the current price. In order for the stop price to be from the order execution price the modifyAfterExecution parameter should be set to true. Stop loss orders are attached orders, they are attached to an entry order and are executed only when the trade that resulted from the entry order reaches a specified loss. If a trade is closed before its attached stop loss order is executed then the order is cancelled.

int BrokerSetTakeProfit(int, double, string)

Submits a specified take profit order to the broker. Take profit orders are attached orders. They are attached to an entry order and are executed only when the trade that resulted from the entry order reaches a specified profit target. If a trade is closed before its attached take profit order is executed, the order is cancelled.

int BrokerSetTakeProfit(int, int, double, string)

Submits a specified take profit order to the broker. Take profit orders are attached orders. They are attached to an entry order and are executed only when the trade that resulted from the entry order reaches a specified profit target. If a trade is closed before its attached take profit order is executed, the order is cancelled.

int BrokerSetTakeProfitPercent(int, double, bool, string)

Submits a specified take profit order to the broker, with the take profit price specified as a percent from the current price. Note that the percent offset isn't from the order execution price, but from the current price. In order for the take profit price to be from the order execution price the modifyAfterExecution parameter should be set to true. Take profit orders are attached orders, they are attached to an entry order and are executed only when the trade that resulted from the entry order reaches a specified profit target. If a trade is closed before its attached take profit order is executed then the order is cancelled.

int BrokerSetTrailingStopLoss(int, bool, double, string)

Submits a specified trailing stop loss order to the broker. Trailing stop/loss orders are attached orders. They are attached to an entry order and are executed only when the trade that resulted from the entry order reaches a moving stop/loss price. If a trade is closed before its attached trailing stop loss order is executed, the order is cancelled.

int BrokerSetTrailingStopLoss(int, int, bool, double, string)

Submits a specified trailing stop loss order to the broker. Trailing stop/loss orders are attached orders. They are attached to an entry order and are executed only when the trade that resulted from the entry order reaches a moving stop/loss price. If a trade is closed before its attached trailing stop loss order is executed, the order is cancelled.

int BrokerStop(C_ActionType, double, C_TIF, double, string)

Submits a specified stop order to the broker. Stop orders are executed at the market price when the specified stop price is reached.

int BrokerStop(int, int, C_ActionType, double, C_TIF, double, string)

Submits a specified stop order to the broker. Stop orders are executed at the market price when the specified stop price is reached.

int BrokerStopLimit(C_ActionType, double, C_TIF, double, double, string)

Submits a specified stop limit order to the broker. Stop limit orders become normal limit orders when the specified stop price is reached.

int BrokerStopLimit(int, int, C_ActionType, double, C_TIF, double, double, string)

Submits a specified stop limit order to the broker. Stop limit orders become normal limit orders when the specified stop price is reached.

int BrokerVWAP(C_ActionType, double, C_TIF, long, long, string)

Submits a specified VWAP order to the broker.

int BrokerVWAP(int, int, C_ActionType, double, C_TIF, long, long, string)

Submits a specified VWAP order to the broker.


Function Details


BrokerAllowDuplicateOrders(bool allowDuplicates)

Specifies whether duplicate orders should be processed or cancelled (the default is 'false', i.e. duplicate orders are cancelled). Duplicate orders are orders that share the same symbol, action type and order type. Call the function once from OnInitialize.


Parameters


Type

Identifier

Description

bool

allowDuplicates

Indicates whether to allow (true) or cancel (false) duplicate orders


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


BrokerCancelOrder(int orderIndex, string comment)

Submits a cancel order request, of a specified pending order, to the broker. The order will be cancelled if possible.


Parameters


Type

Identifier

Description

int

orderIndex

The order index in the orders table

string

comment

The order comment


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


BrokerCancelOrder(int strategyNumber, int orderIndex, string comment)

Submits a cancel order request, of a specified pending order, to the broker. The order will be cancelled if possible.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

orderIndex

The order index in the orders table

string

comment

The order comment


Scripts


AddOn, RiskManagement


BrokerCloseAllPositions(string comment)

Submits market orders that will close all of the open positions of all of the symbols.


Parameters


Type

Identifier

Description

string

comment

The order comment


Scripts


MultiSymbolTradingStrategy


BrokerCloseAllPositions(int strategyNumber, string comment)

Submits market orders that will close all of the open positions of all of the symbols.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

string

comment

The order comment


Scripts


AddOn, RiskManagement


BrokerClosePosition(string comment)

Submits a market order that will close the open position of the underlying symbol, if such a position exists.


Parameters


Type

Identifier

Description

string

comment

The order comment


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


BrokerClosePosition(int strategyNumber, int positionIndex, string comment)

Submits a market order that will close a specified position.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table

string

comment

The order comment


Scripts


AddOn, RiskManagement


int BrokerDiscretionary(C_ActionType actionType, double quantity, C_TIF timeInForce, double limitPrice, double priceOffset, string comment)

Submits a specified discretionary order to the broker.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

C_ActionType

actionType

The action type (View Options)

double

quantity

The order quantity

C_TIF

timeInForce

The order TIF (View Options)

double

limitPrice

The order limit price

double

priceOffset

The monetary offset from the limit price

string

comment

The order comment


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


int BrokerDiscretionary(int strategyNumber, int symbolIndex, C_ActionType actionType, double quantity, C_TIF timeInForce, double limitPrice, double priceOffset, string comment)

Submits a specified discretionary order to the broker.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

symbolIndex

The symbol index in the symbols table

C_ActionType

actionType

The action type (View Options)

double

quantity

The order quantity

C_TIF

timeInForce

The order TIF (View Options)

double

limitPrice

The order limit price

double

priceOffset

The monetary offset from the limit price

string

comment

The order comment


Scripts


AddOn, RiskManagement


int BrokerIceberg(C_ActionType actionType, double quantity, double displayQuantity, C_TIF timeInForce, double limitPrice, string comment)

Submits a specified iceberg order to the broker. Iceberg orders display a specified part of their quantity, while hiding the rest.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

C_ActionType

actionType

The action type (View Options)

double

quantity

The order quantity

double

displayQuantity

The order display quantity, the iceberg

C_TIF

timeInForce

The order TIF (View Options)

double

limitPrice

The order limit price

string

comment

The order comment


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


int BrokerIceberg(int strategyNumber, int symbolIndex, C_ActionType actionType, double quantity, double displayQuantity, C_TIF timeInForce, double limitPrice, string comment)

Submits a specified iceberg order to the broker. Iceberg orders display a specified part of their quantity, while hiding the rest.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

symbolIndex

The symbol index in the symbols table

C_ActionType

actionType

The action type (View Options)

double

quantity

The order quantity

double

displayQuantity

The order display quantity, the iceberg

C_TIF

timeInForce

The order TIF (View Options)

double

limitPrice

The order limit price

string

comment

The order comment


Scripts


AddOn, RiskManagement


int BrokerLimit(C_ActionType actionType, double quantity, C_TIF timeInForce, double limitPrice, string comment)

Submits a specified limit order to the broker. Limit orders are executed only at the specified limit price or better.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

C_ActionType

actionType

The action type (View Options)

double

quantity

The order quantity

C_TIF

timeInForce

The order TIF (View Options)

double

limitPrice

The order limit price

string

comment

The order comment


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


int BrokerLimit(int strategyNumber, int symbolIndex, C_ActionType actionType, double quantity, C_TIF timeInForce, double limitPrice, string comment)

Submits a specified limit order to the broker. Limit orders are executed only at the specified limit price or better.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

symbolIndex

The symbol index in the symbols table

C_ActionType

actionType

The action type (View Options)

double

quantity

The order quantity

C_TIF

timeInForce

The order TIF (View Options)

double

limitPrice

The order limit price

string

comment

The order comment


Scripts


AddOn, RiskManagement


int BrokerLimitIfTouched(C_ActionType actionType, double quantity, C_TIF timeInForce, double touchPrice, double limitPrice, string comment)

Submits a specified limit-if-touched order to the broker.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

C_ActionType

actionType

The action type (View Options)

double

quantity

The order quantity

C_TIF

timeInForce

The order TIF (View Options)

double

touchPrice

The order touch price

double

limitPrice

The order limit price

string

comment

The order comment


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


int BrokerLimitIfTouched(int strategyNumber, int symbolIndex, C_ActionType actionType, double quantity, C_TIF timeInForce, double touchPrice, double limitPrice, string comment)

Submits a specified limit-if-touched order to the broker.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

symbolIndex

The symbol index in the symbols table

C_ActionType

actionType

The action type (View Options)

double

quantity

The order quantity

C_TIF

timeInForce

The order TIF (View Options)

double

touchPrice

The order touch price

double

limitPrice

The order limit price

string

comment

The order comment


Scripts


AddOn, RiskManagement


int BrokerLimitOnClose(C_ActionType actionType, double quantity, C_TIF timeInForce, double limitPrice, string comment)

Submits a specified limit-on-close order to the broker. Limit-on-close orders are executed only at the market close at the specified limit price or better, and cancelled otherwise.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

C_ActionType

actionType

The action type (View Options)

double

quantity

The order quantity

C_TIF

timeInForce

The order TIF (View Options)

double

limitPrice

The order limit price

string

comment

The order comment


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


int BrokerLimitOnClose(int strategyNumber, int symbolIndex, C_ActionType actionType, double quantity, C_TIF timeInForce, double limitPrice, string comment)

Submits a specified limit-on-close order to the broker. Limit-on-close orders are executed only at the market close at the specified limit price or better, and cancelled otherwise.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

symbolIndex

The symbol index in the symbols table

C_ActionType

actionType

The action type (View Options)

double

quantity

The order quantity

C_TIF

timeInForce

The order TIF (View Options)

double

limitPrice

The order limit price

string

comment

The order comment


Scripts


AddOn, RiskManagement


int BrokerLimitOnOpen(C_ActionType actionType, double quantity, C_TIF timeInForce, double limitPrice, string comment)

Submits a specified limit-on-open order to the broker. Limit-on-open orders are executed only at the market open at the specified limit price or better, and cancelled otherwise.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

C_ActionType

actionType

The action type (View Options)

double

quantity

The order quantity

C_TIF

timeInForce

The order TIF (View Options)

double

limitPrice

The order limit price

string

comment

The order comment


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


int BrokerLimitOnOpen(int strategyNumber, int symbolIndex, C_ActionType actionType, double quantity, C_TIF timeInForce, double limitPrice, string comment)

Submits a specified limit-on-open order to the broker. Limit-on-open orders are executed only at the market open at the specified limit price or better, and cancelled otherwise.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number 

int

symbolIndex

The symbol index in the symbols table

C_ActionType

actionType

The action type (View Options)

double

quantity

The order quantity

C_TIF

timeInForce

The order TIF (View Options)

double

limitPrice

The order limit price

string

comment

The order comment


Scripts


AddOn, RiskManagement


int BrokerMarket(C_ActionType actionType, double quantity, C_TIF timeInForce, string comment)

Submits a specified market order to the broker. Market orders are executed at the current market price.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

C_ActionType

actionType

The action type (View Options)

double

quantity

The order quantity

C_TIF

timeInForce

The order TIF (View Options)

string

comment

The order comment


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


int BrokerMarket(int strategyNumber, int symbolIndex, C_ActionType actionType, double quantity, C_TIF timeInForce, string comment)

Submits a specified market order to the broker. Market orders are executed at the current market price.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number 

int

symbolIndex

The symbol index in the symbols table

C_ActionType

actionType

The action type (View Options)

double

quantity

The order quantity

C_TIF

timeInForce

The order TIF (View Options)

string

comment

The order comment


Scripts


AddOn, RiskManagement


int BrokerMarketIfTouched(C_ActionType actionType, double quantity, C_TIF timeInForce, double touchPrice, string comment)

Submits a specified market-if-touched order to the broker.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

C_ActionType

actionType

The action type (View Options)

double

quantity

The order quantity

C_TIF

timeInForce

The order TIF (View Options)

double

touchPrice

The order touch price

string

comment

The order comment


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


int BrokerMarketIfTouched(int strategyNumber, int symbolIndex, C_ActionType actionType, double quantity, C_TIF timeInForce, double touchPrice, string comment)

Submits a specified market-if-touched order to the broker.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

symbolIndex

The symbol index in the symbols table

C_ActionType

actionType

The action type (View Options)

double

quantity

The order quantity

C_TIF

timeInForce

The order TIF (View Options)

double

touchPrice

The order touch price

string

comment

The order comment


Scripts


AddOn, RiskManagement


int BrokerMarketOnClose(C_ActionType actionType, double quantity, C_TIF timeInForce, string comment)

Submits a specified market on close order to the broker. Market on close orders are executed at the next market close at the closing price.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

C_ActionType

actionType

The action type (View Options)

double

quantity

The order quantity

C_TIF

timeInForce

The order TIF (View Options)

string

comment

The order comment


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


int BrokerMarketOnClose(int strategyNumber, int symbolIndex, C_ActionType actionType, double quantity, C_TIF timeInForce, string comment)

Submits a specified market on close order to the broker. Market on close orders are executed at the next market close at the closing price.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

symbolIndex

The symbol index in the symbols table

C_ActionType

actionType

The action type (View Options)

double

quantity

The order quantity

C_TIF

timeInForce

The order TIF (View Options)

string

comment

The order comment


Scripts


AddOn, RiskManagement


int BrokerMarketOnOpen(C_ActionType actionType, double quantity, C_TIF timeInForce, string comment)

Submits a specified market on open order to the broker. Market on open orders are executed at the next market open at the opening price.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

C_ActionType

actionType

The action type (View Options)

double

quantity

The order quantity

C_TIF

timeInForce

The order TIF (View Options)

string

comment

The order comment


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


int BrokerMarketOnOpen(int strategyNumber, int symbolIndex, C_ActionType actionType, double quantity, C_TIF timeInForce, string comment)

Submits a specified market on open order to the broker. Market on open orders are executed at the next market open at the opening price.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

symbolIndex

The symbol index in the symbols table

C_ActionType

actionType

The action type (View Options)

double

quantity

The order quantity

C_TIF

timeInForce

The order TIF (View Options)

string

comment

The order comment


Scripts


AddOn, RiskManagement


BrokerModifyOrder(int orderIndex, double quantity, double stopPrice, double limitPrice)

Modifies a specified pending order before it is executed. Note that the order modification won't take place until the next call.


Parameters


Type

Identifier

Description

int

orderIndex

The order index to update

double

quantity

The new quantity (-1 to keep current quantity)

double

stopPrice

The new stop price (-1 to keep current stop price)

double

limitPrice

The new limit price (-1 to keep current limit price)


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


BrokerModifyOrder(int strategyNumber, int orderIndex, double quantity, double stopPrice, double limitPrice)

Modifies a specified pending order before it is executed. Note that the order modification won't take place until the next call.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number 

int

orderIndex

The order index to update

double

quantity

The new quantity (-1 to keep current quantity)

double

stopPrice

The new stop price (-1 to keep current stop price)

double

limitPrice

The new limit price (-1 to keep current limit price)


Scripts


AddOn, RiskManagement


int BrokerRelative(C_ActionType actionType, double quantity, C_TIF timeInForce, double limitPrice, double offset, string comment)

Submits a specified relative/pegged-to-primary order to the broker.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

C_ActionType

actionType

The action type (View Options)

double

quantity

The order quantity

C_TIF

timeInForce

The order TIF (View Options)

double

limitPrice

The order limit price

double

offset

The monetary price offset from the best bid/ask

string

comment

The order comment


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


int BrokerRelative(int strategyNumber, int symbolIndex, C_ActionType actionType, double quantity, C_TIF timeInForce, double limitPrice, double offset, string comment)

Submits a specified relative/pegged-to-primary order to the broker.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

symbolIndex

The symbol index in the symbols table

C_ActionType

actionType

The action type (View Options)

double

quantity

The order quantity

C_TIF

timeInForce

The order TIF (View Options)

double

limitPrice

The order limit price

double

offset

The monetary price offset from the best bid/ask

string

comment

The order comment


Scripts


AddOn, RiskManagement


BrokerSetAllOrNone(int orderIndex)

Sets a specified order as an all or none order, meaning that the broker should execute it all in one fill or not at all.


Parameters


Type

Identifier

Description

int

orderIndex

The order index to set as an all or none order


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


BrokerSetAllOrNone(int strategyNumber, int orderIndex)

Sets a specified order as an all or none order, meaning that the broker should execute it all in one fill or not at all.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

orderIndex

The order index to set as an all or none order


Scripts


AddOn


BrokerSetAllowETH(int orderIndex)

Allows a specified order to be processed during ETH.


Parameters


Type

Identifier

Description

int

orderIndex

The order index to set


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


BrokerSetAllowETH(int strategyNumber, int orderIndex)

Allows a specified order to be processed during ETH.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

orderIndex

The order index to set


Scripts


AddOn, RiskManagement


BrokerSetDestination(int orderIndex, string destination)

Sets the routing destination of a specified order using one of the broker's routing identifiers.


Parameters


Type

Identifier

Description

int

orderIndex

The order index to modify

string

destination

The routing destination identifier


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


BrokerSetDestination(int strategyNumber, int orderIndex, string destination)

Sets the routing destination of a specified order using one of the broker's routing identifiers.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

orderIndex

The order index to modify

string

destination

The routing destination identifier


Scripts


AddOn, RiskManagement


BrokerSetFAGroup(int orderIndex, string faGroup, C_FA_Method faMethod, double faPercent)

Sets the financial advisor group and method for a specified pending order (IB only).


Parameters


Type

Identifier

Description

int

orderIndex

The order index

string

faGroup

The FA group

C_FA_Method

faMethod

The FA method (View Options)

double

faPercent

The percent (0 to 100) to use when the method is set to PERCENT_CHANGE


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


BrokerSetFAGroup(int strategyNumber, int orderIndex, string faGroup, C_FA_Method faMethod, double faPercent)

Sets the financial advisor group and method for a specified pending order (IB only).


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

orderIndex

The order index

string

faGroup

The FA group

C_FA_Method

faMethod

The FA method (View Options)

double

faPercent

The percent (0 to 100) to use when the method is set to PERCENT_CHANGE


Scripts


AddOn, RiskManagement


BrokerSetFAProfile(int orderIndex, string faProfile)

Sets the financial advisor profile for a specified pending order (IB only).


Parameters


Type

Identifier

Description

int

orderIndex

The order index

string

faProfile

The FA profile


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


BrokerSetFAProfile(int strategyNumber, int orderIndex, string faProfile)

Sets the financial advisor profile for a specified pending order (IB only).


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

orderIndex

The order index

string

faProfile

The FA profile


Scripts


AddOn, RiskManagement


BrokerSetHidden(int orderIndex)

Sets a specified limit order to be a hidden order.


Parameters


Type

Identifier

Description

int

orderIndex

The order index to be hidden


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


BrokerSetHidden(int strategyNumber, int orderIndex)

Sets a specified limit order to be a hidden order.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number 

int

orderIndex

The order index to be hidden


Scripts


AddOn, RiskManagement


BrokerSetOCA(int orderIndex, string groupName, C_OCA_Type type)

Sets a specified order as part of an OCA group. Note that this function must be called at the same strategy call in which the order is first created, prior to it being submitted to the broker.


Parameters


Type

Identifier

Description

int

orderIndex

The order index of the order to set into an OCA

string

groupName

The OCA group name

C_OCA_Type

type

The OCA type


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


BrokerSetOCA(int strategyNumber, int orderIndex, string groupName, C_OCA_Type type)

Sets a specified order as part of an OCA group. Note that this function must be called at the same strategy call in which the order is first created, prior to it being submitted to the broker.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

orderIndex

The order index of the order to set into an OCA

string

groupName

The OCA group name

C_OCA_Type

type

The OCA type


Scripts


AddOn, RiskManagement


int BrokerSetStopLoss(int orderIndex, double stopPrice, string comment)

Submits a specified stop loss order to the broker. Stop loss orders are attached orders. They are attached to an entry order and are executed only when the trade that resulted from the entry order reaches a specified loss. If a trade is closed before its attached stop loss order is executed, the order is cancelled.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

int

orderIndex

The order index to attach the stop loss order to

double

stopPrice

The stop price

string

comment

The order comment


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


int BrokerSetStopLoss(int strategyNumber, int orderIndex, double stopPrice, string comment)

Submits a specified stop loss order to the broker. Stop loss orders are attached orders. They are attached to an entry order and are executed only when the trade that resulted from the entry order reaches a specified loss. If a trade is closed before its attached stop loss order is executed, the order is cancelled.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

orderIndex

The order index to attach the stop loss order to

double

stopPrice

The stop price

string

comment

The order comment


Scripts


AddOn, RiskManagement


int BrokerSetStopLossPercent(int orderIndex, double stopPercent, bool modifyAfterExecution, string comment)

Submits a specified stop loss order to the broker, with the stop loss price specified as a percent from the current price. Note that the percent offset isn't from the order execution price, but from the current price. In order for the stop price to be from the order execution price the modifyAfterExecution parameter should be set to true. Stop loss orders are attached orders, they are attached to an entry order and are executed only when the trade that resulted from the entry order reaches a specified loss. If a trade is closed before its attached stop loss order is executed then the order is cancelled.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

int

orderIndex

The order index to attach the stop loss to

double

stopPercent

The stop percent distance from the current price (0 to 100)

bool

modifyAfterExecution

Use for indicating whether the stop price should be modified based on the parent order execution price

string

comment

The order comment


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


int BrokerSetTakeProfit(int orderIndex, double limitPrice, string comment)

Submits a specified take profit order to the broker. Take profit orders are attached orders. They are attached to an entry order and are executed only when the trade that resulted from the entry order reaches a specified profit target. If a trade is closed before its attached take profit order is executed, the order is cancelled.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

int

orderIndex

The order index to attach the take profit order to

double

limitPrice

The take profit price

string

comment

The order comment


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


int BrokerSetTakeProfit(int strategyNumber, int orderIndex, double limitPrice, string comment)

Submits a specified take profit order to the broker. Take profit orders are attached orders. They are attached to an entry order and are executed only when the trade that resulted from the entry order reaches a specified profit target. If a trade is closed before its attached take profit order is executed, the order is cancelled.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number (or zero if unavailable)

int

orderIndex

The order index to attach the take profit order to

double

limitPrice

The take profit price

string

comment

The order comment


Scripts


AddOn, RiskManagement


int BrokerSetTakeProfitPercent(int orderIndex, double limitPercent, bool modifyAfterExecution, string comment)

Submits a specified take profit order to the broker, with the take profit price specified as a percent from the current price. Note that the percent offset isn't from the order execution price, but from the current price. In order for the take profit price to be from the order execution price the modifyAfterExecution parameter should be set to true. Take profit orders are attached orders, they are attached to an entry order and are executed only when the trade that resulted from the entry order reaches a specified profit target. If a trade is closed before its attached take profit order is executed then the order is cancelled.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

int

orderIndex

The order index to attach the take profit order to

double

limitPercent

The limit percent from the current price (Greater than zero)

bool

modifyAfterExecution

Use for indicating whether the take profit price should be modified based on the parent order execution price

string

comment

The order comment


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


int BrokerSetTrailingStopLoss(int orderIndex, bool isPercentOffset, double trailingOffset, string comment)

Submits a specified trailing stop loss order to the broker. Trailing stop/loss orders are attached orders. They are attached to an entry order and are executed only when the trade that resulted from the entry order reaches a moving stop/loss price. If a trade is closed before its attached trailing stop loss order is executed, the order is cancelled.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

int

orderIndex

The order index to attach the trailing stop loss order to

bool

isPercentOffset

Use for indicating whether the trailing stop is a percent (true) or a fixed price (false) offset

double

trailingOffset

The percent (0-100) or fixed price trailing offset

string

comment

The order comment


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


int BrokerSetTrailingStopLoss(int strategyNumber, int orderIndex, bool isPercentOffset, double trailingOffset, string comment)

Submits a specified trailing stop loss order to the broker. Trailing stop/loss orders are attached orders. They are attached to an entry order and are executed only when the trade that resulted from the entry order reaches a moving stop/loss price. If a trade is closed before its attached trailing stop loss order is executed, the order is cancelled.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number 

int

orderIndex

The order index to attach the trailing stop loss order to

bool

isPercentOffset

Indicates whether the trailing stop is a percent (true) or a fixed price (false) offset

double

trailingOffset

The percent (0-100) or fixed price trailing offset

string

comment

The order comment


Scripts


AddOn, RiskManagement


int BrokerStop(C_ActionType actionType, double quantity, C_TIF timeInForce, double stopPrice, string comment)

Submits a specified stop order to the broker. Stop orders are executed at the market price when the specified stop price is reached.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

C_ActionType

actionType

The action type (View Options)

double

quantity

The order quantity

C_TIF

timeInForce

The order TIF (View Options)

double

stopPrice

The order stop price

string

comment

The order comment


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


int BrokerStop(int strategyNumber, int symbolIndex, C_ActionType actionType, double quantity, C_TIF timeInForce, double stopPrice, string comment)

Submits a specified stop order to the broker. Stop orders are executed at the market price when the specified stop price is reached.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

symbolIndex

The symbol index in the symbols table

C_ActionType

actionType

The action type (View Options)

double

quantity

The order quantity

C_TIF

timeInForce

The order TIF (View Options)

double

stopPrice

The order stop price

string

comment

The order comment


Scripts


AddOn, RiskManagement


int BrokerStopLimit(C_ActionType actionType, double quantity, C_TIF timeInForce, double stopPrice, double limitPrice, string comment)

Submits a specified stop limit order to the broker. Stop limit orders become normal limit orders when the specified stop price is reached.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

C_ActionType

actionType

The action type (View Options)

double

quantity

The order quantity

C_TIF

timeInForce

The order TIF (View Options)

double

stopPrice

The order stop price

double

limitPrice

The order limit price

string

comment

The order comment


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


int BrokerStopLimit(int strategyNumber, int symbolIndex, C_ActionType actionType, double quantity, C_TIF timeInForce, double stopPrice, double limitPrice, string comment)

Submits a specified stop limit order to the broker. Stop limit orders become normal limit orders when the specified stop price is reached.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

symbolIndex

The symbol index in the symbols table

C_ActionType

actionType

The action type (View Options)

double

quantity

The order quantity

C_TIF

timeInForce

The order TIF (View Options)

double

stopPrice

The order stop price

double

limitPrice

The order limit price

string

comment

The order comment


Scripts


AddOn, RiskManagement


int BrokerVWAP(C_ActionType actionType, double quantity, C_TIF timeInForce, long startTime, long endTime, string comment)

Submits a specified VWAP order to the broker.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

C_ActionType

actionType

The action type (View Options)

double

quantity

The order quantity

C_TIF

timeInForce

The order TIF (View Options)

long

startTime

The start time (0 for no start time)

long

endTime

The end time (0 for no end time)

string

comment

The order comment


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, TradingStrategy


int BrokerVWAP(int strategyNumber, int symbolIndex, C_ActionType actionType, double quantity, C_TIF timeInForce, long startTime, long endTime, string comment)

Submits a specified VWAP order to the broker.


Returns


The order index of the new order.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

symbolIndex

The symbol index in the symbols table

C_ActionType

actionType

The action type (View Options)

double

quantity

The order quantity

C_TIF

timeInForce

The order TIF (View Options)

long

startTime

The start time (0 for no start time)

long

endTime

The end time (0 for no end time)

string

comment

The order comment


Scripts


AddOn, RiskManagement