
内部価格強度トレンド反転取引システムは,内部価格強度 (IBS) の指標に基づく日線レベルの取引戦略である.この戦略の核心は,潜在的市場反転点を認識することであり,前一本の線結束価格がその高低点の範囲内の相対的な位置をモニタリングすることによって,市場の超買い超売り状態を判断することである.この戦略は,特に株式とアメリカ指数取引に適しており,デフォルトパラメータはSPY/SPXとNDQ/QQQなどの主要指数に対して最適化されている.
この戦略の核心は,内部価格強さ (IBS) の指標の計算と適用である.IBS指標は以下の公式で計算される.
IBS = (前一日收盘价 - 前一日最低价) / (前一日最高价 - 前一日最低价)
IBS値は常に0から1の間で変動する.
この戦略の取引ルールは以下の通りです.
複数入学条件は以下の通りです.
試合に出場する条件:
それに加えて,戦略は”最小新規入場距離百分比”のパラメータを導入し,価格が十分に逆戻りするときにのみ新しいポジションが開くことを保証し,逆戻りリスクを効果的に軽減し,資金管理を最適化しました.
市場時刻把握精度:IBS指標を使用すると,市場の超買超売状態を正確に捉え,入場と出場に客観的な数学的根拠を提供し,主観的な判断による偏差を軽減します.
トレンドフィルター機構:トレンドフィルターとしてEMAを使用し,取引方向が主要トレンドと一致することを確保し,逆転取引のリスクを効果的に回避します. 戦略は,異なる市場特性に合わせてEMAサイクルを調整するか,この条件を完全に無効にすることができます.
柔軟なポジション管理:戦略は,ピラミッド式加仓をサポートする (最大2回),および”最小の新規入場距離パーセント”パラメータを導入し,よりスマートな分量建仓メカニズムを実現し,価格の撤回時に平均保有コストを効果的に削減する.
自動リスクコントロール:戦略は最大ポジション保持時間制限を設定し,市場が通常の出場シグナルを触発していない場合でも,設定された最大取引周期後に自動的に平仓し,単一の取引のリスク暴露時間を効果的に制御する.
パラメータ最適化:SPYとQQQ/NDQなどの主要市場指数に最適化されたデフォルトのパラメータを,推奨設定を直接適用できます.
全面的な取引モード:多額取引,空白取引,双方向取引モードに対応し,異なる市場環境と取引スタイルに対応します.
パラメータの敏感性:IBSの入場と出場の値は戦略のパフォーマンスに大きく影響し,パラメータの設定を不適切に設定すると,過度取引または重要な取引機会を逃す可能性があります.実際の取引品種に適用する前に,特定の取引品種に対して十分な歴史データ再測とパラメータの最適化を行うことが推奨されます.
震動市場リスク: 明らかに傾向のない震動市場では,IBS信号が頻繁に発生し,過度な取引と不必要な取引コストの増加を引き起こす可能性があります. 解決策は,複数の連続したIBS信号の確認を要求する,または他の指標 (ATRなど) と組み合わせて市場の変動性を判断するなどのフィルタリング条件を追加することです.
急激なトレンド変化の遅延性:市場が急速なトレンド転換に遭遇すると,前日データに基づいて計算されたIBS指標は遅延して反応し,入場または出場のタイミングが理想的ではない.高い変動期間にIBSの値を適切に調整するか,最大保有時間を短縮することを推奨する.
資金管理リスク:デフォルトでは,口座の資金の50%を使用し,取引する.複数回の加仓の場合,リスクが過剰に露出する可能性があります. ユーザは,自身のリスク承受能力に応じてポジションサイズと加仓パラメータを調整することをお勧めします.
技術的実現制限:戦略は,閉盘価格に基づく取引を実行し,実際の操作で滑り点と価格差に直面することがあります. このようなリスクを軽減するために,閉盘前の一定時間前に注文したり,市場価格の代わりに制限価格シートを使用することを検討することができます.
動的値調整:現在の戦略は固定されたIBS入場と出場の値を使用し,市場の変動の動態に基づいてこれらの値の調整を考慮することができます.例えば,高波動期には入場の値を適切に上昇させ,出場の値を下げ,偽信号を減らすために;低波動期にはより激進的な設定を採用することができます.具体的にはIBS値をATR ((実際の波幅の平均) または歴史的な波動率とリンクすることで実現できます.
複数時間周期確認:複数時間周期分析フレームワークを導入し,短期および中期IBS信号を同時に確認して取引を行う.例えば,日線IBS信号に加えて,周線または4時間線IBS値を計算し,複数の時間周期がオーバーバイまたはオーバーセール状態を示している場合にのみ入場し,信号品質を大幅に向上させることができる.
スマート・ストップ・メカニズム:現在の戦略はIBSの出場信号と最大保有時間リスクのみに依存し,よりスマートなストップ・メカニズムを導入することができる.例えば,ATRに基づくダイナミック・ストップ,トラッキング・ストップ,またはサポート/レジスタンス・ポイントに基づくストップ・メカニズムにより,利益を保護し,単一取引のリスクを制御する.
市場状態自適化:市場状態識別機構を導入し,異なる市場環境 (((トレンド市・ショック市)) の下で異なるパラメータ設定を使用する.ADX (((平均方向指数) または他のトレンド強度指標を使用して市場状態を識別し,強いトレンド環境でIBS条件を緩和し,ショック市場ではより厳しいIBS値を採用する.
機械学習最適化:機械学習技術を活用してIBS信号を最適化およびフィルタリングする.訓練モデルによって,どのIBS信号が収益性の高い取引を生み出す可能性が高いかを識別し,市場特性に合わせてパラメータを自動的に調整して,戦略の自己適応性能を実現する.この方法は,特に異なる市場条件と取引品種に直面するときに,戦略の安定性と適応性を大幅に向上させることができる.
内部価格強度トレンド反転取引システムは,内部価格強度 (IBS) 指数とインデックス移動平均 (EMA) を組み合わせた日線レベルの取引戦略である.この戦略は,潜在的市場反転点を識別し,長期のトレンドに従うことで取引決定を最適化するために,特に株式と米国指数取引に適しています.その核心的な優点は,客観的な数学モデル,柔軟なポジション管理,および内蔵されたリスク制御メカニズムにあります.
戦略はSPY/SPXとNDQ/QQQなどの主要市場指数に対してパラメータ最適化が行われ,ユーザーは推奨設定を直接適用して取引することができます.しかし,いかなる取引戦略にも,パラメータの感受性,市場の震動のリスク,急激なトレンドの変化の下での遅れなどを含むリスクがあります.
将来の最適化の方向には,ダイナミックな値調整,多周期的な確認,スマートな止損機構,市場状態の自己適応,機械学習の最適化などが含まれます.これらの改善は,戦略の適応性と安定性をさらに高め,異なる市場環境で良好なパフォーマンスを維持することができます.
量的な取引戦略として,内部価格強度トレンド反転取引システムは,交易者にルールに基づく客観的な取引方法を提供し,取引決定に感情的な要因の影響を軽減し,より一致し,予測可能な取引結果を達成するのに役立ちます.
/*backtest
start: 2024-03-05 00:00:00
end: 2025-03-03 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"SOL_USDT"}]
*/
//Implementation by AlgoTradeKit
//v.0.5
//The IBS Trading Strategy is a daily bars long-only trading system, based on the concept of Internal Bar Strength (IBS).
//The strategy aims to identify potential reversals by monitoring how the previous bar’s close positions itself within its high-low range.
//It is suitable for stock and US indices. The default parameters are optimized for SPY/SPX and NDQ/QQQ
//Setting for QQQ: 0.09, 0.985, 220, 0, 14
//Setting for SPY: 0.11, 0.995, 200, 0, 12
//@version=6
strategy("IBS (Internal Bar Strength) Trading Strategy for SPY and NDQ", overlay=true, initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=50, pyramiding = 2, currency = currency.USD, process_orders_on_close=false)
// ***** INPUTS *****
// IBS thresholds
ibsEntryThreshold = input.float(0.09, title="IBS Entry Threshold", step=0.01, tooltip="IBS = (Previous Close - Previous Low) / (Previous High - Previous Low), and IBS value below 0.2 is typically interpreted as an oversold condition, while a value above 0.9 suggests an overbought state.")
ibsExitThreshold = input.float(0.985, title="IBS Exit Threshold", step=0.01, tooltip="IBS = (Previous Close - Previous Low) / (Previous High - Previous Low), and IBS value below 0.2 is typically interpreted as an oversold condition, while a value above 0.9 suggests an overbought state.")
// EMA period (set to 0 to disable the EMA condition)
emaPeriod = input.int(220, title="EMA Period (0 to disable)", minval=0, maxval=5000, step=1, tooltip="Exponential Moving Average Filter Period (0 to disable)")
// Minimum percentage drop required for a new entry (for dollar-cost averaging)
minEntryPct = input.float(0, title="Minimum Distance for New Entry (%)", step=0.05, minval=0.0, maxval=100, tooltip = "Distance in Price from Last Opened Position, in Percentage Terms (%)")
maxTradeDuration = input.int(title="Maximum Trade Duration (days)", defval=14, minval=1, step=1, maxval=1000, tooltip = "Exit at close if maximum trade duration is reached.")
// Persistent variable to record the bar index when the trade is entered.
var int entryBarIndex = na
// ***** EMA CALCULATION *****
// Calculate the EMA globally if the period is greater than 0, otherwise leave as na.
emaValue = emaPeriod > 0 ? ta.ema(close, emaPeriod) : na
// ***** IBS CALCULATION *****
// Calculate IBS using the previous bar’s values.
// Guard against division by zero: if previous high equals previous low, default IBS to 0.5.
prevHigh = high[1]
prevLow = low[1]
prevClose = close[1]
ibs = (prevHigh != prevLow) ? (prevClose - prevLow) / (prevHigh - prevLow) : 0.5
// ***** ENTRY AND EXIT CONDITIONS *****
// Define the EMA condition: if emaPeriod is 0, bypass the EMA check.
emaConditionLong = emaPeriod == 0 or (close > emaValue)
emaConditionShort = emaPeriod == 0 or (close < emaValue)
// Entry: IBS is below the entry threshold and the EMA condition holds.
enterLong = (ibs < ibsEntryThreshold) and emaConditionLong
enterShort = (ibs > ibsExitThreshold) and emaConditionShort
// Exit: IBS is above the exit threshold.
exitLong = ibs > ibsExitThreshold
exitShort = ibs < ibsEntryThreshold
// ***** DOLLAR-COST AVERAGING CONDITION IN PERCENTAGE *****
// Track the last entry price. Reset when there is no open position.
var float lastEntryPrice = na
if strategy.position_size == 0
lastEntryPrice := na
// If there is no previous entry, the condition is met.
// Otherwise, allow a new entry only if the current price is lower than the last entry price
// by at least the predefined percentage (converted to a fraction).
dcaCondition = na(lastEntryPrice) or ((close < lastEntryPrice) and (((lastEntryPrice - close) / lastEntryPrice) >= (minEntryPct / 100)))
dcaConditionShort = na(lastEntryPrice) or ((close > lastEntryPrice) and (((close - lastEntryPrice) / lastEntryPrice) >= (minEntryPct / 100)))
// ***** STRATEGY ORDERS *****
// Enter a long position only if both the entry condition and the DCA condition are met.
if enterLong and dcaCondition
strategy.entry("Long", strategy.long)
lastEntryPrice := close // update the last entry price
entryBarIndex := bar_index
if enterShort and dcaConditionShort
strategy.entry("Short", strategy.short)
lastEntryPrice := close // update the last entry price
entryBarIndex := bar_index
// Compute trade duration in days using the absolute difference
tradeDuration = not na(entryBarIndex) ? math.abs(bar_index - entryBarIndex) : 0
// Exit the long position when the exit condition is met or if the trade duration reaches maxTradeDuration days.
if exitLong or (tradeDuration >= maxTradeDuration)
strategy.close("Long")
// Exit the long position when the exit condition is met or if the trade duration reaches maxTradeDuration days.
if exitShort or (tradeDuration >= maxTradeDuration)
strategy.close("Short")
// ***** PLOTTING *****
// Plot IBS for reference, along with horizontal lines for the entry and exit thresholds.
//plot(ibs, title="IBS", color=color.blue, linewidth=2)
//hline(ibsEntryThreshold, title="IBS Entry Threshold", color=color.green)
//hline(ibsExitThreshold, title="IBS Exit Threshold", color=color.red)