该策略结合了威廉双指数移动平均线和一目均衡图两个技术指标,以发挥各自的优势,提高交易决策的准确性。其中,威廉双指数移动平均线可充分反映价格变化趋势,一目均衡图则可提前判断趋势反转。
威廉双指数移动平均线包含快线和慢线。快线计算公式为:2∗(n/2周期加权移动平均线),慢线计算公式为:n周期加权移动平均线。当快线从下方向上突破慢线时,为买入信号;从上方向下跌破时,为卖出信号。
一目均衡图包含换手线、基准线、先行线及云图四个组成部分。其中,换手线和基准线的黄金交叉为买入信号,死亡交叉为卖出信号。价格突破云图上沿为买入信号,下跌破云图下沿为卖出信号。
该策略结合两种指标优势,第一重判定为威廉指标发出信号,第二重判定为一目均衡图指标确认,可有效过滤假信号,提高决策准确性。
该策略充分利用威廉指标判断趋势方向和一目均衡图提前看反转的优势,可显著提升交易决策的准确性。通过参数调整和组合其他指标,可持续优化策略,使之更适应市场的变化。
/*backtest start: 2024-01-01 00:00:00 end: 2024-01-31 23:59:59 period: 1h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=3 strategy("Hull MA-X + Ichimoku Kinko Hyo", shorttitle="Hi", overlay=true, default_qty_type=strategy.percent_of_equity, max_bars_back=1000, default_qty_value=100, calc_on_order_fills= true, calc_on_every_tick=true, pyramiding=0) keh=input(title="Double HullMA",defval=12, minval=1) n2ma=2*wma(close,round(keh/2)) nma=wma(close,keh) diff=n2ma-nma sqn=round(sqrt(keh)) n2ma1=2*wma(close[1],round(keh/2)) nma1=wma(close[1],keh) diff1=n2ma1-nma1 sqn1=round(sqrt(keh)) n1=wma(diff,sqn) n2=wma(diff1,sqn) b=n1>n2?lime:red c=n1>n2?green:red d=n1>n2?red:green TenkanSenPeriods = input(9, minval=1, title="Tenkan Sen Periods") KijunSenPeriods = input(24, minval=1, title="Kijun Sen Periods") SenkouSpanBPeriods = input(51, minval=1, title="Senkou Span B Periods") displacement = input(24, minval=1, title="Displacement") donchian(len) => avg(lowest(len), highest(len)) TenkanSen = donchian(TenkanSenPeriods) KijunSen = donchian(KijunSenPeriods) SenkouSpanA = avg(TenkanSen, KijunSen) SenkouSpanB = donchian(SenkouSpanBPeriods) SenkouSpanH = max(SenkouSpanA[displacement - 1], SenkouSpanB[displacement - 1]) SenkouSpanL = min(SenkouSpanA[displacement - 1], SenkouSpanB[displacement - 1]) ChikouSpan = close[displacement-1] Hullfast=plot(n1,color=c) Hullslow=plot(n2,color=c) plot(cross(n1, n2) ? n1:na, style = circles, color=b, linewidth = 4) plot(cross(n1, n2) ? n1:na, style = line, color=d, linewidth = 3) plot(TenkanSen, color=blue, title="Tenkan Sen", linewidth = 2) plot(KijunSen, color=maroon, title="Kijun Sen", linewidth = 3) plot(close, offset = -displacement, color=orange, title="Chikou Span", linewidth = 2) sa=plot (SenkouSpanA, offset = displacement, color=green, title="Senkou Span A", linewidth = 2) sb=plot (SenkouSpanB, offset = displacement, color=red, title="Senkou Span B", linewidth = 3) fill(sa, sb, color = SenkouSpanA > SenkouSpanB ? green : red) longCondition = n1>n2 and close>n2 and close>ChikouSpan and close>SenkouSpanH and (TenkanSen>KijunSen or close>KijunSen) if (longCondition) strategy.entry("Long",strategy.long) shortCondition = n1<n2 and close<n2 and close<ChikouSpan and close<SenkouSpanL and (TenkanSen<KijunSen or close<KijunSen) if (shortCondition) strategy.entry("Short",strategy.short) closelong = n1<n2 and close<n2 and (TenkanSen<KijunSen or close<TenkanSen or close<KijunSen or close<SenkouSpanL) if (closelong) strategy.close("Long") closeshort = n1>n2 and close>n2 and (TenkanSen>KijunSen or close>TenkanSen or close>KijunSen or close>SenkouSpanH) if (closeshort) strategy.close("Short")