转换松树文字策略进行研究

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

我想将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)
alert pine-script algorithmic-trading
1个回答
0
投票

主要是,您必须在代码顶部将单词strategy更改为study。您还必须删除strategy.entry/exit调用,因为study中不允许使用这些调用。有关更多信息,请参见此处:https://marketscripters.com/pine-script-strategy-vs-study/

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