Type/to search
Built-in Functions
Structures
Built-in Variables
EXCHANGE
exchange
exchanges
ORDER_STATE
ORDER_TYPE
ORDER_CONDITION_TYPE
POSITION_DIRECTION
ORDER_OFFSET
PERIOD
LOG_TYPE

exchange is an exchange object, which is the first exchange object added in the strategy's live trading settings or backtesting settings. All interactions with the exchange are implemented through the member functions of this object.

Type

object

Examples

javascript
function main() { Log("First exchange object name:", exchange.GetName(), ", Label:", exchange.GetLabel()) }
python
def main(): Log("First exchange object name:", exchange.GetName(), ", Label:", exchange.GetLabel())
c++
void main() { Log("First exchange object name:", exchange.GetName(), ", Label:", exchange.GetLabel()); }

See Also

exchanges is an array containing all exchange objects added from the strategy's live trading settings or backtesting settings, where exchanges[0] is exchange.

Exchange objects added in the strategy's live trading settings or backtesting settings correspond to exchanges[0], exchanges[1], exchanges[2], ... exchanges[n] in the order they were added.

Type

array

Examples

javascript
function main() { for(var i = 0; i < exchanges.length; i++) { Log("Exchange index:", i, "Name:", exchanges[i].GetName(), "Label:", exchanges[i].GetLabel()) } }
python
def main(): for i in range(len(exchanges)): Log("Exchange index:", i, "Name:", exchanges[i].GetName(), "Label:", exchanges[i].GetLabel())
c++
void main() { for(int i = 0; i < exchanges.size(); i++) { Log("Exchange index:", i, "Name:", exchanges[i].GetName(), "Label:", exchanges[i].GetLabel()); } }

See Also

ORDER_STATE_PENDING is the value of the Status property in the Order structure, indicating that the order status is pending.

Type

number

See Also

Remarks

The value of ORDER_STATE_PENDING is 0.

ORDER_STATE_CLOSED is the value of the Status property in the Order structure, indicating that the order status is completed.

Type

number

See Also

Remarks

The value of ORDER_STATE_CLOSED is 1.

ORDER_STATE_CANCELED is the value of the Status property in the Order structure, indicating that the order status is canceled.

Type

number

See Also

Remarks

The value of ORDER_STATE_CANCELED is 2.

ORDER_STATE_UNKNOWN is the value of the Status property in the Order structure, indicating that the order status is unknown (other status).

Type

number

See Also

Remarks

The value of ORDER_STATE_UNKNOWN is 3.

For ORDER_STATE_UNKNOWN status, you can call the exchange.GetRawJSON function to get the raw order status information and refer to the exchange documentation for specific descriptions.

ORDER_TYPE_BUY is the value of the Type property in the Order structure, representing a buy order type.

Type

number

See Also

Remarks

The value of ORDER_TYPE_BUY is 0.

ORDER_TYPE_SELL is the Type property value in the Order structure, used to indicate a sell order type.

Type

number

See Also

Remarks

The value of ORDER_TYPE_SELL is 1.

ORDER_CONDITION_TYPE_OCO is the value of the ConditionType property in the Condition structure, representing OCO orders (One-Cancels-the-Other). OCO orders set both take-profit and stop-loss conditions simultaneously. When one condition is triggered, the other condition is automatically cancelled.

Type

number

See Also

Remarks

The value of ORDER_CONDITION_TYPE_OCO is 0.

ORDER_CONDITION_TYPE_TP is the ConditionType attribute value in the Condition structure, representing a Take Profit order. A take profit order automatically triggers when the market price reaches the preset target profit price.

Type

number

See Also

Remarks

The value of ORDER_CONDITION_TYPE_TP is 1.

ORDER_CONDITION_TYPE_SL is the ConditionType attribute value in the Condition structure, representing a Stop Loss order. A stop loss order is automatically triggered when the market price reaches the preset stop loss price, used to limit potential losses.

Type

number

See Also

Remarks

The value of ORDER_CONDITION_TYPE_SL is 2.

ORDER_CONDITION_TYPE_GENERIC is the ConditionType property value in the Condition structure, representing a generic conditional order. The specific behavior of generic conditional orders depends on the exchange implementation.

Type

number

See Also

Remarks

The value of ORDER_CONDITION_TYPE_GENERIC is 3.

PD_LONG is the value of the Type property in the Position structure, representing a long position type.

Type

number

See Also

Remarks

The value of PD_LONG is 0.

For long positions in futures markets, use exchange.SetDirection("closebuy") to set the closing direction to close this type of position.

PD_SHORT is the value of the Type property in the Position structure, representing a short position type.

Type

number

See Also

Remarks

The value of PD_SHORT is 1.

For short positions in futures markets, use exchange.SetDirection("closesell") to set the closing direction to close this type of position.

ORDER_OFFSET_OPEN is a value for the Offset property in the Order structure, indicating that the order is an opening position operation.

Type

number

See Also

Remarks

The value of ORDER_OFFSET_OPEN is 0.

ORDER_OFFSET_CLOSE is a value for the Offset property in the Order structure, indicating that the order is in the close position direction.

Type

number

See Also

Remarks

The value of ORDER_OFFSET_CLOSE is 1.

Constant representing 1-minute candlestick period, with a value of 60.

Type

number

See Also

Constant representing the 3-minute candlestick period, with a value of 180.

Type

number

See Also

Constant representing the 5-minute candlestick period, with a value of 300.

Type

number

See Also

Constant representing the 15-minute candlestick period, with a value of 900.

Type

number

See Also

Constant representing the 30-minute candlestick period, with a value of 1800 seconds.

Type

number

See Also

Constant representing 1-hour candlestick period, with a value of 3600.

Type

number

See Also

Constant representing the 2-hour candlestick period, with a value of 7200.

Type

number

See Also

Constant representing the 4-hour candlestick period, with a value of 14400.

Type

number

See Also

Constant representing the 6-hour candlestick period, with a value of 21600.

Type

number

See Also

Constant representing the 12-hour candlestick period, with a value of 43200.

Type

number

See Also

Constant representing 1-day candlestick period, with a value of 86400.

Type

number

See Also

Constant representing the 3-day candlestick period, with a value of 259200.

Type

number

See Also

Constant representing 1-week candlestick period, with a value of 604800 seconds.

Type

number

See Also

LOG_TYPE_BUY is an optional value for the LogType parameter of the exchange.Log function, used to set the log type printed by the exchange.Log function as a buy order log.

The value of LOG_TYPE_BUY is 0.

Type

number

See Also

LOG_TYPE_SELL is an optional value for the LogType parameter of the exchange.Log function, used to set the exchange.Log function to print sell order logs.

The value of LOG_TYPE_SELL is 1.

Type

number

See Also

LOG_TYPE_CANCEL is an optional value for the LogType parameter of the exchange.Log function, used to set the exchange.Log function to print order cancellation logs.

The value of LOG_TYPE_CANCEL is 2.

Type

number

See Also