OPEN-SOURCE SCRIPT
Frahm Factor

Intended Usage of the Frahm Factor Indicator
The Frahm Factor is designed to give you a rapid, at-a-glance assessment of how volatile the market is right now—and how large the average candle has been—over the most recent 24-hour window. Here’s how to put it to work:
Gauge Volatility Regimes
Volatility Score (1–10)
A low score (1–3, green) signals calm seas—tight ranges, low risk of big moves.
A mid score (4–6, yellow) warns you that volatility is picking up.
A high score (7–10, red) tells you to prepare for disorderly swings or breakout opportunities.
How to trade off it
In low-volatility periods, you might favor mean-reversion or range-bound strategies.
As the score climbs into the red zone, consider widening stops, scaling back position size, or switching to breakout momentum plays.
Monitor Average Candle Size
Avg Candle (ticks) cell shows you the mean true-range of each bar over that 24h window in ticks.
When candles are small, you know the market is consolidating and liquidity may be thin.
When candles are large, momentum and volume are driving strong directional bias.
The optional dynamic color ramp (green→yellow→red) immediately flags when average bar size is unusually small or large versus its own 24h history.
Customize & Stay Flexible
Timeframes: Works on any intraday chart—from 1-minute scalping to 4-hour swing setups—because it always looks back exactly 24 hours.
Toggles:
Show or hide the Volatility and Avg-Candle cells to keep your screen uncluttered.
Turn on the dynamic color ramp only when you want that extra visual cue.
Alerts: Built-in alerts fire automatically at meaningful thresholds (Volatility ≥ 8 or ≤ 3), so you’ll never miss regime shifts, even if you step away.
Real-World Applications
Risk Management: Automatically adjust your stop-loss distances or position sizing based on the current volatility band.
Strategy Selection: Flip between range-trading and momentum strategies as the volatility regime changes.
Session Analysis: Pinpoint when during the day volatility typically ramps—perfect for doorway sessions like London opening or the US midday news spikes.
Bottom line: the Frahm Factor gives you one compact dashboard to see the pulse of the market—so you can make choices with conviction, dial your risk in real time, and never be caught off guard by sudden volatility shifts.
Logic Behind the Frahm Factor Indicator
24-Hour Rolling Window
On every intraday bar, we append that bar’s True Range (TR) and timestamp to two arrays.
We then prune any entries older than 24 hours, so the arrays always reflect exactly the last day of data.
Volatility Score (1–10)
We count how many of those 24 h TR values are less than or equal to the current bar’s TR.
Dividing by the total array size gives a percentile (0–1), which we scale and round into a 1–10 score.
Average Candle Size (ticks)
We sum all TR values in the same 24 h window, divide by array length to get the mean TR, then convert that price range into ticks.
Optionally, a green→yellow→red ramp highlights when average bar size is unusually small, medium or large versus its own 24 h history.
Color & Alerts
The Volatility cell flips green (1–3), yellow (4–6) or red (7–10) so you see regime shifts at a glance.
Built-in alertcondition calls fire when the score crosses your high (≥ 8) or low (≤ 3) thresholds.
Modularity
Everything—table location, which cells to show, dynamic coloring—is controlled by simple toggles, so you can strip it back or layer on extra visual cues as needed.
That’s the full recipe: a true 24 h look-back, a percentile-ranked volatility gauge, and a mean-bar-size meter, all wrapped into one compact dashboard.
The Frahm Factor is designed to give you a rapid, at-a-glance assessment of how volatile the market is right now—and how large the average candle has been—over the most recent 24-hour window. Here’s how to put it to work:
Gauge Volatility Regimes
Volatility Score (1–10)
A low score (1–3, green) signals calm seas—tight ranges, low risk of big moves.
A mid score (4–6, yellow) warns you that volatility is picking up.
A high score (7–10, red) tells you to prepare for disorderly swings or breakout opportunities.
How to trade off it
In low-volatility periods, you might favor mean-reversion or range-bound strategies.
As the score climbs into the red zone, consider widening stops, scaling back position size, or switching to breakout momentum plays.
Monitor Average Candle Size
Avg Candle (ticks) cell shows you the mean true-range of each bar over that 24h window in ticks.
When candles are small, you know the market is consolidating and liquidity may be thin.
When candles are large, momentum and volume are driving strong directional bias.
The optional dynamic color ramp (green→yellow→red) immediately flags when average bar size is unusually small or large versus its own 24h history.
Customize & Stay Flexible
Timeframes: Works on any intraday chart—from 1-minute scalping to 4-hour swing setups—because it always looks back exactly 24 hours.
Toggles:
Show or hide the Volatility and Avg-Candle cells to keep your screen uncluttered.
Turn on the dynamic color ramp only when you want that extra visual cue.
Alerts: Built-in alerts fire automatically at meaningful thresholds (Volatility ≥ 8 or ≤ 3), so you’ll never miss regime shifts, even if you step away.
Real-World Applications
Risk Management: Automatically adjust your stop-loss distances or position sizing based on the current volatility band.
Strategy Selection: Flip between range-trading and momentum strategies as the volatility regime changes.
Session Analysis: Pinpoint when during the day volatility typically ramps—perfect for doorway sessions like London opening or the US midday news spikes.
Bottom line: the Frahm Factor gives you one compact dashboard to see the pulse of the market—so you can make choices with conviction, dial your risk in real time, and never be caught off guard by sudden volatility shifts.
Logic Behind the Frahm Factor Indicator
24-Hour Rolling Window
On every intraday bar, we append that bar’s True Range (TR) and timestamp to two arrays.
We then prune any entries older than 24 hours, so the arrays always reflect exactly the last day of data.
Volatility Score (1–10)
We count how many of those 24 h TR values are less than or equal to the current bar’s TR.
Dividing by the total array size gives a percentile (0–1), which we scale and round into a 1–10 score.
Average Candle Size (ticks)
We sum all TR values in the same 24 h window, divide by array length to get the mean TR, then convert that price range into ticks.
Optionally, a green→yellow→red ramp highlights when average bar size is unusually small, medium or large versus its own 24 h history.
Color & Alerts
The Volatility cell flips green (1–3), yellow (4–6) or red (7–10) so you see regime shifts at a glance.
Built-in alertcondition calls fire when the score crosses your high (≥ 8) or low (≤ 3) thresholds.
Modularity
Everything—table location, which cells to show, dynamic coloring—is controlled by simple toggles, so you can strip it back or layer on extra visual cues as needed.
That’s the full recipe: a true 24 h look-back, a percentile-ranked volatility gauge, and a mean-bar-size meter, all wrapped into one compact dashboard.
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。