此示例代码是为您构建的,因此您可以在 TradingView 上的第一个交易机器人中测试策略脚本。TradingView 机器人研究包括多头和空头头寸。
如果资产价格在前一个蜡烛期间上涨(收盘价高于开盘价),则此策略进入多头头寸,如果资产价格在前一个蜡烛期间下跌(收盘价低于开盘价),则退出多头头寸 开盘价)。 空头头寸的情况正好相反。 因此,当执行退出多头信号时,它将自动触发进入空头头寸。 此代码可应用于任何时间范围和任何资产。
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Wunderbit Trading (WBT)
//@version=4
strategy("Signal Tester", overlay=true)
///////////////// LONG //////////////////
entry_long = close>open
exit_long = open>close
///////////// SHORT //////////////
entry_short=open>close
exit_short=close>open
strategy.entry("long", strategy.long, when=entry_long, comment="Insert Enter Long Comment Here")
strategy.close("long", when=exit_long, comment="Insert Exit Long Comment Here")
strategy.entry("short", strategy.short, when=entry_short, comment="Insert Enter Short Comment Here")
strategy.close("short", when=exit_short, comment="Insert Exit Short Comment Here")
注意:
您需要订阅 TradingView Pro 才能在 Wunderbit 上接收链接通知。 请立即注册 TradingView。