OPEN-SOURCE SCRIPT
Hawkes Volatility Exit Indicator

Overview
The Hawkes Volatility Exit Indicator is a powerful tool designed to help traders capitalize on volatility breakouts and exit positions when momentum fades. Built on the Hawkes process, it models volatility clustering to identify optimal entry points after quiet periods and exit signals during volatility cooling. Designed to be helpful for swing traders and trend followers across markets like stocks, forex, and crypto.
Key Features Volatility-Based Entries: Detects breakouts when volatility spikes above the 95th percentile (adjustable) after quiet periods (below 5th percentile).
This indicator is probably better on exits than entries.
Smart Exit Signals: Triggers exits when volatility drops below a customizable threshold (default: 30th percentile) after a minimum hold period.
Hawkes Process: Uses a decay-based model (kappa) to capture volatility clustering, making it responsive to market dynamics.
Visual Clarity: Includes a volatility line, exit threshold, percentile bands, and intuitive markers (triangles for entries, X for exits).
Status Table: Displays real-time data on position (LONG/SHORT/FLAT), volatility regime (HIGH/LOW/NORMAL), bars held, and exit readiness.
Customizable Alerts: Set alerts for breakouts and exits to stay on top of trading opportunities.
How It Works Quiet Periods: Identifies low volatility (below 5th percentile) that often precede significant moves.
Breakout Entries: Signals bullish (triangle up) or bearish (triangle down) entries when volatility spikes post-quiet period.
Exit Signals: Suggests exiting when volatility cools below the exit threshold after a minimum hold (default: 3 bars).
Visuals & Table: Tracks volatility, position status, and signals via lines, shaded zones, and a detailed status table.
Settings
Hawkes Kappa (0.1): Adjusts volatility decay (lower = smoother, higher = more sensitive).
Volatility Lookback (168): Sets the period for percentile calculations.
ATR Periods (14): Normalizes volatility using Average True Range.
Breakout Threshold (95%): Volatility percentile for entries.
Exit Threshold (30%): Volatility percentile for exits.
Quiet Threshold (5%): Defines quiet periods.
Minimum Hold Bars (3): Ensures positions are held before exiting.
Alerts: Enable/disable breakout and exit alerts.
How to Use
Entries: Look for triangle markers (up for long, down for short) and confirm with the status table showing "ENTRY" and "LONG"/"SHORT."
Exits: Exit on X cross markers when the status table shows "EXIT" and "Exit Ready: YES."
Monitoring: Use the status table to track position, bars held, and volatility regime (HIGH/LOW/NORMAL).
Combine: Pair with price action, support/resistance, or other indicators for better context.
Tips : Adjust thresholds for your market: lower breakout thresholds for more signals, higher exit thresholds for earlier exits.
Test on your asset to ensure compatibility (best for markets with volatility clustering).
Use alerts to automate signal detection.
Limitations Requires sufficient data (default: 168 bars) for reliable signals. Check "Data Status" in the table.
Focuses on volatility, not price direction—combine with trend tools.
May lag slightly due to the smoothing nature of the Hawkes process.
Why Use It?
The Hawkes Volatility Exit Indicator offers a unique, data-driven approach to timing trades based on volatility dynamics. Its clear visuals, customizable settings, and real-time status table make it a valuable addition to any trader’s toolkit. Try it to catch breakouts and exit with precision!
This indicator is based on neurotrader888's python repo. All credit to him. All mistakes mine.
This conversion published for wider attention to the Hawkes method.
The Hawkes Volatility Exit Indicator is a powerful tool designed to help traders capitalize on volatility breakouts and exit positions when momentum fades. Built on the Hawkes process, it models volatility clustering to identify optimal entry points after quiet periods and exit signals during volatility cooling. Designed to be helpful for swing traders and trend followers across markets like stocks, forex, and crypto.
Key Features Volatility-Based Entries: Detects breakouts when volatility spikes above the 95th percentile (adjustable) after quiet periods (below 5th percentile).
This indicator is probably better on exits than entries.
Smart Exit Signals: Triggers exits when volatility drops below a customizable threshold (default: 30th percentile) after a minimum hold period.
Hawkes Process: Uses a decay-based model (kappa) to capture volatility clustering, making it responsive to market dynamics.
Visual Clarity: Includes a volatility line, exit threshold, percentile bands, and intuitive markers (triangles for entries, X for exits).
Status Table: Displays real-time data on position (LONG/SHORT/FLAT), volatility regime (HIGH/LOW/NORMAL), bars held, and exit readiness.
Customizable Alerts: Set alerts for breakouts and exits to stay on top of trading opportunities.
How It Works Quiet Periods: Identifies low volatility (below 5th percentile) that often precede significant moves.
Breakout Entries: Signals bullish (triangle up) or bearish (triangle down) entries when volatility spikes post-quiet period.
Exit Signals: Suggests exiting when volatility cools below the exit threshold after a minimum hold (default: 3 bars).
Visuals & Table: Tracks volatility, position status, and signals via lines, shaded zones, and a detailed status table.
Settings
Hawkes Kappa (0.1): Adjusts volatility decay (lower = smoother, higher = more sensitive).
Volatility Lookback (168): Sets the period for percentile calculations.
ATR Periods (14): Normalizes volatility using Average True Range.
Breakout Threshold (95%): Volatility percentile for entries.
Exit Threshold (30%): Volatility percentile for exits.
Quiet Threshold (5%): Defines quiet periods.
Minimum Hold Bars (3): Ensures positions are held before exiting.
Alerts: Enable/disable breakout and exit alerts.
How to Use
Entries: Look for triangle markers (up for long, down for short) and confirm with the status table showing "ENTRY" and "LONG"/"SHORT."
Exits: Exit on X cross markers when the status table shows "EXIT" and "Exit Ready: YES."
Monitoring: Use the status table to track position, bars held, and volatility regime (HIGH/LOW/NORMAL).
Combine: Pair with price action, support/resistance, or other indicators for better context.
Tips : Adjust thresholds for your market: lower breakout thresholds for more signals, higher exit thresholds for earlier exits.
Test on your asset to ensure compatibility (best for markets with volatility clustering).
Use alerts to automate signal detection.
Limitations Requires sufficient data (default: 168 bars) for reliable signals. Check "Data Status" in the table.
Focuses on volatility, not price direction—combine with trend tools.
May lag slightly due to the smoothing nature of the Hawkes process.
Why Use It?
The Hawkes Volatility Exit Indicator offers a unique, data-driven approach to timing trades based on volatility dynamics. Its clear visuals, customizable settings, and real-time status table make it a valuable addition to any trader’s toolkit. Try it to catch breakouts and exit with precision!
This indicator is based on neurotrader888's python repo. All credit to him. All mistakes mine.
This conversion published for wider attention to the Hawkes method.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.