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

CN
7 years ago

Function Related Description

Below is an example of the call statement for the win rate data of the indicator

ws = security("win:bitcoin:win_win_one", "", signal)

Parameter Description

Parameter

Description

"win:bitcoin:win_win_one"

Identifier of the win rate strategy, different strategy identifiers have different values, see specific examples below

""

Fixed value ""

signal

Fixed value for signal

Explanation of the value of the return value ws

Value

Description

0

Open long position for contract strategy / Buy for spot strategy

1

Close long position for contract strategy / Sell for spot strategy

2

Open short position for contract strategy / Not applicable for spot strategy

3

Close short position for contract strategy / Not applicable for spot strategy

Note: GONGYING system is a spot strategy; ZHISHENG series is a contract strategy

 

Additionally, the return value ws has a special nature. It is a one-time variable, meaning that when a signal is generated, it triggers a script execution once, and then the value of the variable will be reset. This means that if you use the return value ws for other calculations, unexpected situations may occur, as shown in the following script: ```html // @version=2 ws = security("win:bitcoin:win_win_one", "", signal) lentry = ws == 0 alertcondition(lentry, title="BTC GONGYING 1 Buy") ``` If you add this script as an alert and set it to trigger once at the close of a candle, it is very likely that this alert will not be triggered. As mentioned above, because ws is a one-time variable, the indicator win rate is most likely triggered during the generation of the candle, and after the trigger, the ws variable will be reset. By the time the candle closes, the ws variable will be "nan". **If you do not understand or have any questions about the above content, please consult customer service before trading to confirm that the system behavior meets your expectations, in order to ensure that you do not incur unexpected losses.** --- **BTC Win Rate Strategy** The following script is for demonstration purposes only and does not constitute investment advice. Please invest cautiously and manage risks carefully. **Example (GONGYING 1)** ```html // @version=2 ws = security("win:bitcoin:win_win_one", "", signal) // Only need to change the first parameter of the security function to change the strategy lentry = ws == 0 lexit = ws == 1 // Execute trading instructions // Spot sell exitLong(lexit, price="market", amount=1) // Spot buy enterLong(lentry, price="market", amount=1) ``` **GONGYING 1** ```html ws = security("win:bitcoin:win_win_one", "", signal) ``` **GONGYING 2** ```html ws = security("win:bitcoin:win_win_two", "", signal) ``` **GONGYING 3** ```html ws = security("win:bitcoin:win_win_three", "", signal) ``` **ZHISHENG 1** ```html ws = security("win:bitcoin:ai_win_one", "", signal) ``` **ZHISHENG 2** ```html ws = security("win:bitcoin:ai_win_two", "", signal) ``` **ZHISHENG 3** ```html ws = security("win:bitcoin:ai_win_three", "", signal) ``` --- **ETH Win Rate Strategy** The following script is for demonstration purposes only and does not constitute investment advice. Please invest cautiously and manage risks carefully. **Example (ZHISHENG 3)** ```html // @version=2 ws = security("win:ethereum:ai_win_three", "", signal) // Only need to change the first parameter of the security function to change the strategy lentry = ws == 0 lexit = ws == 1 sentry = ws == 2 sexit = ws == 3 // Execute trading instructions // Close long position for contract strategy / Spot sell exitLong(lexit, price="market", amount=1) // Close short position for contract strategy exitShort(sexit, price="market", amount=1) // Open long position for contract strategy / Spot buy enterLong(lentry, price="market", amount=1) // Open short position for contract strategy enterShort(sentry, price="market", amount=1) ``` **GONGYING 1** ```html ws = security("win:ethereum:win_win_one", "", signal) ``` **GONGYING 2** ```html ws = security("win:ethereum:win_win_two", "", signal) ``` **GONGYING 3** ```html ws = security("win:ethereum:win_win_three", "", signal) ``` **ZHISHENG 1** ```html ws = security("win:ethereum:ai_win_one", "", signal) ``` **ZHISHENG 2** ```html ws = security("win:ethereum:ai_win_two", "", signal) ``` **ZHISHENG 3** ```html ws = security("win:ethereum:ai_win_three", "", signal) ``` **Related Reading:** [AICoin Automated Live Trading - Quick Start](https://www.aicoin.app/article/372872.html) [AICoin Automated Live Trading - Real-life Signal Alert Examples](https://www.aicoin.app/article/372876.html) [AICoin Automated Live Trading - Real-life Examples of Custom Indicators](https://www.aicoin.app/article/372887.html) [AICoin Automated Live Trading - Handling Common Issues](https://www.aicoin.app/article/372890.html)

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

OKX:注册返20%
链接:https://www.okx.com/zh-hans/join/aicoin20
Ad
Share To
APP

X

Telegram

Facebook

Reddit

CopyLink