OPEN-SOURCE SCRIPT
מעודכן Daily Bias with Linear Regression

Overview
The Daily Bias with Linear Regression is a trend-following tool designed to help traders identify the prevailing market direction by aligning the momentum of two critical timeframes: the Daily (D1) and the 4-Hour (H4). By using Linear Regression slopes, this indicator filters out market noise and provides a clear "Bullish," "Bearish," or "Neutral" signal.
How It Works
The indicator calculates the slope of price action using Linear Regression over two specific periods:
The Daily Bias is determined as follows:
Key Features
How to Use
The Daily Bias with Linear Regression is a trend-following tool designed to help traders identify the prevailing market direction by aligning the momentum of two critical timeframes: the Daily (D1) and the 4-Hour (H4). By using Linear Regression slopes, this indicator filters out market noise and provides a clear "Bullish," "Bearish," or "Neutral" signal.
How It Works
The indicator calculates the slope of price action using Linear Regression over two specific periods:
- Daily (D1): 20-period lookback.
- 4-Hour (H4): 18-period lookback.
The Daily Bias is determined as follows:
- 🟢 BULLISH: When both the D1 and H4 slopes are positive.
- 🔴 BEARISH: When both the D1 and H4 slopes are negative.
- ⚪ NEUTRAL: When the slopes are conflicting (e.g., D1 is up, but H4 is down).
Key Features
- Multi-Timeframe Analysis: Automatically fetches data from higher timeframes (D1 and H4) to provide a macro perspective even if you are on a lower timeframe.
- Anti-Repaint Logic: The script is coded to fetch the slope of the *previous* closed bar, ensuring that the signals remain stable and do not repaint.
- Real-time Dashboard: A clean table in the top-right corner displays the current ticker and the live bias status.
- Visual Labels: Direct "Bullish" or "Bearish" labels are plotted on the chart for immediate visual confirmation.
- Timeframe Guard: Includes a built-in warning if the chart timeframe is set below 1-Hour (H1), as the indicator is optimized for higher timeframe confluence.
How to Use
- Trend Confirmation: Use the "BULLISH" or "BEARISH" status to align your trades with the higher timeframe momentum.
- Filter: Avoid taking long positions when the bias is "BEARISH" or short positions when it is "BULLISH."
- Wait for Alignment: A "NEUTRAL" bias suggests a ranging market or a potential trend change; waiting for both timeframes to align can increase trade probability.
Disclaimer:
Trading involves significant risk. This indicator is for educational and informational purposes only and does not constitute financial advice.
הערות שחרור
Update- Added selectable source input (`open`, `close`, `hl2`, `hlc3`, `ohlc4`, etc.)
- Added configurable D1 and H4 lengths
- Added optional D1/H4 upper and lower regression channels
- Added horizontal line extension options (`None`, `Right`, `Left`, `Both`)
- Improved line/label handling for cleaner realtime updates
- Expanded table info while keeping D1 + H4 slope-based bias logic intact
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.