標準偏差と移動平均に基づくエルダーのパワーインデックス定量取引戦略

EFI ATR EMA SMA SD
作成日: 2024-11-28 17:08:24 最終変更日: 2024-11-28 17:08:24
コピー: 1 クリック数: 498
1
フォロー
1617
フォロワー

標準偏差と移動平均に基づくエルダーのパワーインデックス定量取引戦略

概要

この戦略は,エルダーズ・フォース・インデックス (EFI) に基づく量化取引システムで,標準差と移動平均を組み合わせて信号判断を行い,ATRを使用して動的にストップ・ストップの位置を調整する.この戦略は,高速と遅いEFI指標を計算し,それを標準化した後,交差信号判断を行うことで,完全な取引システムを実現する.この戦略は,ダイナミックなストップとストップ・ストップを追跡するメカニズムを採用し,リスクを効果的に制御しながら,より大きな利益を追求する.

戦略原則

戦略は以下の要素を中心に構築されています.

  1. 2つの異なる周期 ((13と50) を用いたEFI指標で,高速と遅速力の指数を計算する
  2. 2周期EFIの標準差均一化処理により,信号がより統計的に有意になる
  3. 高速および低速EFIが同時に上記の標準差を突破すると,多信号がトリガーされる
  4. 低速EFIと高速EFIが標準差を突破すると空白信号が発せられます.
  5. ATRを使用して動的にストップポジションを設定し,価格の変化に合わせてストップポジションを調整します.
  6. ATRベースのトラッキング・ストップ・メカニズムを使用して,収益を保護しながら,収益を増加させることができます.

戦略的優位性

  1. 信号システムは,動量と波動率の特性を組み合わせ,取引の信頼性を高めます.
  2. 標準差統一処理を使用して,信号を統計的に有意にし,偽信号を減少させる
  3. ダイナミック・ストップ・メカニズムは,リスクを効果的にコントロールし,大幅な撤退を回避します.
  4. トラッキング・ストップ・メカニズムは既得利益を保護し,利益の拡大を可能にします.
  5. 戦略の論理が明確で,パラメータが調整可能で,異なる市場向けに最適化できます.

戦略リスク

  1. 市場が激しく波動すると,偽信号が発生し,追加のフィルタリングメカニズムが必要になる
  2. パラメータの選択が過度に敏感である場合,取引が過度になり,取引コストが増加する可能性があります.
  3. トレンド転換点での遅延が戦略のパフォーマンスに影響する可能性がある
  4. ストップ・ローズ・ポジションの不適切な設定は,早めに出場したり,過度の損失を被る可能性があります.
  5. 取引コストが戦略のリターンに与える影響を考慮する必要がある

戦略最適化の方向性

  1. 市場環境判断のメカニズムを追加し,異なる市場状態で異なるパラメータ設定を使用する
  2. 交差量フィルターの導入により,信号の信頼性が向上
  3. ストップ・ストップパラメータを最適化して,市場の波動に適した状態にする
  4. トレンドフィルターを追加し,波動の多い市場での取引を避ける
  5. タイムフィルターを加え,不利な時間帯での取引を避ける

要約する

この戦略は,EFI指標,標準差,ATRを組み合わせて,完全な取引システムを構築する.戦略の優点は,信号システムの信頼性が高く,リスク管理が合理的であることにあるが,異なる市場環境に対して最適化が必要である.市場環境判断,取引量フィルターなどのメカニズムを追加することによって,戦略の安定性と収益性をさらに向上させることができる.全体的に,この戦略は,優れた実用価値を持つ良好な量化取引枠組みを提供する.

ストラテジーソースコード
/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-27 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("Elder's Force Index Strategy with ATR-Based SL and TP", overlay=true)

// Input parameters for fast and long EFI
efi_fast_length = input.int(13, "Fast EFI Length", minval=1)
efi_long_length = input.int(50, "Long EFI Length", minval=1)
stdev_length = input.int(50, "Standard Deviation Length", minval=2, maxval=300)
numdev = input.float(2, "Number of Deviations", minval=1, maxval=20, step=0.1)
atr_length = input.int(14, "ATR Length", minval=1)
atr_multiplier_sl = input.float(1.5, "ATR Multiplier for Stop Loss", step=0.1)
trailing_tp_multiplier = input.float(0.5, "Multiplier for Trailing Take Profit", step=0.1)

// Elder's Force Index Calculation for Fast and Long EFI
efi_fast = ta.ema((close - close[1]) * volume, efi_fast_length)
efi_long = ta.ema((close - close[1]) * volume, efi_long_length)

// Calculate Standard Deviation for Fast EFI
efi_fast_average = ta.sma(efi_fast, stdev_length)
efi_fast_stdev = ta.stdev(efi_fast, stdev_length)
efi_fast_diff = efi_fast - efi_fast_average
efi_fast_result = efi_fast_diff / efi_fast_stdev

// Calculate Standard Deviation for Long EFI
efi_long_average = ta.sma(efi_long, stdev_length)
efi_long_stdev = ta.stdev(efi_long, stdev_length)
efi_long_diff = efi_long - efi_long_average
efi_long_result = efi_long_diff / efi_long_stdev

// Define upper and lower standard deviation levels
upper_sd = numdev
lower_sd = -numdev

// Define entry conditions based on crossing upper and lower standard deviations
long_condition = efi_fast_result > upper_sd and efi_long_result > upper_sd
short_condition = efi_fast_result < lower_sd and efi_long_result < lower_sd

// Check if a position is already open
is_position_open = strategy.position_size != 0

// Calculate ATR for stop loss and take profit
atr = ta.atr(atr_length)

// Initialize stop loss and take profit variables
var float stop_loss = na
var float take_profit = na

// Execute trades based on conditions, ensuring only one trade at a time
if (long_condition and not is_position_open)
    strategy.entry("Long", strategy.long)
    stop_loss := close - atr * atr_multiplier_sl  // Set initial stop loss based on ATR
    take_profit := close + atr * trailing_tp_multiplier  // Set initial take profit based on ATR

if (short_condition and not is_position_open)
    strategy.entry("Short", strategy.short)
    stop_loss := close + atr * atr_multiplier_sl  // Set initial stop loss based on ATR
    take_profit := close - atr * trailing_tp_multiplier  // Set initial take profit based on ATR

// Update exit conditions
if (is_position_open)
    // Update stop loss for trailing
    if (strategy.position_size > 0)  // For long positions
        stop_loss := math.max(stop_loss, close - atr * atr_multiplier_sl)
        
        // Adjust take profit based on price movement
        take_profit := math.max(take_profit, close + atr * trailing_tp_multiplier)

    else if (strategy.position_size < 0)  // For short positions
        stop_loss := math.min(stop_loss, close + atr * atr_multiplier_sl)
        
        // Adjust take profit based on price movement
        take_profit := math.min(take_profit, close - atr * trailing_tp_multiplier)

    // Set exit conditions
    strategy.exit("Long Exit", from_entry="Long", stop=stop_loss, limit=take_profit)
    strategy.exit("Short Exit", from_entry="Short", stop=stop_loss, limit=take_profit)