我想将TradingView松树脚本“价格渠道策略”转换为研究。有人可以帮忙吗?
代码如下:
//@version=4
strategy("ChannelBreakOutStrategy", overlay=true)
length = input(title="Length", type=input.integer, minval=1, maxval=1000, defval=5)
upBound = highest(high, length)
downBound = lowest(low, length)
if (not na(close[length]))
strategy.entry("ChBrkLE", strategy.long, stop=upBound + syminfo.mintick, comment="ChBrkLE")
strategy.entry("ChBrkSE", strategy.short, stop=downBound - syminfo.mintick, comment="ChBrkSE")
strategy.exit("long_tsl", "ChBrkLE", trail_points = 4000, trail_offset = 1500)
strategy.exit("short_tsl", "ChBrkSE", trail_points = 4000, trail_offset = 1500)
答案 0 :(得分:0)
主要,您必须在代码顶部将单词strategy
更改为study
。
您还必须删除strategy.entry/exit
调用,因为study
中不允许使用这些调用。
有关更多信息,请参见此处:https://marketscripters.com/pine-script-strategy-vs-study/