
移動平均線逆引き戦略は,株価の移動平均線の交差を追跡し,金叉が発生した時に引き下げの機会があるかどうかを判断し,もしあるなら,逆操作を行う定量取引戦略である.この戦略は,フィボナッチ逆引きを活用して,入場点とストップ・ストップ・ストップを設定し,短期価格の引き下げを捕捉する.
この戦略は,主に2つの移動平均である14日EMAと56日SMAに基づいています. 14日EMAが56日SMAを下から通過すると,買入シグナルが生じます. その後,コードは20日後に低値をサポートとして見つけ,通過点のクローズ価格と組み合わせてフィボナッチ回帰線を描画し,1.272倍回帰線をエントリーとして,0.618倍回帰線をエクジットとして描きます.
戦略は以下のステップで構成されています.
これは,戦略の主要なプロセスであり,その原理である. 短期的な反転が起こると,この戦略は,そのような機会を捕捉して利益を得る.
移動平均の逆引き策には以下の利点があります.
全体として,この戦略は短線反転取引に適しており,市場状況が一定に逆転したときにこのような機会を捉えることができる.戦略の実施も比較的簡単で直接である.
移動平均を引く戦略には利点がありますが,注意すべきリスクもあります.
上記のリスクに対して,我々は,より短いストップ・タイムを設定し,単一の損失を厳格に制御し,引き戻しラインの区間範囲を最適化し,合理的な目標利益を設定して,部分的なリスクを回避することができる.
この移動平均の逆引方策には多くの改善の余地があり,以下のような部分から改善が可能です.
移動平均の周期長さ,回帰日数,回帰線倍数など,異なるパラメータ設定をテストして,最適なパラメータを見つける.
リスク管理の改善のため,多重または移動的な停止を適用できる損失抑制機構の増強
他の指標Filterと組み合わせると,不適切な市場環境で取引を避ける.
資金管理の最適化,合理的なポジションサイズとリスクの設定
この戦略は,パラメータをテストして最適化することで,さらに改善され,より安定した取引パフォーマンスを得ることができます.
移動平均線回引戦略は,非常に実用的なショートライン取引戦略である.それは,価格が短期間に出現する逆転の機会を捉え,事前に設定されたエントリーポイントとストップポイントを通じて取引することができる.戦略のアイデアは明確でシンプルで,容易に理解し,実行することができる.同時に,パラメータ最適化,リスク管理などの手段によってさらに完善する必要がある一定の取引リスクもある.全体的に,これは深入な研究と応用に値する量化戦略である.
/*backtest
start: 2022-12-12 00:00:00
end: 2023-12-18 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
strategy("MAC Pullback", overlay=true)
// Setting up timeperiod for testing
startPeriodYear = input(2014, "Backtest Start Year")
startPeriodMonth = input(1, "Backtest Start Month")
startPeriodDay = input(2, "Backtest Start Day")
testPeriodStart = timestamp(startPeriodYear, startPeriodMonth, startPeriodDay, 0, 0)
stopPeriodYear = input(2035, "Backtest Stop Year")
stopPeriodMonth = input(12, "Backtest Stop Month")
stopPeriodDay = input(30, "Backtest Stop Day")
testPeriodStop = timestamp(stopPeriodYear, stopPeriodMonth, stopPeriodDay, 0, 0)
// Moving Averages
ema14 = ema(close, 14)
ema28 = ema(close, 28)
sma56 = sma(close, 56)
// Plot
plot(ema14, title="ema14", linewidth=2, color=green)
plot(ema28, title="ema28", linewidth=2, color=red)
plot(sma56, title="sma56", linewidth=3, color=blue)
// Strategy
goLong = cross(ema14, sma56) and ema14 > ema28
goShort = cross(ema14, sma56) and ema14 < ema28
// Locate Swing Lows
leftBars = input(20)
rightBars=input(20)
swinglow = pivotlow(close, leftBars, rightBars)
plot(swinglow, style=cross, linewidth=8, color=#00FF00, offset=-rightBars)
if goLong == true and time >= testPeriodStart and time <= testPeriodStop
// We try to make sure that we're catching the first Pullback after the crossover
if ema14[12] < sma56[12]
pivotpoint = lowest(40)[0] //lowest value of the month as our swing low
// We calculate a Fib 1.272 extension (from the previous swing low to
// the crossover long entry's open) and use this as our entry target to short the Pullback
extensiontarget = ((close[1] - pivotpoint) * 1.27) + pivotpoint
shorttarget = ((close[1] - pivotpoint) * 0.618) + pivotpoint
strategy.order("Pullback", strategy.short, 5.0, limit=extensiontarget)
// I would like to use a trailing stop but for know we just hope to get
// filled if the pullback reaches all the way down to the 0.618.
// We also place a tight stop loss since we trying to short an uptrend
strategy.exit("Pullback Exit", "Pullback", limit=shorttarget, loss=400)