由高价和低价移动平均线组成的通道。
回测测试
/*backtest start: 2021-11-01 00:00:00 end: 2022-05-09 23:59:00 period: 5m basePeriod: 1m exchanges: [{"eid":"Futures_CTP","currency":"FUTURES"}] args: [["ContractType","rb2210",360008]] */ //@version=5 indicator(title="MAHL Band", overlay=true, timeframe="", timeframe_gaps=true) malen = input.int(3, "MA周期", minval=1) mahv = ta.sma(high, malen) malv = ta.sma(low, malen) mamv = (mahv + malv) / 2 mah = plot(mahv, color = #FF6D00, style = plot.style_line) mal = plot(malv, color = #43A047) mam = plot(mamv, color = color.blue) upperv = ta.highest(mahv, 60) lowerv = ta.lowest(malv, 60) middlev = (upperv + lowerv) / 2 upper = plot(upperv, color = color.red, linewidth = 2) lower = plot(lowerv, color = color.green, linewidth = 2) middle = plot(middlev, color = color.yellow, linewidth = 2) [diplus, diminus, adx] = ta.dmi(17, 14) up = (open < (malv - low / 3 + open / 3)) and (diplus[1] > diminus[1]) and mamv[1] > mamv[2] down = (open > (mahv - high / 3 + open / 3)) and (diplus[1] < diminus[1]) and mamv[1] < mamv[2] plotshape(up, style=shape.arrowup, location=location.belowbar, color=color.red) plotshape(down, style=shape.arrowdown, location=location.abovebar, color=color.green) if up strategy.entry("Enter Long", strategy.long) else if down strategy.entry("Enter Short", strategy.short)template: strategy.tpl:40:21: executing "strategy.tpl" at <.api.GetStrategyListByName>: wrong number of args for GetStrategyListByName: want 7 got 6