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

时间:2020-05-29 03:17:36

标签: alert pine-script algorithmic-trading

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

1 个答案:

答案 0 :(得分:0)

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