
この戦略は,複数の指標を統合して,高確率の波段取引機会を識別する総合的な技術分析取引システムである. このシステムは,傾向の強さを確認するために,傾向の方向フィルターとしてのSuperTrend指標を主に使用し,ADX ((平均方向指数) と組み合わせて,流動性三角 ((Liquidity Delta)) の分析を使用して,購入と販売の圧力不均衡により,複数の市場環境で入場と出場シグナルを正確に生成します.
この戦略は,以下の4つのコア指標の協同作業によって取引シグナルを形成します.
スーパートレンド指数: 主なトレンド方向フィルターとして,最適化設定 ((因数:3.0,ATR周期:10) を採用して,応答性と信頼性をバランスします.価格がスーパートレンドラインの上にあるときは,上昇傾向として認識され,価格がスーパートレンドラインの下にある場合は,下降傾向として認識されます.
ADX指数:現在のトレンドの強さを確認するために,横軸または混乱した市場環境をフィルターします. 策略はカスタム実装方法を使用して,実際の波幅,正または負の方向の動きを計算し,最終的にADX値を生成します. ADX値が設定された値 (<デフォルト25) よりも高く,強い傾向があることを示す場合,システムは信号取引を生成する傾向があります.
流動性デルタ指数:取引量の買賣圧力の不均衡を分析し,取引量の買賣圧力の計算を行い,一連の標準化および滑り処理によって最終的なデルタ値を取得する.デルタ値が正の値を超えると多做信号が発生し,負の値を下ると空做信号が発生し,トレンドの方向と潜在的な逆転を検証する.
PSAR指標(オプション):トレンドの変化の追加確認として,信号のフィルタリングを減らすために,デフォルトでオフにします.価格がPSARポイントを超えると,上昇傾向と見なされ,価格がPSARポイントを下ると,下降傾向と見なされます.
取引ロジックは,すべてのアクティベーションされた指標を組み合わせて統合信号を生成する. すべての指標が同じ方向を指しているときに,最終的な買入または売却信号が生成される.例えば,PSAR条件,SuperTrend条件,ADX条件,流動性デルタ条件が満たされている場合にのみ,システムで買入信号が生成される.
この戦略には以下の利点があります.
多次元確認システム: トレンド,強度,取引量など複数の次元で取引を確認するために,さまざまなタイプの技術指標を統合することで,偽信号のリスクを大幅に低減し,取引の正確性を向上させる.
適応性が高い: 戦略は,ユーザが取引方向を柔軟に選択し,特定の指標を有効/無効にすることで,システムが様々な市場条件と異なる取引品種に適応できるようにします.
リスクのコントロール固定比率の内置の止損と停止メカニズムにより,各取引に既定のリスク制限と収益目標が設定され,資金の安全性が効果的に保護されます.
実際の取引コストを考慮する: 戦略モデルには,手数料 ((0.035%) とスライドポイント ((2ポイント) の計算が含まれ,反測結果を実際の取引環境により適合させる.
視覚的な取引信号: 明確な買入/売却シグナル矢印を用意し,サイズをカスタマイズし,グラフで素早く識別できるようにする.
情報パネル: 動的に,現在のアクティブな指標とリスク設定を表示し,戦略の実行状態の即時フィードバックを提供します.
保守的なポジション管理: 取引ごとに5%の利息をポジションサイズとして使って,過度取引による資金損失を回避する.
この戦略は包括的に設計されていますが, 潜在的リスクは以下の通りです.
パラメータ感度戦略の性能は,指標のパラメータ設定,特にスーパートレンド因子とADXの値に大きく依存しており,異なる市場環境では異なるパラメータ最適化が必要であり,そうでなければ過度取引や重要な機会を逃す可能性があります.
遅滞のリスク: 複数の移動平均類の指標が使用されているため,信号が一定の遅延が発生し,急速な反転市場での入場または出場が十分には及ばない.
関連性のリスク:複数の技術指標の間に内在的な関連性がある可能性があり,これは,見かけに独立した確認が,類似した数学モデルに基づく指標から来る可能性があり,複数の確認の実際の価値を下げることを意味する.
リスクの過剰最適化:2021-2033年の反省期間の良好なパフォーマンスは,特にこれらのパラメータが歴史的なデータに対する過度の最適化の結果である場合,将来の市場でも同様に有効であることを意味するものではありません.
解決策は
この戦略は,以下の方法で最適化できます.
動態参数調整市場波動性に基づくスーパートレンド因子とADX減値を自動的に調整するメカニズムを実現し,戦略を異なる市場環境により良く適応させることができる.例えば,低波動の市場でより小さなスーパートレンド因子を使用し,高波動の市場でより大きな因子を使用する.
タイムフィルター暗号通貨市場の週末や外貨市場の重要な経済データ発表などの既知の低流動性または高変動の時期に取引を避けるために,時間に基づくフィルタリングメカニズムを追加します.
多時間枠分析: より高い時間枠のトレンド確認を統合する.例えば,日経のトレンド方向が現在の取引時間枠と一致している場合にのみ取引に入る.これは戦略の勝利率を大幅に向上させることができる.
スマート・ストップ・ストラテジー: 固定比率のストップをATRまたはサポート/レジスタンス位に基づくダイナミックストップに置き換える.これは,市場の実際の変動状況をよりよく反映し,市場のノイズによって引き起こされるストップを減らす.
アクセスフィルターを追加:RSI超買超売判断やブリン帯境界テストなどのフィルタリング条件を追加することを検討し,より有利な価格レベルでの入場のみで入場品質を向上させる.
資金管理の最適化:現在の戦略のパフォーマンスと市場状況に基づいて動的なポジション管理を実現し,戦略が良好なときにポジションを徐々に増やし,不確実性が増加するとポジションを減らす.
機械学習の強化: 機械学習技術を活用して指標の重量分配を最適化し,異なる市場環境に応じて各指標を自動的に調整し,最終的な信号形成における重要性.
多指数ダイナミックトレンド取引戦略は,SuperTrend,ADX,流動性デルタなどの複数の技術指標を統合して,様々な市場環境における波段取引に適した包括的で柔軟な取引システムを構築しています.この戦略の核心的な優点は,多次元的な信号確認機構と厳格なリスク管理フレームワークで,市場のノイズを効果的にフィルターし,取引資金を保護できます.しかし,ユーザーは,パラメータの感受性や指標の遅れなどの潜在的なリスクに注意し,定期的に戦略のパフォーマンスを再評価する必要があります.
ダイナミックパラメータ調整,マルチタイムフレーム分析,インテリジェント・ストップ・ストラトジーなどの推奨の最適化方向を適用することで,このシステムは,その収益性と安定性をさらに向上させる可能性を秘めています.最終的には,この戦略は,個人リスクの好みと市場の見解に応じてカスタマイズされ拡張できる,定量トレーダーのための堅固な枠組みを提供します.
/*backtest
start: 2025-01-27 00:00:00
end: 2025-05-14 00:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"ETH_USDT"}]
*/
// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © TiamatCrypto
//@version=6
// ====================================================================================
// Multi-Indicator Swing Trading Strategy [TIAMATCRYPTO]v6
// ====================================================================================
// DESCRIPTION:
// This strategy uses a combination of technical indicators to identify swing trading
// opportunities in various markets. The default settings are optimized for daily
// timeframes on cryptocurrency and forex markets.
//
// RECOMMENDED DEFAULT SETTINGS:
// - Trading direction: Both (performs well in trending and ranging markets)
// - Position size: 5% (conservative position sizing to manage risk)
// - Stop Loss: 2% (conservative risk management for capital preservation)
// - Take Profit: 4% (realistic profit target with 1:2 risk-reward ratio)
// - Initial capital: $10,000 (realistic starting account size)
// - Timeframe: 2m (best performance on 2m charts)
// - Testing period: 2021-2033 (provides sufficient sample size of trades)
// ====================================================================================
strategy("Multi-Indicator Swing [TIAMATCRYPTO]v6", overlay=true,
default_qty_type=strategy.percent_of_equity, default_qty_value=5,
initial_capital=10000, commission_type=strategy.commission.percent,
commission_value=0.035, slippage=2)
// === BASIC SETTINGS ===
// Backtesting time period set directly in the code for realistic testing
var startDateInput = timestamp("2021-01-01T00:00:00")
var endDateInput = timestamp("2033-12-31T23:59:59")
var inDateRange = time >= startDateInput and time <= endDateInput
// Trading direction settings
tradeDirection = input.string("Both", "Trading Direction", options=["Long Only", "Short Only", "Both"], group="Basic Settings")
// === INDICATOR SWITCHES ===
// PSAR is now disabled by default
usePSAR = input.bool(false, "Use PSAR", group="Indicator Switches")
useSupertrend = input.bool(true, "Use Supertrend", group="Indicator Switches")
useADX = input.bool(true, "Use ADX", group="Indicator Switches")
useLiquidityDelta = input.bool(true, "Use Liquidity Delta", group="Indicator Switches")
// === INDICATOR SETTINGS SECTION ===
// PSAR Settings
// Default PSAR settings are conservative and work well across multiple markets
psarStart = input.float(0.02, "PSAR Initial Value", minval=0.01, maxval=0.1, step=0.01, group="PSAR Settings")
psarIncrement = input.float(0.02, "PSAR Increment", minval=0.01, maxval=0.1, step=0.01, group="PSAR Settings")
psarMaximum = input.float(0.2, "PSAR Maximum", minval=0.1, maxval=0.5, step=0.05, group="PSAR Settings")
// Supertrend Settings
// Factor 3.0 provides a good balance between sensitivity and false signals
atrPeriod = input.int(10, "SuperTrend ATR Period", minval=1, maxval=50, group="SuperTrend Settings")
factor = input.float(3.0, "SuperTrend Multiplier", minval=1, maxval=10, step=0.1, group="SuperTrend Settings")
// ADX Settings
// ADX threshold of 25 is standard for identifying strong trends
adxLength = input.int(14, "ADX Length", minval=1, maxval=50, group="ADX Settings")
adxThreshold = input.int(25, "ADX Trend Strength Threshold", minval=10, maxval=50, group="ADX Settings")
// Liquidity Delta Settings
// These settings help identify significant volume imbalances for trend confirmation
deltaLength = input.int(14, "Liquidity Delta Length", minval=1, maxval=50, group="Liquidity Delta")
deltaSmooth = input.int(3, "Delta Smoothing", minval=1, maxval=20, group="Liquidity Delta")
deltaThreshold = input.float(0.5, "Delta Signal Threshold", minval=0.1, maxval=5, step=0.1, group="Liquidity Delta")
// Risk Management Settings
// Conservative settings to ensure capital preservation
useStopLoss = input.bool(true, "Use Stop Loss", group="Risk Management")
useTakeProfit = input.bool(true, "Use Take Profit", group="Risk Management")
stopLossPercent = input.float(2.0, "Stop Loss (%)", minval=0.5, maxval=5, step=0.1, group="Risk Management")
takeProfitPercent = input.float(4.0, "Take Profit (%)", minval=1.0, maxval=10, step=0.1, group="Risk Management")
// Visualization Settings
signalSize = input.string("Normal", "Signal Size", options=["Small", "Normal", "Large"], group="Visualization")
buyColor = input.color(color.green, "Buy Signal Color", group="Visualization")
sellColor = input.color(color.red, "Sell Signal Color", group="Visualization")
// === INDICATOR CALCULATIONS ===
// All remaining indicators set to initialize as true when their respective switch is off
// PSAR Calculations
psar = ta.sar(psarStart, psarIncrement, psarMaximum)
psarCondition = not usePSAR or (close > psar)
psarSellCondition = not usePSAR or (close < psar)
// Supertrend Calculations
[supertrendValue, supertrendDirection] = ta.supertrend(factor, atrPeriod)
supertrendCondition = not useSupertrend or (supertrendDirection > 0)
supertrendSellCondition = not useSupertrend or (supertrendDirection < 0)
// ADX Calculations - custom implementation
trueRange = math.max(high - low, math.abs(high - close[1]), math.abs(low - close[1]))
smoothedTrueRange = ta.sma(trueRange, adxLength)
dmPlus = high > high[1] ? math.max(high - high[1], 0) : 0
dmMinus = low[1] > low ? math.max(low[1] - low, 0) : 0
smoothedDmPlus = ta.sma(dmPlus, adxLength)
smoothedDmMinus = ta.sma(dmMinus, adxLength)
diPlus = smoothedTrueRange > 0 ? 100 * smoothedDmPlus / smoothedTrueRange : 0
diMinus = smoothedTrueRange > 0 ? 100 * smoothedDmMinus / smoothedTrueRange : 0
dx = (diPlus + diMinus) > 0 ? math.abs(diPlus - diMinus) / (diPlus + diMinus) * 100 : 0
adxValue = ta.sma(dx, adxLength)
adxCondition = not useADX or (adxValue > adxThreshold)
// Liquidity Delta Calculations
bidVolume = close < open ? volume : volume * (high - close) / (high - low + 0.000001)
askVolume = close > open ? volume : volume * (close - low) / (high - low + 0.000001)
deltaRaw = bidVolume - askVolume
deltaAvg = ta.sma(deltaRaw, deltaLength)
deltaNormalized = deltaAvg / ta.sma(volume, deltaLength)
deltaSmoothed = ta.ema(deltaNormalized, deltaSmooth)
// Delta Signals
bullishDelta = deltaSmoothed > deltaThreshold
bearishDelta = deltaSmoothed < -deltaThreshold
deltaCondition = not useLiquidityDelta or bullishDelta
deltaSellCondition = not useLiquidityDelta or bearishDelta
// === TRADING LOGIC ===
// Buy signal - combination of all active indicators
buySignal = psarCondition and supertrendCondition and adxCondition and deltaCondition
// Sell signal - combination of all active indicators
sellSignal = psarSellCondition and supertrendSellCondition and adxCondition and deltaSellCondition
// Apply trading direction
isLongAllowed = tradeDirection == "Long Only" or tradeDirection == "Both"
isShortAllowed = tradeDirection == "Short Only" or tradeDirection == "Both"
finalBuySignal = buySignal and isLongAllowed
finalSellSignal = sellSignal and isShortAllowed
// === POSITION ENTRY WITH RISK MANAGEMENT ===
// Conservative position management with defined risk parameters
if finalBuySignal and inDateRange
strategy.entry("Long", strategy.long)
// Conditional setting of stop-loss and take-profit
if useStopLoss or useTakeProfit
stopLevel = useStopLoss ? close * (1 - stopLossPercent / 100) : na
takeProfitLevel = useTakeProfit ? close * (1 + takeProfitPercent / 100) : na
strategy.exit("Long Exit", "Long", stop=stopLevel, limit=takeProfitLevel)
if finalSellSignal and inDateRange
strategy.entry("Short", strategy.short)
// Conditional setting of stop-loss and take-profit
if useStopLoss or useTakeProfit
stopLevel = useStopLoss ? close * (1 + stopLossPercent / 100) : na
takeProfitLevel = useTakeProfit ? close * (1 - takeProfitPercent / 100) : na
strategy.exit("Short Exit", "Short", stop=stopLevel, limit=takeProfitLevel)
// === SIGNAL VISUALIZATION ===
// Creating separate signals for different sizes
buySmallSignal = finalBuySignal and signalSize == "Small"
buyNormalSignal = finalBuySignal and signalSize == "Normal"
buyLargeSignal = finalBuySignal and signalSize == "Large"
sellSmallSignal = finalSellSignal and signalSize == "Small"
sellNormalSignal = finalSellSignal and signalSize == "Normal"
sellLargeSignal = finalSellSignal and signalSize == "Large"
// Draw signals for each size
plotshape(buySmallSignal and inDateRange, title="Buy Small", location=location.belowbar, color=buyColor, style=shape.triangleup, size=size.small)
plotshape(buyNormalSignal and inDateRange, title="Buy Normal", location=location.belowbar, color=buyColor, style=shape.triangleup, size=size.normal)
plotshape(buyLargeSignal and inDateRange, title="Buy Large", location=location.belowbar, color=buyColor, style=shape.triangleup, size=size.large)
plotshape(sellSmallSignal and inDateRange, title="Sell Small", location=location.abovebar, color=sellColor, style=shape.triangledown, size=size.small)
plotshape(sellNormalSignal and inDateRange, title="Sell Normal", location=location.abovebar, color=sellColor, style=shape.triangledown, size=size.normal)
plotshape(sellLargeSignal and inDateRange, title="Sell Large", location=location.abovebar, color=sellColor, style=shape.triangledown, size=size.large)
// === INFORMATION PANEL ===
// Building list of active indicators
indList = ""
indList := usePSAR ? indList + "PSAR, " : indList
indList := useSupertrend ? indList + "SuperT, " : indList
indList := useADX ? indList + "ADX, " : indList
indList := useLiquidityDelta ? indList + "Delta" : indList
// Remove last comma if it exists
if str.endswith(indList, ", ")
indList := str.substring(indList, 0, str.length(indList) - 2)
// Building risk management text
riskText = ""
if useStopLoss and useTakeProfit
riskText := str.tostring(stopLossPercent, "#.#") + "% SL, " + str.tostring(takeProfitPercent, "#.#") + "% TP"
else if useStopLoss
riskText := str.tostring(stopLossPercent, "#.#") + "% SL"
else if useTakeProfit
riskText := str.tostring(takeProfitPercent, "#.#") + "% TP"
else
riskText := "Disabled"
// Display strategy information
var table infoTable = table.new(position.top_right, 2, 5, border_width=1)
table.cell(infoTable, 0, 0, "Strategy:", bgcolor=color.new(color.blue, 90), text_color=color.white)
table.cell(infoTable, 1, 0, "Multi-Indicator Swing", bgcolor=color.new(color.blue, 90), text_color=color.white)
table.cell(infoTable, 0, 1, "Period:", bgcolor=color.new(color.blue, 90), text_color=color.white)
table.cell(infoTable, 1, 1, "2021-2023", bgcolor=color.new(color.blue, 90), text_color=color.white)
table.cell(infoTable, 0, 2, "Direction:", bgcolor=color.new(color.blue, 90), text_color=color.white)
table.cell(infoTable, 1, 2, tradeDirection, bgcolor=color.new(color.blue, 90), text_color=color.white)
table.cell(infoTable, 0, 3, "Indicators:", bgcolor=color.new(color.blue, 90), text_color=color.white)
table.cell(infoTable, 1, 3, indList, bgcolor=color.new(color.blue, 90), text_color=color.white)
table.cell(infoTable, 0, 4, "Risk Management:", bgcolor=color.new(color.blue, 90), text_color=color.white)
table.cell(infoTable, 1, 4, riskText, bgcolor=color.new(color.blue, 90), text_color=color.white)