インテリジェントな多次元適応トレンド取引システム

FVG RSI MACD VWAP EMA ATR supertrend
作成日: 2025-02-21 11:37:36 最終変更日: 2025-02-21 11:37:36
コピー: 0 クリック数: 483
2
フォロー
319
フォロワー

インテリジェントな多次元適応トレンド取引システム インテリジェントな多次元適応トレンド取引システム

概要

この戦略は,複数の技術指標を融合したスマート取引システムで,Fair Value Gap (FVG),トレンドシグナル,価格行動の総合的な分析によって市場機会を識別します. このシステムは,トレンド追跡と波段取引特性を組み合わせた二重戦略機構を採用し,ダイナミックなポジション管理と多次元退出機構によって取引パフォーマンスを最適化します. この戦略は,リスク管理に特に焦点を当て,波動率フィルタリングと取引量確認によって信号品質を向上します.

戦略原則

戦略の核心的な論理は以下の側面に基づいています.

  1. FVGのギャップ識別 - 価格跳躍のギャップの大きさを計算して潜在的な取引機会を探す
  2. トレンド確認システム - 200日平均線,スーパートレンド指数,MACDと組み合わせて市場のトレンドを確認する
  3. スマートファンド確認 - RSIの超買い,超売れ,取引量異常,価格行動パターンを取引誘発条件として使用する
  4. ダイナミックなポジション管理 - ポジションサイズをATRに基づく変動率で調整し,リスクエッジの一貫性を確保する
  5. 多層の退出メカニズム - トラッキングストップとターゲットストップの組み合わせで取引退出を管理する

戦略的優位性

  1. 適応性 - 戦略は,市場の変動に応じてパラメータとポジションを自動的に調整します.
  2. リスク管理が完ぺき - 複数のフィルターと厳格なポジション管理によりリスク管理
  3. 信号品質の信頼性 - 多次元指標確認による取引信号の精度向上
  4. フレキシブルな取引方法 - 傾向と変動の機会を同時に捉える
  5. 資金管理の科学 - 資金の合理性を保証する割合リスク管理

戦略リスク

  1. パラメータの感受性 - 複数のパラメータの設定は,戦略のパフォーマンスに影響を及ぼし,継続的な最適化が必要である
  2. 市場環境依存 - 特定の市場環境で偽の突破シグナルが発生する可能性がある
  3. スライドポイントの影響 - 流動性の低い市場では,大きなスライドポイントが発生する可能性があります.
  4. 計算の複雑さ - 複数の指標の計算は信号の遅延を引き起こす
  5. 資金要求が高い - 戦略を完全に実施するには,初期資金の規模が大きい

戦略最適化の方向性

  1. 指標重量最適化 - 各指標の重量を動的に調整する機械学習の方法が導入できます
  2. 市場の適応性を強化する - 市場の変動率を増加させる自己適応メカニズム
  3. 信号フィルタリングの改善 - 市場微構造指標の導入
  4. 実行メカニズムの最適化 - 知的注文分割メカニズムの追加 衝撃コストの削減
  5. リスク管理のアップグレード - ダイナミックなリスク予算管理システムを追加

要約する

この戦略は,複数の技術指標と取引技術を総合的に適用することで,完全な取引システムを構築する.その優点は,市場の変化に自律的に適応し,厳格なリスク管理を維持することにある.ある程度の最適化の余地があるが,全体的に合理的に設計された量化取引戦略である.

ストラテジーソースコード
/*backtest
start: 2025-01-01 00:00:00
end: 2025-02-20 00:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Binance","currency":"SOL_USDT"}]
*/

//@version=6
strategy("Adaptive Trend Signals", overlay=true, margin_long=100, margin_short=100, pyramiding=1, initial_capital=50000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=0.075)

// 1. Enhanced Inputs with Debugging Options

fvgSize = input.float(0.25, "FVG Size (%)", minval=0.1, step=0.05)
atrPeriod = input.int(14, "ATR Period")  // Increased for better stability
rsiPeriod = input.int(7, "RSI Period")
useSuperTrend = input.bool(true, "Use SuperTrend Filter")
useTrendFilter = input.bool(false, "Use 200 EMA Trend Filter")  // Disabled by default
volatilityThreshold = input.float(1.0, "Volatility Threshold (ATR%)", step=0.1)  // Increased threshold
useVolume = input.bool(true, "Use Volume Confirmation")
riskPercentage = input.float(2.0, "Risk %", minval=0.1, maxval=5)

// 2. Advanced Market Filters with Trend Change Detection
var int marketTrend = 0
var bool trendChanged = false
ema200 = ta.ema(close, 200)
prevMarketTrend = marketTrend
marketTrend := close > ema200 ? 1 : close < ema200 ? -1 : 0
trendChanged := marketTrend != prevMarketTrend

// 3. Enhanced FVG Detection with Adjusted Volume Requirements
bullishFVG = (low[1] > high[2] and (low[1] - high[2])/high[2]*100 >= fvgSize) or 
             (low > high[1] and (low - high[1])/high[1]*100 >= fvgSize)

bearishFVG = (high[1] < low[2] and (low[2] - high[1])/low[2]*100 >= fvgSize) or 
             (high < low[1] and (low[1] - high)/low[1]*100 >= fvgSize)

// 4. Smart Money Confirmation System with Signal Debugging
rsi = ta.rsi(close, rsiPeriod)
[macdLine, signalLine, _] = ta.macd(close, 5, 13, 5)
[supertrendLine, supertrendDir] = ta.supertrend(3, 10)

