TradeManagement functions are used exclusively from Trade Management Strategy scripts in order to control the scripts execution. These scripts have multiple use-cases such as implementing position entry strategies, implementing position exit strategies and implementing advanced order management systems, among others.



Read more: Trade Management Strategy Scripts


Sections


Functions

Function Details


Functions


Name

Description

int[] TradeManagementGetRegisteredOrders()

Gets the order indexes that were registered by the script. All of the orders that belong to the script must be registered by it. This includes the entry order which triggered the script as well as all of the orders which were generated by it (see the TradeManagementRegisterOrder function).

bool TradeManagementIsActive()

Determines whether the script is active and still receiving bar updates. The script must be activated using the TradeManagementStart function in order for it to start receiving bar updates. The script must be deactivated using the TradeManagementStop function in order for it to stop receiving bar updates.

TradeManagementRegisterOrder(int)

Registers a specified order as an order that belongs to the script. All of the orders that belong to the script must be registered by it. This includes the entry order which triggered the script as well as all of the orders which were generated by it.

TradeManagementStart()

Starts the script so that it starts receiving bar updates.

TradeManagementStop()

Stops the script so that it stops receiving bar updates.


Function Details


int[] TradeManagementGetRegisteredOrders()

Gets the order indexes that were registered by the script. All of the orders that belong to the script must be registered by it. This includes the entry order which triggered the script as well as all of the orders which were generated by it (see the TradeManagementRegisterOrder function).


Returns


The order indexes that were registered by the trade management strategy.


Scripts


TradeManagementStrategy


bool TradeManagementIsActive()

Determines whether the script is active and still receiving bar updates. The script must be activated using the TradeManagementStart function in order for it to start receiving bar updates. The script must be deactivated using the TradeManagementStop function in order for it to stop receiving bar updates.


Returns


True if the trade management strategy is active and still receiving bar updates, false otherwise.


Scripts


TradeManagementStrategy


TradeManagementRegisterOrder(int orderIndex)

Registers a specified order as an order that belongs to the script. All of the orders that belong to the script must be registered by it. This includes the entry order which triggered the script as well as all of the orders which were generated by it.


Parameters


Type

Identifier

Description

int

orderIndex

The order index to register as belonging to the trade management strategy


Scripts


TradeManagementStrategy


TradeManagementStart()

Starts the script so that it starts receiving bar updates.


Scripts


TradeManagementStrategy


TradeManagementStop()

Stops the script so that it stops receiving bar updates.


Scripts


TradeManagementStrategy