OPEN-SOURCE SCRIPT
MTF OB & FVG detector w/ Alerts v2

# MTF OB & FVG Detector with Alerts(マルチタイムフレーム オーダーブロック&フェアバリューギャップ検出器)
## 概要
このインジケーターは、複数の時間足で**オーダーブロック(OB)**と**フェアバリューギャップ(FVG)**を検出し、これらのゾーンからの反発をリアルタイムでアラート通知します。高度なボリューム分析とマルチタイムフレーム分析を組み合わせ、高確率のサポート・レジスタンスゾーンを特定します。
## 主な機能
### 1. マルチタイムフレーム オーダーブロック検出
- **対応時間足**: 1分、3分、5分、15分、60分
- 各時間足を個別に有効/無効化可能
- 正確な価格レベルでOBゾーンを自動表示
- ブル/ベア比率の内訳を含むボリューム情報表示
- タイプ別色分け: ブリッシュ(青)/ ベアリッシュ(赤)- 反転可能
### 2. フェアバリューギャップ(FVG)検出
- 現在のチャート時間足でブリッシュ・ベアリッシュFVGパターンを検出
- ギャップ内のボリューム分布を表示
- 色分け: ブリッシュ(アクア)/ ベアリッシュ(オレンジ)- 反転可能
- ミティゲート/ブレイクされたFVGを自動削除
- **注意**: 1分足チャートではデフォルトでFVGは無効化されていますが、設定で有効化できます。
### 3. インテリジェントなブレイク検出
- **オーダーブロック**: 価格がゾーンを突破すると自動削除
- ブリッシュOB: 価格が下に抜けると削除
- ベアリッシュOB: 価格が上に抜けると削除
- **フェアバリューギャップ**: 価格がギャップを完全にミティゲートすると削除
- ブレイク方法の設定: ヒゲベースまたは実体ベース
### 4. 高度なアラートシステム
- **反発アラート**: 価格がOBまたはFVGゾーンから反発した際にトリガー
- ブリッシュとベアリッシュで個別アラート
- アラートメッセージに時間足情報を含む
- 有効化されたすべての時間足を同時監視
- **新規OB形成アラート**: 新しいオーダーブロックが形成されたときに通知
- **統合ゾーンアラート**: 複数のOBが統合されたときに通知
- **設定可能な閾値**: 最小OB統合数を設定(デフォルト: 3、範囲: 2-10)
- 複数時間足にわたる強力なコンフルエンスゾーンを示す
- 高確率のサポート/レジスタンスエリアを警告
- より多くのOBが統合 = より強力なゾーン = より高いアラート優先度
- すべてのアラートを個別に有効/無効化可能
### 5. ビジュアルカスタマイズ
- **テキスト表示**: 現在時刻の3バー右から左寄せで表示
- **ゾーン延長**: 40バー先まで延長(設定可能)
- **色の反転**:
- OB: 青/赤 または 赤/青 の切り替え
- FVG: アクア/オレンジ または オレンジ/アクア の切り替え
- **下位時間足表示**: 1分足と3分足ゾーンのオプション表示
### 6. ボリューム分析
- 各OBにブル/ベア比率を含む総ボリュームを表示
- パーセンテージ内訳で優勢なボリューム側を表示
- FVGはギャップ全体のボリューム分布を表示
#### テキスト表示の見方
**オーダーブロックのテキスト形式:** `[Combined] 5m OB 12.5M (85%)`
- **[Combined]**: 複数の時間足が統合された場合に表示(オプション表示)
- **5m OB**: 時間足の識別子(5分足オーダーブロック)
- **12.5M**: OBゾーンで取引された総ボリューム(常に百万単位で小数点第1位まで表示)
- 例: 12.5M、0.8M、156.3M
- **(85%)**: 優勢(強い側)のボリュームの割合
- ブリッシュOBの場合: ブリッシュボリュームの割合(強い側)
- ベアリッシュOBの場合: ベアリッシュボリュームの割合(強い側)
- パーセンテージが高い = より強力なOB(一方的なボリューム)
**フェアバリューギャップのテキスト形式:** `15m FVG 8.3M (85%)`
- **15m FVG**: 時間足の識別子(15分足フェアバリューギャップ)
- **8.3M**: FVGの総ボリューム(常に百万単位で小数点第1位まで表示)
- 例: 8.3M、1.2M、45.7M
- **(85%)**: 優勢(強い側)のボリュームの割合
- ブリッシュFVGの場合: ブリッシュボリュームの割合(強い側)
- ベアリッシュFVGの場合: ベアリッシュボリュームの割合(強い側)
- パーセンテージが高い = より強力なFVG(一方的なボリューム)
## 使用方法
### 基本セットアップ
1. **チャートに追加**: TradingViewのインジケーターで「MTF OB & FVG detector」を検索
2. **時間足を選択**: 希望の時間足を有効化(デフォルト: 5分、15分、60分)
3. **アラート設定**: 反発と新規OB形成のアラートを有効化
### 設定ガイド
#### マルチタイムフレーム設定
- **Show Lower Timeframes**: 1分足と3分足ゾーンを表示(デフォルト: ON)
- **各時間足**: 各時間足(1m, 3m, 5m, 15m, 60m)の個別切り替え
- 推奨: チャートの混雑を避けるため2-3個の時間足を使用
#### 一般設定
- **Zone Count**: 時間足あたりのOB数(Low/Medium/High)
- Medium(5ゾーン): 複数時間足使用時に推奨
- High(10ゾーン): 少数時間足での詳細分析用
- **Swing Length**: OB検出の感度(デフォルト: 3)
- 低い値 = より小さく、より頻繁なOB
- 高い値 = より大きく、より少数のOB
- **Break Detection Method**: OB無効化にWickまたはBodyを選択
#### フェアバリューギャップ設定
- **Show Fair Value Gaps**: FVG表示の切り替え
- デフォルト: ON(すべての時間足)
- **Show FVG on 1-Minute Charts**: 1分足チャートでのFVG表示を有効化
- デフォルト: OFF(視覚的な混雑を減らしパフォーマンスを向上させるため無効)
- 1分足でもFVGを表示したい場合は有効化してください
- **Mitigation Source**: FVG無効化に終値またはhigh/lowを選択
- **Individual Gap Types**: ブリッシュまたはベアリッシュFVGを個別に有効/無効化
#### アラート設定
- **Enable Alerts**: すべてのアラートのマスタースイッチ
- **Alert on Bullish/Bearish Bounce**: 各方向の個別切り替え
- **Alert on New OB Formation**: 新しいOBが作成されたときに通知
- **Alert on Combined OBs**: 複数のOrder Blockが1つの強力なゾーンに統合されたときに通知
- **Min OBs for Strong Zone Alert**: アラートをトリガーするために必要な最小OB統合数を設定
- デフォルト: 3(3つ以上のOB)
- 範囲: 2-10
- 値が高い = より厳選的、最も強力なコンフルエンスゾーンのみをアラート
#### スタイル設定
- **Invert Colors**:
- OB: デフォルトはブリッシュ=赤、ベアリッシュ=青
- FVG: デフォルトはブリッシュ=オレンジ、ベアリッシュ=アクア
- **Extend Zones**: ゾーンを前方に延長するバー数(デフォルト: 40)
### トレーディング戦略
#### 1. 統合ゾーンでの反転取引
- 「Combine Overlapping Order Blocks」機能を有効化
- 統合ゾーン(例:「5m & 15m & 1H」)は強力なサポート/レジスタンスを示す
- これらのゾーンは重要な転換点を示すことが多い
- 価格が高ボリュームで統合ゾーンにタッチするのを待つ
- 反転確認(ローソク足パターン、モメンタムダイバージェンス)でエントリー
- ストップロスは直近安値、直近高値を指定する等の高度な判断が必要(ゾーン端をストップロスにすると値幅が大きくなってしまうため)
#### 2. FVGフィリング
- FVGは価格の磁石として機能
- 未充填のギャップに向けてトレード
- 価格がギャップを完全に埋めたら決済
#### 3. OB/FVGを使ったトレンドフォロー
- 現在のトレンド方向を特定
- トレンド方向のOB/FVGからの反発のみを取引
- 上昇トレンド: ブリッシュ反発のみを取引
- 下降トレンド: ベアリッシュ反発のみを取引
- 上位時間足のOB(15分、60分)をトレンド確認に使用
- 下位時間足のOB(1分、3分)を精密なエントリーに使用
- 移動平均線やトレンドインジケーターと組み合わせると最良の結果
## 技術詳細
### オーダーブロックのロジック
- 設定可能なスイング長を使用してスイング高値/安値を検出
- 価格移動前のボリューム蓄積ゾーンを特定
- ブレイカーキャンドルでブレイクアウト確認を追跡
- 無効化されたゾーンを自動削除
### フェアバリューギャップのロジック
- キャンドル1と3の間にギャップがある3キャンドルパターンを識別
- 有効性のための最小ギャップサイズが必要
- 価格がギャップを通過する際のミティゲーションを追跡
- ギャップの強度のためのボリューム加重分析
### メモリ最適化
- 最大100個のボックス/ラベル/ラインを同時表示
- ブレイクされたゾーンの自動クリーンアップ
- 複数時間足でのパフォーマンスに最適化
- 効率的な配列管理
## ベストプラクティス
1. **シンプルに始める**: 最初は2-3個の時間足から始める
2. **ゾーン数を調整**: 多くの時間足を有効化する場合は「Medium」または「Low」を使用
3. **反発を確認**: アラートだけでトレードせず、価格確認を待つ
4. **ストップロスを使用**: 必ずゾーン境界を超えてストップを設定
5. **バックテスト**: ライブトレード前に過去データでテスト
6. **他のツールと組み合わせ**: トレンドインジケーター、ボリュームプロファイルなどと併用
## 制限事項
- 同時に最大100個のボックスを表示可能
- FVG検出は現在のチャート時間足に限定
- 有効化する時間足が多いほど、時間足あたりに表示できるゾーンが少なくなる
- ボックス上限に達すると、過去のゾーンが消える場合がある
## サポートとアップデート
質問、バグレポート、または機能リクエストについては、インジケーターページにコメントするか、作成者に連絡してください。
## クレジット
このインジケーターは、以下の優れたTradingViewインジケーターの機能を統合・強化しています:
- **[Order Blocks | Flux Charts](tradingview.com/script/bLdpFVuq-Order-Blocks-Flux-Charts/)** by fluxchart
- ボリューム情報を含むオーダーブロック検出ロジック
- マルチタイムフレームレンダリング機能
- ゾーン無効化メソッド
- **[Volumatic Fair Value Gaps | BigBeluga](tradingview.com/script/OfR2t6z5-Volumatic-Fair-Value-Gaps-BigBeluga/)** by BigBeluga
- フェアバリューギャップ検出アルゴリズム
- ボリューム分解分析
- ミティゲーション追跡システム
その他、以下のコンセプトに基づいています:
- スマートマネーコンセプト(SMC)
- 機関投資家のオーダーフロー
- ボリュームプロファイル分析
オープンソースでトレーディングコミュニティに貢献してくださった原作者の方々に感謝いたします。
## 免責事項
このインジケーターは教育目的のみです。過去のパフォーマンスは将来の結果を示すものではありません。常に適切なリスク管理を実践し、失う余裕のない金額以上をリスクにさらさないでください。
---
**バージョン**: 1.0
**Pine Scriptバージョン**: 6
**チャートタイプ**: すべて
**時間足**: すべて(マルチタイムフレーム分析)
---
# MTF OB & FVG Detector with Alerts
## Overview
This indicator detects **Order Blocks (OB)** and **Fair Value Gaps (FVG)** across multiple timeframes and provides real-time alerts for bounces from these zones. It combines advanced volume analysis with multi-timeframe analysis to identify high-probability support and resistance zones.
## Key Features
### 1. Multi-Timeframe Order Block Detection
- **Supported Timeframes**: 1min, 3min, 5min, 15min, 60min
- Each timeframe can be independently enabled/disabled
- Automatically displays OB zones with precise price levels
- Volume information displayed with bull/bear percentage breakdown
- Color-coded by type: Bullish (Blue) / Bearish (Red) - invertible
### 2. Fair Value Gap (FVG) Detection
- Detects bullish and bearish FVG patterns on current chart timeframe
- Displays volume distribution within gaps
- Color-coded: Bullish (Aqua) / Bearish (Orange) - invertible
- Automatically removes mitigated/broken FVGs
- **Note**: FVG is disabled by default on 1-minute charts to reduce visual clutter, but can be enabled via settings.
### 3. Intelligent Break Detection
- **Order Blocks**: Automatically removed when price breaks through the zone
- Bullish OB: Removed when price breaks below
- Bearish OB: Removed when price breaks above
- **Fair Value Gaps**: Removed when price fully mitigates the gap
- Configurable break method: Wick-based or Body-based
### 4. Advanced Alert System
- **Bounce Alerts**: Triggered when price bounces from OB or FVG zones
- Separate alerts for bullish and bearish bounces
- Includes timeframe information in alert message
- Monitors all enabled timeframes simultaneously
- **New OB Formation Alerts**: Notified when a new Order Block is formed
- **Combined Zone Alerts**: Notified when multiple OBs are combined
- **Configurable threshold**: Set minimum number of OBs (default: 3, range: 2-10)
- Indicates strong confluence zones across multiple timeframes
- Signals high-probability support/resistance areas
- More OBs combined = stronger zone = higher alert priority
- All alerts can be individually enabled/disabled
### 5. Visual Customization
- **Text Display**: Left-aligned text starting 3 bars from current time
- **Zone Extension**: 40 bars forward (configurable)
- **Color Inversion**:
- OB: Toggle between Blue/Red or Red/Blue
- FVG: Toggle between Aqua/Orange or Orange/Aqua
- **Lower Timeframe Display**: Optional display of 1min and 3min zones
### 6. Volume Analysis
- Each OB displays total volume with bull/bear ratio
- Percentage breakdown shows dominant volume side
- FVG shows volume distribution across the gap
#### Understanding the Text Display
**Order Block Text Format:** `[Combined] 5m OB 12.5M (85%)`
- **[Combined]**: Appears when multiple timeframes are merged (optional display)
- **5m OB**: Timeframe identifier (5-minute Order Block)
- **12.5M**: Total volume traded in the OB zone (always in millions with 1 decimal place)
- Examples: 12.5M, 0.8M, 156.3M
- **(85%)**: Percentage of dominant (stronger) volume side
- If bullish: Shows proportion of bullish volume (stronger side)
- If bearish: Shows proportion of bearish volume (stronger side)
- Higher percentage = stronger OB (more one-sided volume)
**Fair Value Gap Text Format:** `15m FVG 8.3M (85%)`
- **15m FVG**: Timeframe identifier (15-minute Fair Value Gap)
- **8.3M**: Total volume in the FVG (always in millions with 1 decimal place)
- Examples: 8.3M, 1.2M, 45.7M
- **(85%)**: Percentage of dominant (stronger) volume side
- If bullish: Shows proportion of bullish volume (stronger side)
- If bearish: Shows proportion of bearish volume (stronger side)
- Higher percentage = stronger FVG (more one-sided volume)
## How to Use
### Basic Setup
1. **Add to Chart**: Search for "MTF OB & FVG detector" in TradingView indicators
2. **Select Timeframes**: Enable desired timeframes (default: 5min, 15min, 60min)
3. **Configure Alerts**: Enable alerts for bounces and new OB formations
### Settings Guide
#### Multi-Timeframe Settings
- **Show Lower Timeframes**: Enable to show 1min and 3min zones (default: ON)
- **Individual Timeframes**: Toggle each timeframe (1m, 3m, 5m, 15m, 60m)
- Recommended: Use 2-3 timeframes to avoid chart clutter
#### General Configuration
- **Zone Count**: Number of OBs per timeframe (Low/Medium/High)
- Medium (5 zones) recommended for multiple timeframes
- High (10 zones) for detailed analysis on fewer timeframes
- **Swing Length**: Sensitivity for OB detection (default: 3)
- Lower values = smaller, more frequent OBs
- Higher values = larger, fewer OBs
- **Break Detection Method**: Choose Wick or Body for OB invalidation
#### Fair Value Gap Settings
- **Show Fair Value Gaps**: Toggle FVG display
- Default: ON (for all timeframes)
- **Show FVG on 1-Minute Charts**: Enable FVG display on 1-minute charts
- Default: OFF (disabled to reduce visual clutter and improve performance)
- Enable if you want to see FVG on 1-minute charts
- **Mitigation Source**: Choose close price or high/low for FVG invalidation
- **Individual Gap Types**: Enable/disable bullish or bearish FVGs separately
#### Alert Settings
- **Enable Alerts**: Master switch for all alerts
- **Alert on Bullish/Bearish Bounce**: Separate toggles for each direction
- **Alert on New OB Formation**: Get notified when new OBs are created
- **Alert on Combined OBs**: Get notified when multiple Order Blocks are combined into one powerful zone
- **Min OBs for Strong Zone Alert**: Set the minimum number of OBs that must be combined to trigger the alert
- Default: 3 (three or more OBs)
- Range: 2-10
- Higher values = more selective, only alerting on the strongest confluence zones
#### Style Settings
- **Invert Colors**:
- OB: Default is Bullish=Red, Bearish=Blue
- FVG: Default is Bullish=Orange, Bearish=Aqua
- **Extend Zones**: Number of bars to extend zones forward (default: 40)
### Trading Strategies
#### 1. Reversal Trading at Combined Zones
- Enable "Combine Overlapping Order Blocks" feature
- Combined zones (e.g., "5m & 15m & 1H") indicate strong support/resistance
- These zones often mark significant turning points
- Wait for price to touch the combined zone with high volume
- Enter on reversal confirmation (candlestick patterns, momentum divergence)
- Stop-loss requires advanced judgment such as using recent lows/highs (placing stops at zone edges results in wide ranges)
#### 2. FVG Filling
- FVGs act as magnets for price
- Trade towards unfilled gaps as targets
- Exit when price fully fills the gap
#### 3. Trend Following with OB/FVG
- Identify the current trend direction
- Only take bounces from OBs/FVGs in trend direction
- In uptrend: Trade only bullish bounces
- In downtrend: Trade only bearish bounces
- Use higher timeframe OBs (15min, 60min) for trend confirmation
- Use lower timeframe OBs (1min, 3min) for precise entries
- Combine with moving averages or trend indicators for best results
## Technical Details
### Order Block Logic
- Detects swing highs/lows using configurable swing length
- Identifies volume accumulation zones before price moves
- Tracks breakout confirmation with breaker candles
- Automatically removes invalidated zones
### Fair Value Gap Logic
- Identifies 3-candle patterns with gap between candles 1 and 3
- Minimum gap size required for validity
- Tracks mitigation as price moves through the gap
- Volume-weighted analysis for gap strength
### Memory Optimization
- Maximum 100 boxes/labels/lines simultaneously
- Automatic cleanup of broken zones
- Optimized for performance with multiple timeframes
- Efficient array management
## Best Practices
1. **Start Simple**: Begin with 2-3 timeframes before adding more
2. **Adjust Zone Count**: Use "Medium" or "Low" when enabling many timeframes
3. **Confirm Bounces**: Don't trade on alerts alone - wait for price confirmation
4. **Use Stop Losses**: Always set stops beyond the zone boundaries
5. **Backtest**: Test the indicator on historical data before live trading
6. **Combine with Other Tools**: Use with trend indicators, volume profile, etc.
## Limitations
- Maximum of 100 boxes can be displayed simultaneously
- FVG detection is limited to current chart timeframe
- More timeframes enabled = fewer zones per timeframe can be shown
- Historical zones may disappear if box limit is reached
## Support and Updates
For questions, bug reports, or feature requests, please comment on the indicator page or contact the author.
## Credits
This indicator integrates and enhances features from the following excellent TradingView indicators:
- **[Order Blocks | Flux Charts](tradingview.com/script/bLdpFVuq-Order-Blocks-Flux-Charts/)** by fluxchart
- Order Block detection logic with volumetric information
- Multi-timeframe rendering capabilities
- Zone invalidation methods
- **[Volumatic Fair Value Gaps | BigBeluga](tradingview.com/script/OfR2t6z5-Volumatic-Fair-Value-Gaps-BigBeluga/)** by BigBeluga
- Fair Value Gap detection algorithm
- Volume decomposition analysis
- Mitigation tracking system
Additional concepts based on:
- Smart Money Concepts (SMC)
- Institutional Order Flow
- Volume Profile Analysis
Special thanks to the original authors for their open-source contributions to the trading community.
## Disclaimer
This indicator is for educational purposes only. Past performance is not indicative of future results. Always practice proper risk management and never risk more than you can afford to lose.
---
**Version**: 1.0
**Pine Script Version**: 6
**Chart Type**: Any
**Timeframe**: Any (multi-timeframe analysis)
## 概要
このインジケーターは、複数の時間足で**オーダーブロック(OB)**と**フェアバリューギャップ(FVG)**を検出し、これらのゾーンからの反発をリアルタイムでアラート通知します。高度なボリューム分析とマルチタイムフレーム分析を組み合わせ、高確率のサポート・レジスタンスゾーンを特定します。
## 主な機能
### 1. マルチタイムフレーム オーダーブロック検出
- **対応時間足**: 1分、3分、5分、15分、60分
- 各時間足を個別に有効/無効化可能
- 正確な価格レベルでOBゾーンを自動表示
- ブル/ベア比率の内訳を含むボリューム情報表示
- タイプ別色分け: ブリッシュ(青)/ ベアリッシュ(赤)- 反転可能
### 2. フェアバリューギャップ(FVG)検出
- 現在のチャート時間足でブリッシュ・ベアリッシュFVGパターンを検出
- ギャップ内のボリューム分布を表示
- 色分け: ブリッシュ(アクア)/ ベアリッシュ(オレンジ)- 反転可能
- ミティゲート/ブレイクされたFVGを自動削除
- **注意**: 1分足チャートではデフォルトでFVGは無効化されていますが、設定で有効化できます。
### 3. インテリジェントなブレイク検出
- **オーダーブロック**: 価格がゾーンを突破すると自動削除
- ブリッシュOB: 価格が下に抜けると削除
- ベアリッシュOB: 価格が上に抜けると削除
- **フェアバリューギャップ**: 価格がギャップを完全にミティゲートすると削除
- ブレイク方法の設定: ヒゲベースまたは実体ベース
### 4. 高度なアラートシステム
- **反発アラート**: 価格がOBまたはFVGゾーンから反発した際にトリガー
- ブリッシュとベアリッシュで個別アラート
- アラートメッセージに時間足情報を含む
- 有効化されたすべての時間足を同時監視
- **新規OB形成アラート**: 新しいオーダーブロックが形成されたときに通知
- **統合ゾーンアラート**: 複数のOBが統合されたときに通知
- **設定可能な閾値**: 最小OB統合数を設定(デフォルト: 3、範囲: 2-10)
- 複数時間足にわたる強力なコンフルエンスゾーンを示す
- 高確率のサポート/レジスタンスエリアを警告
- より多くのOBが統合 = より強力なゾーン = より高いアラート優先度
- すべてのアラートを個別に有効/無効化可能
### 5. ビジュアルカスタマイズ
- **テキスト表示**: 現在時刻の3バー右から左寄せで表示
- **ゾーン延長**: 40バー先まで延長(設定可能)
- **色の反転**:
- OB: 青/赤 または 赤/青 の切り替え
- FVG: アクア/オレンジ または オレンジ/アクア の切り替え
- **下位時間足表示**: 1分足と3分足ゾーンのオプション表示
### 6. ボリューム分析
- 各OBにブル/ベア比率を含む総ボリュームを表示
- パーセンテージ内訳で優勢なボリューム側を表示
- FVGはギャップ全体のボリューム分布を表示
#### テキスト表示の見方
**オーダーブロックのテキスト形式:** `[Combined] 5m OB 12.5M (85%)`
- **[Combined]**: 複数の時間足が統合された場合に表示(オプション表示)
- **5m OB**: 時間足の識別子(5分足オーダーブロック)
- **12.5M**: OBゾーンで取引された総ボリューム(常に百万単位で小数点第1位まで表示)
- 例: 12.5M、0.8M、156.3M
- **(85%)**: 優勢(強い側)のボリュームの割合
- ブリッシュOBの場合: ブリッシュボリュームの割合(強い側)
- ベアリッシュOBの場合: ベアリッシュボリュームの割合(強い側)
- パーセンテージが高い = より強力なOB(一方的なボリューム)
**フェアバリューギャップのテキスト形式:** `15m FVG 8.3M (85%)`
- **15m FVG**: 時間足の識別子(15分足フェアバリューギャップ)
- **8.3M**: FVGの総ボリューム(常に百万単位で小数点第1位まで表示)
- 例: 8.3M、1.2M、45.7M
- **(85%)**: 優勢(強い側)のボリュームの割合
- ブリッシュFVGの場合: ブリッシュボリュームの割合(強い側)
- ベアリッシュFVGの場合: ベアリッシュボリュームの割合(強い側)
- パーセンテージが高い = より強力なFVG(一方的なボリューム)
## 使用方法
### 基本セットアップ
1. **チャートに追加**: TradingViewのインジケーターで「MTF OB & FVG detector」を検索
2. **時間足を選択**: 希望の時間足を有効化(デフォルト: 5分、15分、60分)
3. **アラート設定**: 反発と新規OB形成のアラートを有効化
### 設定ガイド
#### マルチタイムフレーム設定
- **Show Lower Timeframes**: 1分足と3分足ゾーンを表示(デフォルト: ON)
- **各時間足**: 各時間足(1m, 3m, 5m, 15m, 60m)の個別切り替え
- 推奨: チャートの混雑を避けるため2-3個の時間足を使用
#### 一般設定
- **Zone Count**: 時間足あたりのOB数(Low/Medium/High)
- Medium(5ゾーン): 複数時間足使用時に推奨
- High(10ゾーン): 少数時間足での詳細分析用
- **Swing Length**: OB検出の感度(デフォルト: 3)
- 低い値 = より小さく、より頻繁なOB
- 高い値 = より大きく、より少数のOB
- **Break Detection Method**: OB無効化にWickまたはBodyを選択
#### フェアバリューギャップ設定
- **Show Fair Value Gaps**: FVG表示の切り替え
- デフォルト: ON(すべての時間足)
- **Show FVG on 1-Minute Charts**: 1分足チャートでのFVG表示を有効化
- デフォルト: OFF(視覚的な混雑を減らしパフォーマンスを向上させるため無効)
- 1分足でもFVGを表示したい場合は有効化してください
- **Mitigation Source**: FVG無効化に終値またはhigh/lowを選択
- **Individual Gap Types**: ブリッシュまたはベアリッシュFVGを個別に有効/無効化
#### アラート設定
- **Enable Alerts**: すべてのアラートのマスタースイッチ
- **Alert on Bullish/Bearish Bounce**: 各方向の個別切り替え
- **Alert on New OB Formation**: 新しいOBが作成されたときに通知
- **Alert on Combined OBs**: 複数のOrder Blockが1つの強力なゾーンに統合されたときに通知
- **Min OBs for Strong Zone Alert**: アラートをトリガーするために必要な最小OB統合数を設定
- デフォルト: 3(3つ以上のOB)
- 範囲: 2-10
- 値が高い = より厳選的、最も強力なコンフルエンスゾーンのみをアラート
#### スタイル設定
- **Invert Colors**:
- OB: デフォルトはブリッシュ=赤、ベアリッシュ=青
- FVG: デフォルトはブリッシュ=オレンジ、ベアリッシュ=アクア
- **Extend Zones**: ゾーンを前方に延長するバー数(デフォルト: 40)
### トレーディング戦略
#### 1. 統合ゾーンでの反転取引
- 「Combine Overlapping Order Blocks」機能を有効化
- 統合ゾーン(例:「5m & 15m & 1H」)は強力なサポート/レジスタンスを示す
- これらのゾーンは重要な転換点を示すことが多い
- 価格が高ボリュームで統合ゾーンにタッチするのを待つ
- 反転確認(ローソク足パターン、モメンタムダイバージェンス)でエントリー
- ストップロスは直近安値、直近高値を指定する等の高度な判断が必要(ゾーン端をストップロスにすると値幅が大きくなってしまうため)
#### 2. FVGフィリング
- FVGは価格の磁石として機能
- 未充填のギャップに向けてトレード
- 価格がギャップを完全に埋めたら決済
#### 3. OB/FVGを使ったトレンドフォロー
- 現在のトレンド方向を特定
- トレンド方向のOB/FVGからの反発のみを取引
- 上昇トレンド: ブリッシュ反発のみを取引
- 下降トレンド: ベアリッシュ反発のみを取引
- 上位時間足のOB(15分、60分)をトレンド確認に使用
- 下位時間足のOB(1分、3分)を精密なエントリーに使用
- 移動平均線やトレンドインジケーターと組み合わせると最良の結果
## 技術詳細
### オーダーブロックのロジック
- 設定可能なスイング長を使用してスイング高値/安値を検出
- 価格移動前のボリューム蓄積ゾーンを特定
- ブレイカーキャンドルでブレイクアウト確認を追跡
- 無効化されたゾーンを自動削除
### フェアバリューギャップのロジック
- キャンドル1と3の間にギャップがある3キャンドルパターンを識別
- 有効性のための最小ギャップサイズが必要
- 価格がギャップを通過する際のミティゲーションを追跡
- ギャップの強度のためのボリューム加重分析
### メモリ最適化
- 最大100個のボックス/ラベル/ラインを同時表示
- ブレイクされたゾーンの自動クリーンアップ
- 複数時間足でのパフォーマンスに最適化
- 効率的な配列管理
## ベストプラクティス
1. **シンプルに始める**: 最初は2-3個の時間足から始める
2. **ゾーン数を調整**: 多くの時間足を有効化する場合は「Medium」または「Low」を使用
3. **反発を確認**: アラートだけでトレードせず、価格確認を待つ
4. **ストップロスを使用**: 必ずゾーン境界を超えてストップを設定
5. **バックテスト**: ライブトレード前に過去データでテスト
6. **他のツールと組み合わせ**: トレンドインジケーター、ボリュームプロファイルなどと併用
## 制限事項
- 同時に最大100個のボックスを表示可能
- FVG検出は現在のチャート時間足に限定
- 有効化する時間足が多いほど、時間足あたりに表示できるゾーンが少なくなる
- ボックス上限に達すると、過去のゾーンが消える場合がある
## サポートとアップデート
質問、バグレポート、または機能リクエストについては、インジケーターページにコメントするか、作成者に連絡してください。
## クレジット
このインジケーターは、以下の優れたTradingViewインジケーターの機能を統合・強化しています:
- **[Order Blocks | Flux Charts](tradingview.com/script/bLdpFVuq-Order-Blocks-Flux-Charts/)** by fluxchart
- ボリューム情報を含むオーダーブロック検出ロジック
- マルチタイムフレームレンダリング機能
- ゾーン無効化メソッド
- **[Volumatic Fair Value Gaps | BigBeluga](tradingview.com/script/OfR2t6z5-Volumatic-Fair-Value-Gaps-BigBeluga/)** by BigBeluga
- フェアバリューギャップ検出アルゴリズム
- ボリューム分解分析
- ミティゲーション追跡システム
その他、以下のコンセプトに基づいています:
- スマートマネーコンセプト(SMC)
- 機関投資家のオーダーフロー
- ボリュームプロファイル分析
オープンソースでトレーディングコミュニティに貢献してくださった原作者の方々に感謝いたします。
## 免責事項
このインジケーターは教育目的のみです。過去のパフォーマンスは将来の結果を示すものではありません。常に適切なリスク管理を実践し、失う余裕のない金額以上をリスクにさらさないでください。
---
**バージョン**: 1.0
**Pine Scriptバージョン**: 6
**チャートタイプ**: すべて
**時間足**: すべて(マルチタイムフレーム分析)
---
# MTF OB & FVG Detector with Alerts
## Overview
This indicator detects **Order Blocks (OB)** and **Fair Value Gaps (FVG)** across multiple timeframes and provides real-time alerts for bounces from these zones. It combines advanced volume analysis with multi-timeframe analysis to identify high-probability support and resistance zones.
## Key Features
### 1. Multi-Timeframe Order Block Detection
- **Supported Timeframes**: 1min, 3min, 5min, 15min, 60min
- Each timeframe can be independently enabled/disabled
- Automatically displays OB zones with precise price levels
- Volume information displayed with bull/bear percentage breakdown
- Color-coded by type: Bullish (Blue) / Bearish (Red) - invertible
### 2. Fair Value Gap (FVG) Detection
- Detects bullish and bearish FVG patterns on current chart timeframe
- Displays volume distribution within gaps
- Color-coded: Bullish (Aqua) / Bearish (Orange) - invertible
- Automatically removes mitigated/broken FVGs
- **Note**: FVG is disabled by default on 1-minute charts to reduce visual clutter, but can be enabled via settings.
### 3. Intelligent Break Detection
- **Order Blocks**: Automatically removed when price breaks through the zone
- Bullish OB: Removed when price breaks below
- Bearish OB: Removed when price breaks above
- **Fair Value Gaps**: Removed when price fully mitigates the gap
- Configurable break method: Wick-based or Body-based
### 4. Advanced Alert System
- **Bounce Alerts**: Triggered when price bounces from OB or FVG zones
- Separate alerts for bullish and bearish bounces
- Includes timeframe information in alert message
- Monitors all enabled timeframes simultaneously
- **New OB Formation Alerts**: Notified when a new Order Block is formed
- **Combined Zone Alerts**: Notified when multiple OBs are combined
- **Configurable threshold**: Set minimum number of OBs (default: 3, range: 2-10)
- Indicates strong confluence zones across multiple timeframes
- Signals high-probability support/resistance areas
- More OBs combined = stronger zone = higher alert priority
- All alerts can be individually enabled/disabled
### 5. Visual Customization
- **Text Display**: Left-aligned text starting 3 bars from current time
- **Zone Extension**: 40 bars forward (configurable)
- **Color Inversion**:
- OB: Toggle between Blue/Red or Red/Blue
- FVG: Toggle between Aqua/Orange or Orange/Aqua
- **Lower Timeframe Display**: Optional display of 1min and 3min zones
### 6. Volume Analysis
- Each OB displays total volume with bull/bear ratio
- Percentage breakdown shows dominant volume side
- FVG shows volume distribution across the gap
#### Understanding the Text Display
**Order Block Text Format:** `[Combined] 5m OB 12.5M (85%)`
- **[Combined]**: Appears when multiple timeframes are merged (optional display)
- **5m OB**: Timeframe identifier (5-minute Order Block)
- **12.5M**: Total volume traded in the OB zone (always in millions with 1 decimal place)
- Examples: 12.5M, 0.8M, 156.3M
- **(85%)**: Percentage of dominant (stronger) volume side
- If bullish: Shows proportion of bullish volume (stronger side)
- If bearish: Shows proportion of bearish volume (stronger side)
- Higher percentage = stronger OB (more one-sided volume)
**Fair Value Gap Text Format:** `15m FVG 8.3M (85%)`
- **15m FVG**: Timeframe identifier (15-minute Fair Value Gap)
- **8.3M**: Total volume in the FVG (always in millions with 1 decimal place)
- Examples: 8.3M, 1.2M, 45.7M
- **(85%)**: Percentage of dominant (stronger) volume side
- If bullish: Shows proportion of bullish volume (stronger side)
- If bearish: Shows proportion of bearish volume (stronger side)
- Higher percentage = stronger FVG (more one-sided volume)
## How to Use
### Basic Setup
1. **Add to Chart**: Search for "MTF OB & FVG detector" in TradingView indicators
2. **Select Timeframes**: Enable desired timeframes (default: 5min, 15min, 60min)
3. **Configure Alerts**: Enable alerts for bounces and new OB formations
### Settings Guide
#### Multi-Timeframe Settings
- **Show Lower Timeframes**: Enable to show 1min and 3min zones (default: ON)
- **Individual Timeframes**: Toggle each timeframe (1m, 3m, 5m, 15m, 60m)
- Recommended: Use 2-3 timeframes to avoid chart clutter
#### General Configuration
- **Zone Count**: Number of OBs per timeframe (Low/Medium/High)
- Medium (5 zones) recommended for multiple timeframes
- High (10 zones) for detailed analysis on fewer timeframes
- **Swing Length**: Sensitivity for OB detection (default: 3)
- Lower values = smaller, more frequent OBs
- Higher values = larger, fewer OBs
- **Break Detection Method**: Choose Wick or Body for OB invalidation
#### Fair Value Gap Settings
- **Show Fair Value Gaps**: Toggle FVG display
- Default: ON (for all timeframes)
- **Show FVG on 1-Minute Charts**: Enable FVG display on 1-minute charts
- Default: OFF (disabled to reduce visual clutter and improve performance)
- Enable if you want to see FVG on 1-minute charts
- **Mitigation Source**: Choose close price or high/low for FVG invalidation
- **Individual Gap Types**: Enable/disable bullish or bearish FVGs separately
#### Alert Settings
- **Enable Alerts**: Master switch for all alerts
- **Alert on Bullish/Bearish Bounce**: Separate toggles for each direction
- **Alert on New OB Formation**: Get notified when new OBs are created
- **Alert on Combined OBs**: Get notified when multiple Order Blocks are combined into one powerful zone
- **Min OBs for Strong Zone Alert**: Set the minimum number of OBs that must be combined to trigger the alert
- Default: 3 (three or more OBs)
- Range: 2-10
- Higher values = more selective, only alerting on the strongest confluence zones
#### Style Settings
- **Invert Colors**:
- OB: Default is Bullish=Red, Bearish=Blue
- FVG: Default is Bullish=Orange, Bearish=Aqua
- **Extend Zones**: Number of bars to extend zones forward (default: 40)
### Trading Strategies
#### 1. Reversal Trading at Combined Zones
- Enable "Combine Overlapping Order Blocks" feature
- Combined zones (e.g., "5m & 15m & 1H") indicate strong support/resistance
- These zones often mark significant turning points
- Wait for price to touch the combined zone with high volume
- Enter on reversal confirmation (candlestick patterns, momentum divergence)
- Stop-loss requires advanced judgment such as using recent lows/highs (placing stops at zone edges results in wide ranges)
#### 2. FVG Filling
- FVGs act as magnets for price
- Trade towards unfilled gaps as targets
- Exit when price fully fills the gap
#### 3. Trend Following with OB/FVG
- Identify the current trend direction
- Only take bounces from OBs/FVGs in trend direction
- In uptrend: Trade only bullish bounces
- In downtrend: Trade only bearish bounces
- Use higher timeframe OBs (15min, 60min) for trend confirmation
- Use lower timeframe OBs (1min, 3min) for precise entries
- Combine with moving averages or trend indicators for best results
## Technical Details
### Order Block Logic
- Detects swing highs/lows using configurable swing length
- Identifies volume accumulation zones before price moves
- Tracks breakout confirmation with breaker candles
- Automatically removes invalidated zones
### Fair Value Gap Logic
- Identifies 3-candle patterns with gap between candles 1 and 3
- Minimum gap size required for validity
- Tracks mitigation as price moves through the gap
- Volume-weighted analysis for gap strength
### Memory Optimization
- Maximum 100 boxes/labels/lines simultaneously
- Automatic cleanup of broken zones
- Optimized for performance with multiple timeframes
- Efficient array management
## Best Practices
1. **Start Simple**: Begin with 2-3 timeframes before adding more
2. **Adjust Zone Count**: Use "Medium" or "Low" when enabling many timeframes
3. **Confirm Bounces**: Don't trade on alerts alone - wait for price confirmation
4. **Use Stop Losses**: Always set stops beyond the zone boundaries
5. **Backtest**: Test the indicator on historical data before live trading
6. **Combine with Other Tools**: Use with trend indicators, volume profile, etc.
## Limitations
- Maximum of 100 boxes can be displayed simultaneously
- FVG detection is limited to current chart timeframe
- More timeframes enabled = fewer zones per timeframe can be shown
- Historical zones may disappear if box limit is reached
## Support and Updates
For questions, bug reports, or feature requests, please comment on the indicator page or contact the author.
## Credits
This indicator integrates and enhances features from the following excellent TradingView indicators:
- **[Order Blocks | Flux Charts](tradingview.com/script/bLdpFVuq-Order-Blocks-Flux-Charts/)** by fluxchart
- Order Block detection logic with volumetric information
- Multi-timeframe rendering capabilities
- Zone invalidation methods
- **[Volumatic Fair Value Gaps | BigBeluga](tradingview.com/script/OfR2t6z5-Volumatic-Fair-Value-Gaps-BigBeluga/)** by BigBeluga
- Fair Value Gap detection algorithm
- Volume decomposition analysis
- Mitigation tracking system
Additional concepts based on:
- Smart Money Concepts (SMC)
- Institutional Order Flow
- Volume Profile Analysis
Special thanks to the original authors for their open-source contributions to the trading community.
## Disclaimer
This indicator is for educational purposes only. Past performance is not indicative of future results. Always practice proper risk management and never risk more than you can afford to lose.
---
**Version**: 1.0
**Pine Script Version**: 6
**Chart Type**: Any
**Timeframe**: Any (multi-timeframe analysis)
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。