Automated Live Trading - Real-time Signal Alert Sample

CN
7 years ago

Signal Alert Example

The following script is only a demonstration example of automated trading logic and does not constitute investment advice. Please invest cautiously and pay attention to risk control.

// @version=2
// Note that the identifier for the signal alert needs to be replaced with the identifier corresponding to your set signal alert
ws = security("signal:65337", "", signal)

// Golden Cross / Overbought / Bullish Divergence / Buy TD / Piercing Line / Three White Soldiers / Hammer / Morning Star / Bullish Engulfing / Rising Three Methods
b = ws == 0

// Death Cross / Oversold / Bearish Divergence / Sell TD / Dark Cloud Cover / Three Black Crows / Inverted Hammer / Evening Star / Bearish Engulfing / Falling Three Methods
s = ws == 1 

// Execute trading instructions

// Close long position / Sell spot
exitLong(s, price="market", amount=1)
// Close short position
exitShort(b, price="market", amount=1)
// Open long position / Buy spot
enterLong(b, price="market", amount=1)
// Open short position
enterShort(s, price="market", amount=1)

 

Related Explanation

Below is an example of the statement for calling signal alert data

ws = security("signal:65337", "", signal)

Parameter Description

Parameter

Description

"signal:65337"

Identifier for the signal alert. You can go to the signal alert list to obtain the identifier corresponding to your set record.

""

Fixed value is ""

signal

Fixed value is signal

Explanation of the values of the return value ws

Value

Description

0

Golden Cross / Oversold / Bullish Divergence / Buy TD / Piercing Line / Three White Soldiers / Hammer / Morning Star / Bullish Engulfing / Ascending Spiral

1

Death Cross / Overbought / Bearish Divergence / Sell TD / Dark Cloud Cover / Three Black Crows / Inverted Hammer / Evening Star / Bearish Engulfing / Descending Spiral

 

Obtaining the identifier for the signal alert

In the setting popup of the signal alert, in the operation column of the set signal alert, click the copy button to copy the identifier of the signal alert

Automated Real Trading - Example of Signal Alert_aicoin_Figure 1

 

Related Reading:

AICoin Automated Real Trading - Quick Start

AICoin Automated Real Trading - Example of Indicator Win Rate

AICoin Automated Real Trading - Example of Custom Indicator

AICoin Automated Real Trading - Handling Common Issues

 

 

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

欧易返20%,前100送AiCoin保温杯
链接:https://www.okx.com/zh-hans/join/aicoin20
Ad
Share To
APP

X

Telegram

Facebook

Reddit

CopyLink