集積動量指標戦略は,市場のトレンドの変化を捉えるために市場の資金流動を判断するために集積動量指標を使用する.この戦略は,急速な移動平均と遅い移動平均を組み合わせて,指標曲線を形成し,曲線の上を走行傾向で買い,曲線下を走行傾向で売り,市場傾向を追跡する.
この策略は,集積動量指数に基づいている.この指数は,ウィリアム指数を改良し,その日の最高価格と最低価格の平均値で開盤価格を代入して開盤価格の欠落を解決する.指数の式は:
聚合運動量線 = 急速聚合運動量指数移動平均 - ゆっくりとした聚合運動量指数移動平均
その中で,聚合動量指数の計算式は:
聚合動量指数 = (閉盘価格 - 開盤価格) / (最高価格 - 最低価格) *取引量
オープン価格が存在しないため,以下のように記述しています.
聚合動量指数 = (閉盘価格 - (最高価格 + 最低価格) /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")