// Script 2 Indicators
[macdLine2, signalLine2, _] = ta.macd(close, 4, 11, 3)
[supertrendLine2, supertrendDir2] = ta.supertrend(3, 7)
vWAP = ta.vwap(close)
ema21 = ta.ema(close, 21)

// 5. Price Action Filters from Script 2
breakoutLong = close > ta.highest(high, 5) and (useVolume ? volume > ta.sma(volume, 10)*1.8 : true)
breakdownShort = close < ta.lowest(low, 5) and (useVolume ? volume > ta.sma(volume, 10)*1.8 : true)
bullishRejection = low < vWAP and close > (high + low)/2 and close > open
bearishRejection = high > vWAP and close < (high + low)/2 and close < open

// 6. Combined Entry Conditions
longBaseCond = (bullishFVG and rsi < 35 and macdLine > signalLine) or
              (bullishFVG and rsi < 38 and supertrendDir2 == 1) or
              (breakoutLong and macdLine2 > signalLine2) or
              (bullishRejection and close > ema21)

shortBaseCond = (bearishFVG and rsi > 65 and macdLine < signalLine) or
               (bearishFVG and rsi > 62 and supertrendDir2 == -1) or
               (breakdownShort and macdLine2 < signalLine2) or
               (bearishRejection and close < ema21)

longSignal = longBaseCond and (not useSuperTrend or supertrendDir == 1) and (not useTrendFilter or marketTrend == 1)

shortSignal = shortBaseCond and (not useSuperTrend or supertrendDir == -1) and (not useTrendFilter or marketTrend == -1)

// 7. Position Sizing with Minimum Quantity
var float longEntryPrice = na
var float shortEntryPrice = na
atr = ta.atr(atrPeriod)
positionSizeScript1 = math.max(strategy.equity * riskPercentage / 100 / (atr * 1.5), 1)
positionSizeScript2 = strategy.equity * riskPercentage / 100 / (atr * 2)

// 8. Dynamic Exit System with Dual Strategies
var float trailPrice = na
if longSignal or trendChanged and marketTrend == 1
    trailPrice := close
if shortSignal or trendChanged and marketTrend == -1
    trailPrice := close

trailOffset = atr * 0.75

// Script 1 Exit Logic
if strategy.position_size > 0
    trailPrice := math.max(trailPrice, close)
    strategy.exit("Long Exit", "Long", stop=trailPrice - trailOffset, trail_offset=trailOffset)
    
if strategy.position_size < 0
    trailPrice := math.min(trailPrice, close)
    strategy.exit("Short Exit", "Short", stop=trailPrice + trailOffset, trail_offset=trailOffset)

// Script 2 Exit Logic
longStop = close - atr * 1.2
shortStop = close + atr * 1.2
strategy.exit("Long Exit 2", "Long", stop=longStop, limit=na(longEntryPrice) ? na : longEntryPrice + (atr * 4), trail_points=not na(longEntryPrice) and close > longEntryPrice + atr ? atr * 3 : na, trail_offset=atr * 0.8)
strategy.exit("Short Exit 2", "Short", stop=shortStop, limit=na(shortEntryPrice) ? na : shortEntryPrice - (atr * 4), trail_points=not na(shortEntryPrice) and close < shortEntryPrice - atr ? atr * 3 : na, trail_offset=atr * 0.8)

// 9. Trend Change Signals and Visuals
// plot(supertrendLine, "SuperTrend", color=color.new(#2962FF, 0))
// plot(supertrendLine2, "SuperTrend 2", color=color.new(#FF00FF, 0))
// plot(ema200, "200 EMA", color=color.new(#FF6D00, 0))
// plot(ema21, "21 EMA", color=color.new(#00FFFF, 0))

bgcolor(marketTrend == 1 ? color.new(color.green, 90) : 
       marketTrend == -1 ? color.new(color.red, 90) : na)

plotshape(trendChanged and marketTrend == 1, "Bullish Trend", shape.labelup, 
         location.belowbar, color=color.green, text="▲ Trend Up")
plotshape(trendChanged and marketTrend == -1, "Bearish Trend", shape.labeldown, 
         location.abovebar, color=color.red, text="▼ Trend Down")

// 10. Signal Visualization for Both Strategies
// plotshape(longSignal, "Long Entry", shape.triangleup, location.belowbar, 
//          color=color.new(#00FF00, 0), size=size.small)
// plotshape(shortSignal, "Short Entry", shape.triangledown, location.abovebar, 
//          color=color.new(#FF0000, 0), size=size.small)
// plotshape(breakoutLong, "Breakout Long", shape.flag, location.belowbar, 
//          color=color.new(#00FF00, 50), size=size.small)
// plotshape(breakdownShort, "Breakdown Short", shape.flag, location.abovebar, 
//          color=color.new(#FF0000, 50), size=size.small)

// 11. Order Execution with Dual Entry Systems
if trendChanged and marketTrend == 1
    strategy.entry("Long Trend", strategy.long, qty=positionSizeScript1)
    longEntryPrice := close
    
if trendChanged and marketTrend == -1
    strategy.entry("Short Trend", strategy.short, qty=positionSizeScript1)
    shortEntryPrice := close

if longSignal and strategy.position_size == 0
    strategy.entry("Long Signal", strategy.long, qty=positionSizeScript2)
    longEntryPrice := close
    
if shortSignal and strategy.position_size == 0
    strategy.entry("Short Signal", strategy.short, qty=positionSizeScript2)
    shortEntryPrice := close