
この戦略は,動態指数に基づく短期取引戦略である.動態指数であるマスインデックスを利用して,市場動向の転換点を認識し,短期取引機会を捉える.
この策略は,2つの異なるパラメータの指数移動平均EMAを使用して,価格の最高値と最低値の差を平坦化して,指標であるMass Indexを得る.Mass Index上の特定の値を通過すると空き;Mass Indexの下の特定の値を通過すると多めにする.
具体的には,まずは最高値と最低値の差 xPrice を計算する。それからxPrice の9周期と25周期のEMA を計算し,それぞれxEMAとxSmoothXAvg と命名する。次に,この2つのEMA の比値の和を計算して,Mass Index を得る。Mass Index がある値より大きい時は空し,ある値より小さい時は多する。
この戦略は,マス・インデックスの上下突破を利用してトレンドの転換点を判断し,短期取引を行う.市場の揺れが強くなるとマス・インデックスは上昇し,市場の揺れが弱くなるとマス・インデックスは低下する.その突破のレベルを監視することで,短期取引の機会を効果的に捉えることができる.
この戦略の利点は以下の通りです.
この戦略にはいくつかのリスクがあります.
この戦略は以下の点で最適化できます.
この戦略は,マス・インデックス指数に基づいて,より簡素な短期取引戦略を設計し,市場の転換点を効果的に識別して,正確に空白を多く行うことができます.この戦略の取引戦略とパラメータの設定は,シンプルで直感的で,容易に実施され,異なる市場環境に応じて調整して最適化され,強力な実用性があります.しかし,データ過適合と指標の失敗のリスクにも注意し,トレンド判断と損失対策を組み合わせて,市場の不確実性に対応する必要があります.
/*backtest
start: 2023-02-20 00:00:00
end: 2024-02-26 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 12/09/2017
// The Mass Index was designed to identify trend reversals by measuring
// the narrowing and widening of the range between the high and low prices.
// As this range widens, the Mass Index increases; as the range narrows
// the Mass Index decreases.
// The Mass Index was developed by Donald Dorsey.
//
// You can change long to short in the Input Settings
// WARNING:
// - For purpose educate only
// - This script to change bars colors.
////////////////////////////////////////////////////////////
strategy(title="MASS Index", shorttitle="MASS Index")
Length1 = input(9, minval=1)
Length2 = input(25, minval=1)
Trigger = input(26.5, step = 0.01)
reverse = input(false, title="Trade reverse")
hline(27, color=blue, linestyle=line, title = "Setup")
hline(Trigger, color=red, linestyle=line, title = "Trigger")
xPrice = high - low
xEMA = ema(xPrice, Length1)
xSmoothXAvg = ema(xEMA, Length1)
nRes = sum(iff(xSmoothXAvg != 0, xEMA / xSmoothXAvg, 0), Length2)
pos = iff(nRes > Trigger, -1,
iff(nRes < Trigger, 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=red, title="MASS Index")