OPEN-SOURCE SCRIPT
True Range Percentage MACD

True Range Percentage MACD (TR% MACD) is a volatility-oscillator that measures relative range movement and applies MACD logic to identify volatility momentum cycles.
What it measures
True Range (TR) captures intrabar range plus gap effects.
This script converts TR into a percentage of price:
TR%=TR×100 / ∣Sourcet−1∣
(Source defaults to HL2 and uses the prior bar value for normalization; a minimum tick guard is applied to avoid division by zero.)
Smoothing
TR% can be smoothed using a selectable moving average type (EMA, SMA, RMA, VWMA, WMA, ALMA, SWMA, HMA, or NONE) and a dedicated smoothing length. This helps control noise before MACD processing.
MACD on volatility
The indicator then computes:
MACD = MA(TR%)fast − MA(TR%)slow
Signal = MA(MACD)signal
Histogram = MACD − Signal
Interpretation
This is not a price-trend MACD—it's a volatility momentum MACD:
Rising histogram often indicates increasing relative volatility (range expansion accelerating).
Falling histogram often indicates volatility cooling (range expansion decelerating / contracting).
Crossovers can help time transitions between quiet and active regimes, and complement trend systems (e.g., filter breakouts to periods of rising volatility).
Visuals & alerts
Histogram uses a 4-state coloring (positive/negative + rising/falling).
Optional plot shows smoothed TR%.
Built-in alerts:
histogram rising→falling and falling→rising state flips
MACD crossing Signal (up/down)
MACD crossing zero (up/down)
What it measures
True Range (TR) captures intrabar range plus gap effects.
This script converts TR into a percentage of price:
TR%=TR×100 / ∣Sourcet−1∣
(Source defaults to HL2 and uses the prior bar value for normalization; a minimum tick guard is applied to avoid division by zero.)
Smoothing
TR% can be smoothed using a selectable moving average type (EMA, SMA, RMA, VWMA, WMA, ALMA, SWMA, HMA, or NONE) and a dedicated smoothing length. This helps control noise before MACD processing.
MACD on volatility
The indicator then computes:
MACD = MA(TR%)fast − MA(TR%)slow
Signal = MA(MACD)signal
Histogram = MACD − Signal
Interpretation
This is not a price-trend MACD—it's a volatility momentum MACD:
Rising histogram often indicates increasing relative volatility (range expansion accelerating).
Falling histogram often indicates volatility cooling (range expansion decelerating / contracting).
Crossovers can help time transitions between quiet and active regimes, and complement trend systems (e.g., filter breakouts to periods of rising volatility).
Visuals & alerts
Histogram uses a 4-state coloring (positive/negative + rising/falling).
Optional plot shows smoothed TR%.
Built-in alerts:
histogram rising→falling and falling→rising state flips
MACD crossing Signal (up/down)
MACD crossing zero (up/down)
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.