Custom Indicators - Symbol Value and Expression of Multi-Data Source Functions

CN
AICoin
Follow
1 year ago

Multi-data Source Functions

security

Retrieve data from another data source

security(symbol, period, expr)

Syntax version requires // @version=2

Parameter Description

Name

Type

Description

symbol

String

Identifier of the requested data, use syminfo.tickerid to obtain the identifier of the current window

period

String

Requested data period

expr

Expression

Expression to be calculated and returned

1. Obtain the Symbol Value of Other Data

security(symbol, period, expr)

Method 1: Directly Copy the Identifier Code

● On the PC end, find the copy identifier code button behind the trading pair/index

● Click the button to successfully copy the symbol value of the current trading pair

● Paste the copied value into the security function (Note: Quotation marks are required, symbol value is in string format)

● Note: This copy button is available in AICoin version 2.7.7 and above on the PC end

Custom Indicators - Symbol Value and Expression of Multi-data Source Functions_aicoin_Figure 1

Method 2: Use Index Indicators in the Specified Format

Explanation: ${dbKey} : Trading pair key
 

Candlestick Type 
    Trading Pair
    Index

/* Example */

//  Retrieve close data of the corresponding trading pair (syminfo.tickerid represents the symbol of the current trading pair)
security(syminfo.tickerid, '1m', close)

// Retrieve close data of the OKX-BTC long/short position ratio index
security('i:lsprbtc:okex', '5m', close)

● Interest ( interest:${dbKey} )

// Retrieve the open interest of ethusdt perpetual
security("interest:ethswapusdt:okcoinfutures", '5m', close)

● Funding Rate ( fundrate:${dbKey} )

// Retrieve the funding rate of ethusdt perpetual
security('fundrate:ethswapusdt:okcoinfutures', '5m', fundingRate)

● Long/Short Position Ratios ( lspr:${dbKey} )

Note: Currently only supports OKX platform contracts, Binance U perpetual contracts

// Retrieve long/short position data of eth
security('lspr:ethswapusdt:okcoinfutures', '5m', ratios)

● Elite Holding ( elite:${dbKey} )

Note: Currently only supports OKX platform contracts with a period of 5 minutes or more, Binance U perpetual contracts, and Huobi coin-based delivery contracts

// Retrieve the value of the contract elite trend indicator
security('elite:mkrswapusdt:binance', '', buyAccount)
// Retrieve the contract elite holding ratio indicator value
security('elite:mkrswapusdt:binance', '5m', buyInterest)
security('elite:mkrswapusdt:binance', '5m', sellInterest)

● Contract Total Holding and Trading Volume ( oiav:${dbKey} )

Note: Currently only supports OKX platform contracts with a period of 5 minutes or more

// Retrieve contract total trading volume
security('oiav:ethswapusdt:okcoinfutures','5m',volume)

● Active Buying and Selling ( ttv:${dbKey} )

Note: Currently only supports OKX platform

// Retrieve active buying data
security('ttv:ethswapusdt:okcoinfutures','5m',buyVolume)

● Leverage Long/Short Ratio ( loanratio:${dbKey} )

Note: Currently only supports OKX platform spot

// Retrieve leverage long/short ratio data
security('loanratio:ethswapusdt:okcoinfutures','5m',ratios)

● Contract Basis ( basis:${dbKey} )

Note: Currently only supports certain trading pairs on OKX

// Retrieve the contract basis of ethusdt perpetual
security('basis:ethswapusdt:okcoinfutures', '5m', basis)

2. Different Data Support Different Expressions

security(symbol, period, expr)

Candlestick Type 

Supported Expressions

Expression Description

time

Second-level period time

open

Opening price

high

Highest price

low

Lowest price

close

Closing price

Note: Index expressions only support open, high, close, low

// Retrieve close data, ma data, and open data of the corresponding trading pair
security('ethswapusdt:okcoinfutures', '5m', close) ;
security('ethswapusdt:okcoinfutures', '5m', ma(close,10)) ;
security('ethswapusdt:okcoinfutures', '5m', open) ;

Interest

Supported Expressions

Expression Description

close

Open interest

// Retrieve open interest of ethusdt perpetual
security("interest:ethswapusdt:okcoinfutures", '5m', close)

Funding Rate

Supported Expressions

Expression Description

time

Second-level period time

fundingRate

Funding rate

estimatedRate

Next period predicted funding rate

// Retrieve the funding rate and next period predicted funding rate of ethusdt perpetual
security('fundrate:ethswapusdt:okcoinfutures', '5m', fundingRate)
security('fundrate:ethswapusdt:okcoinfutures', '5m', estimatedRate)

Long/Short Position Ratios

Supported Expressions

Expression Description

time

Second-level period time

ratios

Long/short position ratio

// Retrieve long/short position data of eth
security('lspr:ethswapusdt:okcoinfutures', '5m', time)
security('lspr:ethswapusdt:okcoinfutures', '5m', ratios)

Elite Holding

Supported Expressions

Expression Description

time

Second-level period time

buyAccount

Long account

buyInterest

Long holding

sellInterest

Short holding

// Retrieve the value of the contract elite trend indicator
security('elite:mkrswapusdt:binance', '', buyAccount)
// Retrieve the contract elite holding ratio indicator value
security('elite:mkrswapusdt:binance', '5m', buyInterest)
security('elite:mkrswapusdt:binance', '5m', sellInterest)

Contract Total Holding and Trading Volume

Supported Expressions

Expression Description

time

Second-level period time

volume

Total trading volume

// Retrieve contract holding data
security('oiav:ethswapusdt:okcoinfutures','5m',time)
security('oiav:ethswapusdt:okcoinfutures','5m',volume)

Active Buying and Selling

Supported Expressions

Expression Description

time

Second-level period time

buyVolume

Buying volume

sellVolume

Selling volume

// Retrieve active buying data
security('ttv:ethswapusdt:okcoinfutures','5m',buyVolume)
security('ttv:ethswapusdt:okcoinfutures','5m',sellVolume)

Leverage Long/Short Ratio

Supported Expressions

Expression Description

time

Second-level period time

ratios

Leverage long/short position ratio

// Retrieve leverage long/short ratio data
security('loanratio:ethswapusdt:okcoinfutures','5m',time)
security('loanratio:ethswapusdt:okcoinfutures','5m',ratios)

Contract Basis

Supported Expressions

Expression Description

time

Second-level period time

basis

Basis

// Retrieve data of ethusdt perpetual
security('basis:ethswapusdt:okcoinfutures', '5m', time)
security('basis:ethswapusdt:okcoinfutures', '5m', basis)

Related Reading:

AICoin Custom Indicators - Supported Periods of Multi-data Source Functions

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

Share To
APP

X

Telegram

Facebook

Reddit

CopyLink