Automated Trading Live Account - Configuration and Trading Functions

CN
AICoin
Follow
1 year ago
```html

Configuration Function

tradeConfig 

Used to set the configuration for trading, can only be set once

tradeConfig(price, amount, total)
Syntax version required // @version=2 

Type

Function

Parameter Description

Name

Type

Description

price

String

last: latest price limit order; over: overpriced order, overprice percentage follows PC system settings; queue: queued price; market: market price

amount

Number

Amount to be traded

``````html

Amount

Name

Type

The quantity of the order, the default unit of quantity is consistent with the default unit of the trading variety, and can be changed when starting the live trading

Example

// Set the precision of script output data to 4
indicator(precision = 4)

Trading Function

enterLong

Open long position for futures / buy spot (you can only declare each type of instruction at most once, repeated declaration will result in compilation error)

enterLong(cond, price, amount)
Syntax version required // @version=2 

Type

Trading Function

Parameter Description

Name

Type

Description

cond

Boolean

e.g. close>open, needs to be a boolean series value

price

String

The price at which the order will be placed

``````html

Amount

Name

Type

Description

price

String

last: place order at the last price; over: place order at a price higher than the current price, with the percentage following the PC system settings; queue: place order at a specific price; market: place order at market price

amount

Numeric

The quantity of the order, the default unit of quantity is consistent with the default unit of the trading variety, and can be changed when starting the live trading

Return Value

No return value

Example

enterLong(close>open, price="market", amount=1)

 

exitLong

Close long position for futures / sell spot

exitLong(cond, price, amount)
Syntax version required // @version=2 

Type

Trading Function

Parameter Description

Name

Type

Description

cond

Boolean

e.g. close>open, needs to be a boolean series value

price

String

last: place order at the last price; over: place order at a price higher than the current price, with the percentage following the PC system settings; queue: place order at a specific price; market: place order at market price

amount

Numeric

The quantity of the order, the default unit of quantity is consistent with the default unit of the trading variety, and can be changed when starting the live trading

``````html

Type

Name

Description

cond

Boolean data, e.g. close>open, needs to be a boolean series value

price

last: place order at the last price; over: place order at a price higher than the current price, with the percentage following the PC system settings; queue: place order at a specific price; market: place order at market price

amount

Numeric value, the quantity of the order, the default unit of quantity is consistent with the default unit of the trading variety, and can be changed when starting the live trading

``````html

Return Value

No return value

Example

exitLong(close>open, price="market", amount=1)
 

enterShort

Open a short position for the contract

enterShort(cond, price, amount)
Syntax version required // @version=2 

Type

Trading function

Parameter Description

Name

Type

Description

cond

Boolean data

e.g. close>open, needs to be a boolean series value

``````html

price

String

last: limit order at the last price; over: overpriced order, with the overprice percentage following the PC system settings; queue: queue price; market: market order

amount

Number

Order quantity, the default unit of quantity is consistent with the default unit of the trading variety, and can be changed when starting live trading

Return Value

No return value

Example

enterShort(close>open, price="market", amount=1)

 

exitShort

Close a short position for the contract

exitShort(cond, price, amount)
Syntax version required // @version=2 

Type

Trading function

Parameter Description

Name

Type

Description

cond

Boolean data

e.g. close>open, needs to be a boolean series value

``````html

Type

Description

cond

Boolean data

e.g. close>open, needs to be a boolean series value

price

String

last: limit order at the last price; over: overpriced order, with the overprice percentage following the PC system settings; queue: queue price; market: market order

amount

Number

Order quantity, the default unit of quantity is consistent with the default unit of the trading variety, and can be changed when starting live trading

``````html 2px; border-top:1px solid #cbcdd1; border-right:1px solid #cbcdd1; border-left:1px solid #cbcdd1">

Order quantity, the default unit of quantity is consistent with the default unit of the trading variety, and can be changed when starting live trading

Return Value

None

Example

exitShort(close>open, price="market", amount=1)

 

Related Reading:

AICoin Automated Live Trading - Quick Start

AICoin Automated Live Trading - Real-life Example of Signal Alert

AICoin Automated Live Trading - Real-life Example of Indicator Win Rate

AICoin Automated Live Trading - Real-life Example of Custom Indicator

AICoin Automated Live Trading - Handling Common Issues

```

免责声明:本文章仅代表作者个人观点,不代表本平台的立场和观点。本文章仅供信息分享,不构成对任何人的任何投资建议。用户与作者之间的任何争议,与本平台无关。如网页中刊载的文章或图片涉及侵权,请提供相关的权利证明和身份证明发送邮件到support@aicoin.com,本平台相关工作人员将会进行核查。

Share To
APP

X

Telegram

Facebook

Reddit

CopyLink