Charts
DataOn-chain
VIP
Market Cap
API
Rankings
CoinOSNew
CoinClaw🦞
Language
  • 简体中文
  • 繁体中文
  • English
Leader in global market data applications, committed to providing valuable information more efficiently.

Features

  • Real-time Data
  • Special Features
  • AI Grid

Services

  • News
  • Open Data(API)
  • Institutional Services

Downloads

  • Desktop
  • Android
  • iOS

Contact Us

  • Chat Room
  • Business Email
  • Official Email
  • Official Verification

Join Community

  • Telegram
  • Twitter
  • Discord

© Copyright 2013-2026. All rights reserved.

简体繁體English
|Legacy

Automated Trading Live Account - Configuration and Trading Functions

CN
AiCoin
Follow
2 years ago
AI summarizes in 5 seconds.
```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,本平台相关工作人员将会进行核查。

全域 AI 入口,限量瓜分万元礼包
广告
|
|
APP
Windows
Mac
Share To

X

Telegram

Facebook

Reddit

CopyLink

|
|
APP
Windows
Mac
Share To

X

Telegram

Facebook

Reddit

CopyLink

Selected Articles by AiCoin

21 hours ago
Returning to the “Punk” Year: Ethereum Sounds the Horn for the Privacy Defense Battle
23 hours ago
AiCoin Daily Report (March 15)
1 day ago
On the day oil prices returned to three digits, capital began to vote with its feet.
View More

Table of Contents

|
|
APP
Windows
Mac
Share To

X

Telegram

Facebook

Reddit

CopyLink

Related Articles

avatar
avatarAiCoin研究院
2 days ago
March must charge Alpha opportunities | Is lobster listed on Binance just an appetizer?
avatar
avatarAiCoin研究院
2 days ago
Lobsters are calling for fragrant welfare! OKX & Binance's latest benefits to grab directly.
avatar
avatarAiCoin研究院
5 days ago
A Comprehensive Guide to Moving Averages (MA) Every Beginner Must Learn
avatar
avatarAiCoin研究院
5 days ago
Under geopolitical conflicts, how will BTC perform?
avatar
avatarAiCoin研究院
9 days ago
Is BTC reversing or is it a trap for the bulls?
APP
Windows
Mac

X

Telegram

Facebook

Reddit

CopyLink