モメンタムと標準偏差に基づく金取引戦略


作成日: 2024-02-20 16:27:18 最終変更日: 2024-02-20 16:27:18
コピー: 0 クリック数: 819
1
フォロー
1617
フォロワー

モメンタムと標準偏差に基づく金取引戦略

概要

この戦略は,21日指数移動平均に対する黄金の価格の偏差を計算し,標準差と組み合わせて,市場の過剰買いと過剰売り状況を判断し,偏差が一定標準差に達したときに,トレンド追跡戦略をとり,同時に,リスク制御のためのストップ・メカニズムを設定する.

戦略原則

  1. 21日指数移動平均を中央軸として計算します.
  2. 移動平均から黄金の偏差を計算する
  3. 偏差値を標準化してZスコアに変換する
  4. Z-スコアが0.5なら多めに,Z-スコアが-0.5なら空いて
  5. Z-Scoreが0.5/-0.5の底値に戻ると平仓
  6. Z-Scoreが 33 以上の場合,停止します.

優位分析

これは,価格動力と標準差に基づいて市場を過買過売するトレンド追跡戦略であり,以下の利点があります.

  1. 移動平均を動的なサポート/レジスタンスとして使用して,トレンドを把握します.
  2. 標準差とZスコアは,過剰買いと過剰売りを判断し,偽の信号を低減するのに役立ちます.
  3. インデックス移動平均を使用し,最近の価格により影響し,より敏感です.
  4. Z-Scoreは価格の偏差を標準化し,判断の規則を統一する.
  5. リスクの管理を目的とした,時効的な止損策を設定する.

リスク分析

この戦略にはいくつかのリスクがあります.

  1. 移動平均は,価格がはっきりと高騰したり突破したりしたときに誤ったシグナルを生成する基準として使用されます.
  2. 標準差とZスコアの判断値は適切に設定され,大きすぎたり小さすぎたりすると,戦略のパフォーマンスに影響する
  3. ストップダメージ設定が不適切で,過剰に激しくなり,不必要な損失を招く可能性があります.
  4. 突発的な事件が価格の大幅な波動を引き起こし,トレンドの機会を逃すストップを誘発する

解決策は

  1. 移動平均のパラメータを合理的に設定し,主要トレンドを識別する
  2. 標準差の最適化パラメータを測定し,最適の値を見つけます.
  3. トレーリングストップの合理性
  4. 事件の後に市場状況を時宜に再評価し,戦略パラメータを調整する

最適化の方向

この戦略は以下の点で最適化できます.

  1. ATRのような波動率インディクタを使用して,単純な標準差の代わりに,リスクアペティットをよりよく判断する.
  2. 異なる種類の移動平均を試し,より適切な中央軸の指標を探します.
  3. 移動平均のパラメータを最適化,最適な平均線周期をIdentify
  4. Z-Scoreの値を最適化して,最適戦略のパフォーマンスパラメータを探します.
  5. 波動率に基づく止損方法を増やして,止損を賢く合理的にします.

要約する

この戦略は,全体として,基本合理的なトレンド追跡戦略である。主要トレンドの方向を判断するために移動平均を使用すると同時に,価格偏差の標準化処理により,市場の過買過売状況を明確に判断し,取引信号を生成することができる。合理的な止損方法を設定すると,戦略は,収益性を保証しながら同時にリスクを制御することができる。パラメータをさらに最適化するとともに,より多くの条件判断を加えることで,戦略をより安定的に信頼でき,強力な応用価値を持つことができる。

ストラテジーソースコード
/*backtest
start: 2024-01-20 00:00:00
end: 2024-02-19 00:00:00
period: 4h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("GC Momentum Strategy with Stoploss and Limits", overlay=true)

// Input for the length of the EMA
ema_length = input.int(21, title="EMA Length", minval=1)

// Exponential function parameters
steepness = 2

// Calculate the EMA
ema = ta.ema(close, ema_length)

// Calculate the deviation of the close price from the EMA
deviation = close - ema

// Calculate the standard deviation of the deviation
std_dev = ta.stdev(deviation, ema_length)

// Calculate the Z-score
z_score = deviation / std_dev

// Long entry condition if Z-score crosses +0.5 and is below 3 standard deviations
long_condition = ta.crossover(z_score, 0.5)

// Short entry condition if Z-score crosses -0.5 and is above -3 standard deviations
short_condition = ta.crossunder(z_score, -0.5)

// Exit long position if Z-score converges below 0.5 from top
exit_long_condition = ta.crossunder(z_score, 0.5)

// Exit short position if Z-score converges above -0.5 from below
exit_short_condition = ta.crossover(z_score, -0.5)

// Stop loss condition if Z-score crosses above 3 or below -3
stop_loss_long = ta.crossover(z_score, 3)
stop_loss_short = ta.crossunder(z_score, -3)

// Enter and exit positions based on conditions
if (long_condition)
    strategy.entry("Long", strategy.long)
if (short_condition)
    strategy.entry("Short", strategy.short)
if (exit_long_condition)
    strategy.close("Long")
if (exit_short_condition)
    strategy.close("Short")
if (stop_loss_long)
    strategy.close("Long")
if (stop_loss_short)
    strategy.close("Short")

// Plot the Z-score on the chart
plot(z_score, title="Z-score", color=color.blue, linewidth=2)

// Optional: Plot zero lines for reference
hline(0.5, "Upper Threshold", color=color.red)
hline(-0.5, "Lower Threshold", color=color.green)