
この戦略は,Zスコア (Z-Score) の統計的方法,相対的に強い指標 (RSI) と超トレンド (Supertrend) の指標を組み合わせた定量取引システムである.この戦略は,価格の統計的偏差を監視し,動量指標とトレンド確認を組み合わせて,市場で高い確率の機会を探して取引する.この戦略は,市場の超買超売の機会を捕捉するだけでなく,偽の信号をフィルターしてトレンドを確認し,多空双方向取引を実現する.
戦略の核心的な論理は,3つの主要な技術指標の協同作用に基づいています:第一に,現在の価格が歴史的な平均値から偏っている程度を測定するために,75サイクルの移動平均と標準差を使用した価格のZスコアを計算します.Zスコアが1.1以上または-1.1未満であるときは,価格が有意な統計偏差を示します.次に,RSI指標を動量として導入し,ポジションを開く際にRSIが方向に合致する必要があることを確認します (多頭時RSI>60,空頭時RSI<40).最後に,超トレンド指標をトレンドフィルターとして使用します.
これは,統計的方法と技術的分析を統合した定量化取引戦略で,複数のシグナル確認によって取引の信頼性を向上させる.戦略の核心的な優位性は,その客観的な数学モデルと完善したリスク制御機構にあるが,同時に,パラメータ最適化と市場適応性の問題にも注意する必要がある.提案された最適化方向によって,戦略には,特に市場環境とリスク制御に動的に適応する点で,さらに向上する余地がある.この戦略は,波動性が大きく,明らかな傾向のある市場での使用に適しており,安定した収益量を追求するトレーダーにとって考慮すべき選択肢である.
/*backtest
start: 2024-01-01 00:00:00
end: 2024-11-26 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Z-Score Long and Short Strategy with Supertrend", overlay=true)
// Inputs for Z-Score
len = input.int(75, "Z-Score Lookback Length")
z_long_threshold = 1.1 // Threshold for Z-Score to open long
z_short_threshold = -1.1 // Threshold for Z-Score to open short
// Z-Score Calculation
z = (close - ta.sma(close, len)) / ta.stdev(close, len)
// Calculate Driver RSI
driver_rsi_length = input.int(14, "Driver RSI Length") // Input for RSI Length
driver_rsi = ta.rsi(close, driver_rsi_length) // Calculate the RSI
// Supertrend Parameters
atrPeriod = input.int(11, "ATR Length", minval=1)
factor = input.float(2.0, "Factor", minval=0.01, step=0.01)
// Supertrend Calculation
[supertrend, direction] = ta.supertrend(factor, atrPeriod)
// Conditions for Long and Short based on Z-Score
z_exceeds_long = z >= z_long_threshold and driver_rsi > 60
z_exceeds_short = z <= z_short_threshold and driver_rsi < 40
// Entry Conditions
if (z_exceeds_long and direction < 0) // Enter Long if Z-Score exceeds threshold and Supertrend is down
strategy.entry("Long", strategy.long)
label.new(bar_index, low, text="Open Long", style=label.style_label_up, color=color.green, textcolor=color.white, size=size.small)
alert("Open Long", alert.freq_once_per_bar) // Alert for Long entry
if (z_exceeds_short and direction > 0) // Enter Short if Z-Score exceeds threshold and Supertrend is up
strategy.entry("Short", strategy.short)
label.new(bar_index, high, text="Open Short", style=label.style_label_down, color=color.red, textcolor=color.white, size=size.small)
alert("Open Short", alert.freq_once_per_bar) // Alert for Short entry
// Plot Supertrend
upTrend = plot(direction < 0 ? supertrend : na, "Up Trend", color=color.green, style=plot.style_linebr)
downTrend = plot(direction > 0 ? supertrend : na, "Down Trend", color=color.red, style=plot.style_linebr)
fill(upTrend, downTrend, color=color.new(color.green, 90), fillgaps=false)
// Alert conditions for Supertrend changes (optional)
alertcondition(direction[1] > direction, title='Downtrend to Uptrend', message='The Supertrend value switched from Downtrend to Uptrend')
alertcondition(direction[1] < direction, title='Uptrend to Downtrend', message='The Supertrend value switched from Uptrend to Downtrend')