OPEN-SOURCE SCRIPT
ATR Future Movement Range Projection

The "ATR Future Movement Range Projection" is a custom TradingView Pine Script indicator designed to forecast potential price ranges for a stock (or any asset) over short-term (1-month) and medium-term (3-month) horizons. It leverages the Average True Range (ATR) as a measure of volatility to estimate how far the price might move, while incorporating recent momentum bias based on the proportion of bullish (green) vs. bearish (red) candles. This creates asymmetric projections: in bullish periods, the upside range is larger than the downside, and vice versa.
The indicator is overlaid on the chart, plotting horizontal lines for the projected high and low prices for both timeframes. Additionally, it displays a small table in the top-right corner summarizing the projected prices and the percentage change required from the current close to reach them. This makes it useful for traders assessing potential targets, risk-reward ratios, or option strategies, as it combines volatility forecasting with directional sentiment.
Key features:
- **Volatility Basis**: Uses weekly ATR to derive a stable daily volatility estimate, avoiding noise from shorter timeframes.
- **Momentum Adjustment**: Analyzes recent candle colors to tilt projections toward the prevailing trend (e.g., more upside if more green candles).
- **Time Horizons**: Fixed at 1 month (21 trading days) and 3 months (63 trading days), assuming ~21 trading days per month (excluding weekends/holidays).
- **User Adjustable**: The ATR length/lookback (default 50) can be tweaked via inputs.
- **Visuals**: Green/lime lines for highs, red/orange for lows; a semi-transparent table for quick reference.
- **Limitations**: This is a probabilistic projection based on historical volatility and momentum—it doesn't predict direction with certainty and assumes volatility persists. It ignores external factors like news, earnings, or market regimes. Best used on daily charts for stocks/ETFs.
The indicator doesn't generate buy/sell signals but helps visualize "expected" ranges, similar to how implied volatility informs option pricing.
### How It Works Step-by-Step
The script executes on each bar update (typically daily timeframe) and follows this logic:
1. **Input Configuration**:
- ATR Length (Lookback): Default 50 bars. This controls both the ATR calculation period and the candle count window. You can adjust it in the indicator settings.
2. **Calculate Weekly ATR**:
- Fetches the ATR from the weekly timeframe using `request.security` with a length of 50 weeks.
- ATR measures average price range (high-low, adjusted for gaps), representing volatility.
3. **Derive Daily ATR**:
- Divides the weekly ATR by 5 (approximating 5 trading days per week) to get an equivalent daily volatility estimate.
- Example: If weekly ATR is $5, daily ATR ≈ $1.
4. **Define Projection Periods**:
- 1 Month: 21 trading days.
- 3 Months: 63 trading days (21 × 3).
- These are hardcoded but based on standard trading calendar assumptions.
5. **Compute Base Projections**:
- Base projection = Daily ATR × Days in period.
- This gives the total expected movement (range) without direction: e.g., for 3 months, $1 daily ATR × 63 = $63 total range.
6. **Analyze Candle Momentum (Win Rate)**:
- Counts green candles (close > open) and red candles (close < open) over the last 50 bars (ignores dojis where close == open).
- Total colored candles = green + red.
- Win rate = green / total colored (as a fraction, e.g., 0.7 for 70%). Defaults to 0.5 if no colored candles.
- This acts as a simple momentum proxy: higher win rate implies bullish bias.
7. **Adjust Projections Asymmetrically**:
- Upside projection = Base projection × Win rate.
- Downside projection = Base projection × (1 - Win rate).
- This skews the range: e.g., 70% win rate means 70% of the total range allocated to upside, 30% to downside.
8. **Calculate Projected Prices**:
- High = Current close + Upside projection.
- Low = Current close - Downside projection.
- Done separately for 1M and 3M.
9. **Plot Lines**:
- 3M High: Solid green line.
- 3M Low: Solid red line.
- 1M High: Dashed lime line.
- 1M Low: Dashed orange line.
- Lines extend horizontally from the current bar onward.
10. **Display Table**:
- A 3-column table (Projection, Price, % Change) in the top-right.
- Rows for 1M High/Low and 3M High/Low, color-coded.
- % Change = ((Projected price - Close) / Close) × 100.
- Updates dynamically with new data.
The entire process repeats on each new bar, so projections evolve as volatility and momentum change.
### Examples
Here are two hypothetical examples using the indicator on a daily chart. Assume it's applied to a stock like AAPL, but with made-up data for illustration. (In TradingView, you'd add the script to see real outputs.)
#### Example 1: Bullish Scenario (High Win Rate)
- Current Close: $150.
- Weekly ATR (50 periods): $10 → Daily ATR: $10 / 5 = $2.
- Last 50 Candles: 35 green, 15 red → Total colored: 50 → Win Rate: 35/50 = 0.7 (70%).
- Base Projections:
- 1M: $2 × 21 = $42.
- 3M: $2 × 63 = $126.
- Adjusted Projections:
- 1M Upside: $42 × 0.7 = $29.4 → High: $150 + $29.4 = $179.4 (+19.6%).
- 1M Downside: $42 × 0.3 = $12.6 → Low: $150 - $12.6 = $137.4 (-8.4%).
- 3M Upside: $126 × 0.7 = $88.2 → High: $150 + $88.2 = $238.2 (+58.8%).
- 3M Downside: $126 × 0.3 = $37.8 → Low: $150 - $37.8 = $112.2 (-25.2%).
- On the Chart: Green/lime lines skewed higher; table shows bullish % changes (e.g., +58.8% for 3M high).
- Interpretation: Suggests stronger potential upside due to recent bullish momentum; useful for call options or long positions.
#### Example 2: Bearish Scenario (Low Win Rate)
- Current Close: $50.
- Weekly ATR (50 periods): $3 → Daily ATR: $3 / 5 = $0.6.
- Last 50 Candles: 20 green, 30 red → Total colored: 50 → Win Rate: 20/50 = 0.4 (40%).
- Base Projections:
- 1M: $0.6 × 21 = $12.6.
- 3M: $0.6 × 63 = $37.8.
- Adjusted Projections:
- 1M Upside: $12.6 × 0.4 = $5.04 → High: $50 + $5.04 = $55.04 (+10.1%).
- 1M Downside: $12.6 × 0.6 = $7.56 → Low: $50 - $7.56 = $42.44 (-15.1%).
- 3M Upside: $37.8 × 0.4 = $15.12 → High: $50 + $15.12 = $65.12 (+30.2%).
- 3M Downside: $37.8 × 0.6 = $22.68 → Low: $50 - $22.68 = $27.32 (-45.4%).
- On the Chart: Red/orange lines skewed lower; table highlights larger downside % (e.g., -45.4% for 3M low).
- Interpretation: Indicates bearish risk; might prompt protective puts or short strategies.
#### Example 3: Neutral Scenario (Balanced Win Rate)
- Current Close: $100.
- Weekly ATR: $5 → Daily ATR: $1.
- Last 50 Candles: 25 green, 25 red → Win Rate: 0.5 (50%).
- Projections become symmetric:
- 1M: Base $21 → Upside/Downside $10.5 each → High $110.5 (+10.5%), Low $89.5 (-10.5%).
- 3M: Base $63 → Upside/Downside $31.5 each → High $131.5 (+31.5%), Low $68.5 (-31.5%).
- Interpretation: Pure volatility-based range, no directional bias—ideal for straddle options or range trading.
In real use, test on historical data: e.g., if past projections captured actual moves ~68% of the time (1 standard deviation for ATR), it validates the volatility assumption. Adjust the lookback for different assets (shorter for volatile cryptos, longer for stable blue-chips).
סקריפט קוד פתוח
ברוח TradingView אמיתית, היוצר של הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יכולים לבדוק ולאמת את הפונקציונליות שלו. כל הכבוד למחבר! למרות שאתה יכול להשתמש בו בחינם, זכור שפרסום מחדש של הקוד כפוף לכללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.
סקריפט קוד פתוח
ברוח TradingView אמיתית, היוצר של הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יכולים לבדוק ולאמת את הפונקציונליות שלו. כל הכבוד למחבר! למרות שאתה יכול להשתמש בו בחינם, זכור שפרסום מחדש של הקוד כפוף לכללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.