请求帮助!!!!
//@version=3
strategy("我的策略", shorttitle = "long stragegy", overlay = true)
Kumo_offset = input(26, title = "位移周期")
CK_offset = input(26, title = "延迟线位移周期")
Kumo_offset := Kumo_offset - 1
CK_offset := CK_offset + 1
four_h_l = security(tickerid, '240', close > Kumo_Top[Kumo_offset])
four_h_s= security(tickerid, '240', close < Kumo_Bottom[Kumo_offset])
但是,有一个错误
不能使用可变变量作为安全功能的参数!
答案 0 :(得分:1)
使用不同的证券请求Kumo_Top,Kumo_Bottom和交易品种的收盘价(如果需要):
//@version=3
strategy("我的策略", shorttitle = "long stragegy", overlay = true)
Kumo_offset = input(26, title = "位移周期")
CK_offset = input(26, title = "延迟线位移周期")
Kumo_offset := Kumo_offset - 1
CK_offset := CK_offset + 1
Kumo_Top = open - close / 2 // as an example
Kumo_Bottom = high - low * 4 // as an example
// top = close > Kumo_Top[Kumo_offset]
four_h_l = security(tickerid, '240', Kumo_Top)
four_h_s= security(tickerid, '240', Kumo_Bottom)
four_h_l_close = security(tickerid, '240', close) //if you need different close
plot(four_h_l_close[Kumo_offset] > four_h_l[Kumo_offset] ? 1 : 0, color=red)
plot(four_h_l_close[Kumo_offset] < four_h_s[Kumo_offset] ? 1 : 0, color=green)