在松树脚本策略中创建警报

问题描述 投票:0回答:1

我想转换TradingView松树脚本“价格通道策略”以在触发买,卖或TSL信号时创建警报。有人可以帮忙吗?

代码如下:

//@version=4
strategy("Price Channel Strategy", overlay=true)
length = input(20)
hh = highest(high, length)
ll = lowest(low, length)
if (not na(close[length]))
    strategy.entry("PChLE", strategy.long, comment="PChLE", stop=hh)
    strategy.entry("PChSE", strategy.short, comment="PChSE", stop=ll)
strategy.exit("long tsl","PChLE", trail_points = 5000, trail_offset=2000)
strategy.exit("short tsl","PChSE", trail_points = 5000, trail_offset=2000)
//plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)
alert pine-script algorithmic-trading
1个回答
0
投票

我不认为自定义警报的alertcondition可以在strategy脚本中使用。您可能必须将strategy转换为study才能创建自定义警报。

© www.soinside.com 2019 - 2024. All rights reserved.