ADXは,平均指数 (ADX) と価格ブレイクをベースとした定量的な取引戦略である.この戦略は,主に市場傾向の強さを評価するためにADX指標値を監視し,市場の勢いを把握するために価格ブレイクシグナルを組み合わせます.この戦略は,特定の取引セッション内で動作し,ストップ損失と日々の取引制限を通じてリスク管理を実装します.
基本論理には次の主要な要素が含まれます.
ADXは,効率的なリスクマネジメントフレームワークの下で,ADX指標と価格ブレイクを組み合わせて市場動向を把握する.最適化のための余地がある一方で,戦略の基礎は堅牢で,定量的な取引システムの基本的な構成要素として適しています.トレーダーは,ライブ取引の前に徹底的なバックテストとパラメータ最適化を行い,市場状況に基づいて特定の改善を行うことをお勧めします.
/*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"}] */ // This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © HuntGatherTrade // ======================== // NQ 30 minute, ES 30 minute //@version=5 strategy("ADX Breakout", overlay=false, initial_capital=25000, default_qty_value=1) // =============================== // Input parameters // =============================== stopLoss = input(1000.0, title="Stop Loss ($)", group="Exits") session = input("0730-1430:1234567", group="Trade Session") highestLB = input(34, title="Highest lookback window", group="Indicator values") // =============================== // Trade Session Handling // =============================== t = time(timeframe.period, session) // Reset numTrades at the start of each session var int numTrades = 0 is_new_session = ta.change(time("D")) != 0 if is_new_session numTrades := 0 // =============================== // Entry Conditions // =============================== [plusDI, minusDI, adxValue] = ta.dmi(50, 14) entryCondition = (close >= ta.highest(close, highestLB)[1]) and (adxValue < 17.5) and (strategy.position_size == 0) and (numTrades < 3) and not na(t) // =============================== // 7. Execute Entry // =============================== var float stopPricePlot = na if entryCondition entryPrice = close + syminfo.mintick strategy.entry("Long Entry", strategy.long, stop=entryPrice) //stopPrice = strategy.position_avg_price - (stopLoss / syminfo.pointvalue) //strategy.exit("Stop Loss", "Long Entry", stop=stopPrice) numTrades += 1 if (strategy.position_size > 0) and (strategy.position_size[1] == 0) stopPoints = stopLoss / syminfo.pointvalue stopPrice = strategy.position_avg_price - stopPoints stopPrice := math.round(stopPrice / syminfo.mintick) * syminfo.mintick strategy.exit("Stop Loss", from_entry="Long Entry", stop=stopPrice) if ta.change(strategy.opentrades) == 1 float entryPrice = strategy.opentrades.entry_price(0) stopPricePlot := entryPrice - (stopLoss / syminfo.pointvalue) if ta.change(strategy.closedtrades) == 1 stopPricePlot := na plot(stopPricePlot, "Stop-loss level", color.red, 1, plot.style_linebr) // =============================== // Exit at End of Session // =============================== if na(t) and strategy.position_size != 0 strategy.close_all(comment="End of Day Exit")