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



我想转换一个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)

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

最新更新