聚合动量指标策略运用聚合动量指标来判断市场的资金流向,以捕捉市场的趋势变化。该策略结合快速移动平均线和慢速移动平均线,形成指标曲线,曲线上穿趋势买入,曲线下穿趋势卖出,以追踪市场趋势。
该策略基于聚合动量指标,该指标改进了威廉指标,用当日最高价和最低价的平均价代替开盘价,以解决开盘价缺失的问题。指标公式为:
聚合动量线 = 快速聚合动量指数移动平均线 - 慢速聚合动量指数移动平均线
其中,聚合动量指数计算公式为:
聚合动量指数 = (收盘价 - 开盘价) / (最高价 - 最低价) * 成交量
由于开盘价缺失,这里采用:
聚合动量指数 = (收盘价 - (最高价+最低价)/2) / (最高价 - 最低价) * 成交量
指标以快速移动平均线和慢速移动平均线的差值为聚合动量线。当快速线上穿慢速线时为买入信号,下穿为卖出信号。
具体操作为:
该策略具有以下优势:
该策略也存在一些风险:
可通过参数优化、结合其他指标等方法来控制风险。
该策略可以考虑以下几个方向进行优化:
聚合动量指标策略整体来说较为稳定和可靠,通过参数调整可平衡收益和风险。加入过滤条件和止损可进一步提高策略稳定性。该策略适合追踪趋势型市场,可通过定制化优化得到满意的策略效果。
/*backtest start: 2023-09-11 00:00:00 end: 2023-10-11 00:00:00 period: 3h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=2 //////////////////////////////////////////////////////////// // Copyright by HPotter v1.0 18/09/2017 // Indicator plots Money Flow Indicator (Chaikin). This indicator looks // to improve on Larry William's Accumulation Distribution formula that // compared the closing price with the opening price. In the early 1970's, // opening prices for stocks stopped being transmitted by the exchanges. // This made it difficult to calculate Williams' formula. The Chaikin // Oscillator uses the average price of the bar calculated as follows // (High + Low) /2 instead of the Open. // The indicator subtracts a 10 period exponential moving average of the // AccumDist function from a 3 period exponential moving average of the // AccumDist function. // // You can change long to short in the Input Settings // WARNING: // - For purpose educate only // - This script to change bars colors. //////////////////////////////////////////////////////////// strategy(title="Money Flow Indicator (Chaikin Oscillator)", shorttitle="MFI") Fast = input(3, minval=1) Slow = input(10, minval=1) reverse = input(false, title="Trade reverse") hline(0, color=gray, linestyle=hline.style_dashed) lenMax = max(Fast, Slow) lenMin = min(Fast, Slow) xDiv = (high - low) * volume SumMax = sum(iff(xDiv > 0, (close - open) / (high - low) * volume , 0) , lenMax) SumMin = sum(iff(xDiv > 0, (close - open) / (high - low) * volume , 0) , lenMin) emaMax = ema(SumMax, lenMax) emaMin = ema(SumMin, lenMin) nRes = emaMax - emaMin pos = iff(nRes > 0, 1, iff(nRes < 0, -1, nz(pos[1], 0))) possig = iff(reverse and pos == 1, -1, iff(reverse and pos == -1, 1, pos)) if (possig == 1) strategy.entry("Long", strategy.long) if (possig == -1) strategy.entry("Short", strategy.short) barcolor(possig == -1 ? red: possig == 1 ? green : blue ) plot(nRes, color=blue, title="RMI")