OPEN-SOURCE SCRIPT
Trend BG v2

Trend BG v2 colors the chart background based on Directional Movement (DM) and DI strength. It provides an easy visual way to identify trending and non-trending conditions on any timeframe.
How It Works
The script calculates:
Upward Directional Movement (DM+)
Downward Directional Movement (DM–)
True Range smoothed with RMA (14-period)
Positive DI and Negative DI values from classic ADX logic
The trend state is determined by comparing +DI vs –DI:
+DI > –DI → Uptrend
–DI > +DI → Downtrend
Otherwise → Neutral / Sideways
The script then applies a background color based on the detected trend.
Color transparency and theme can be adjusted using the input options.
Why This Script Is Useful
Instead of plotting DI lines or ADX curves, this version presents the trend directly on the background, making it ideal for:
Quick trend recognition
Visual filtering of choppy vs trending markets
Enhancing manual or automated setups
Intraday scalping, positional trend following, and multi-timeframe analysis
The background display is subtle, customizable, and does not interfere with other indicators on the chart.
Key Features
Trend-colored chart background (Up / Down / Neutral)
Adjustable color palette and transparency
Built using classic Directional Movement logic
Works on all markets and all timeframes
Lightweight and efficient (no repainting)
How to Use It
Apply the indicator on your chart and use the background colors to:
Align trades with the market trend
Avoid trading during neutral or low-momentum periods
Confirm trend direction before entries
Improve clarity when using your existing indicators
This indicator does not generate buy/sell signals by itself; instead, it helps visualize the underlying trend environment so traders can make more informed decisions.
How It Works
The script calculates:
Upward Directional Movement (DM+)
Downward Directional Movement (DM–)
True Range smoothed with RMA (14-period)
Positive DI and Negative DI values from classic ADX logic
The trend state is determined by comparing +DI vs –DI:
+DI > –DI → Uptrend
–DI > +DI → Downtrend
Otherwise → Neutral / Sideways
The script then applies a background color based on the detected trend.
Color transparency and theme can be adjusted using the input options.
Why This Script Is Useful
Instead of plotting DI lines or ADX curves, this version presents the trend directly on the background, making it ideal for:
Quick trend recognition
Visual filtering of choppy vs trending markets
Enhancing manual or automated setups
Intraday scalping, positional trend following, and multi-timeframe analysis
The background display is subtle, customizable, and does not interfere with other indicators on the chart.
Key Features
Trend-colored chart background (Up / Down / Neutral)
Adjustable color palette and transparency
Built using classic Directional Movement logic
Works on all markets and all timeframes
Lightweight and efficient (no repainting)
How to Use It
Apply the indicator on your chart and use the background colors to:
Align trades with the market trend
Avoid trading during neutral or low-momentum periods
Confirm trend direction before entries
Improve clarity when using your existing indicators
This indicator does not generate buy/sell signals by itself; instead, it helps visualize the underlying trend environment so traders can make more informed decisions.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.