Aggressive Predictor+ (Last Bar, Vol, Wick)

**Version:** Based on the script incorporating Last Bar analysis, Volume Confirmation, and Wick Rejection.
## Overview
This TradingView Pine Script indicator aims to predict the likely directional bias of the **next** candle based on an aggressive analysis of the **last closed candle's** price action, volume, and wick characteristics relative to recent market volatility (ATR).
It is designed to be **highly reactive** to the most recent bar's information. The prediction is visualized directly on the chart through shapes, a projected line, a text label, and an information table.
**Please Note:** Predicting the next candle is inherently speculative. This indicator provides a probability assessment based on its specific logic and should be used as a supplementary tool within a broader trading strategy, not as a standalone signal. Its performance heavily depends on market conditions and the chosen settings.
## Core Logic Explained
The indicator follows these steps for each new bar, looking back at the **last closed bar** (`[1]`):
1. **Calculate Recent Volatility:** Determines the Average True Range (ATR) over the specified `ATR Lookback Period` (`atr_len`). This provides context for how volatile the market has been recently.
2. **Analyze Last Bar's Body:** Calculates the price change from open to close (`close[1] - open[1]`) of the last completed bar.
3. **Compare Body to Volatility:** Compares the absolute size of the last bar's body to the calculated ATR (`prev_atr`) multiplied by a sensitivity threshold (`threshold_atr_mult`).
* If the body size (positive) exceeds the threshold, the initial prediction is "Upward".
* If the body size (negative) exceeds the negative threshold, the initial prediction is "Downward".
* Otherwise, the initial prediction is "Neutral".
4. **Check Volume Confirmation:** Compares the volume of the last bar (`volume[1]`) to its recent average volume (`ta.sma(volume, vol_avg_len)[1]`). If the volume is significantly higher (based on `vol_confirm_mult`), it adds context ("High Vol") to directional predictions.
5. **Check for Wick Rejection:** Analyzes the wicks of the last bar.
* If the initial prediction was "Upward" but there was a large upper wick (relative to the body size, defined by `wick_rejection_mult`), it indicates potential selling pressure rejecting higher prices. The prediction is **overridden to "Neutral"**.
* If the initial prediction was "Downward" but there was a large lower wick, it indicates potential buying pressure supporting lower prices. The prediction is **overridden to "Neutral"**.
6. **Determine Final Prediction:** The final state ("Upward", "Downward", or "Neutral") is determined after considering potential wick rejection overrides. Context about volume or wick rejection is added to the display text.
## Visual Elements
* **Prediction Shapes:**
* Green Up Triangle: Below the bar for an "Upward" prediction (without wick rejection).
* Red Down Triangle: Above the bar for a "Downward" prediction (without wick rejection).
* Gray Diamond: Above/Below the bar if a directional move was predicted but then neutralized due to Wick Rejection.
* **Prediction Line:**
* Extends forward from the current bar's close for `line_length` bars (Default: 20).
* Color indicates the final predicted state (Green: Upward, Red: Downward, Gray: Neutral).
* Style is solid for directional predictions, dotted for Neutral.
* The *slope/magnitude* of the line is based on recent volatility (ATR) and the `projection_mult` setting, representing a *potential* magnitude if the predicted direction holds, scaled by recent volatility. **This is purely a visual projection, not a precise price forecast.**
* **Prediction Label:**
* Appears at the end of the Prediction Line.
* Displays the final prediction state (e.g., "Upward (High Vol)", "Neutral (Wick Rej)").
* Shows the raw price change of the last bar's body and its size relative to ATR (e.g., "Last Body: 1.50 (120.5% ATR)").
* Tooltip provides more detailed calculation info.
* **Info Table:**
* Displays the prediction state, color-coded.
* Shows details about the last bar's body size relative to ATR.
* Dynamically positioned near the latest bar (offsets configurable).
## Configuration Settings (Inputs)
These settings allow you to customize the indicator's behavior and appearance. Access them by clicking the "Settings" gear icon on the indicator name on your chart.
### Price Action & ATR
* **`ATR Lookback Period` (`atr_len`):**
* *Default:* 14
* *Purpose:* Number of bars used to calculate the Average True Range (ATR), which measures recent volatility.
* **`Body Threshold (ATR Multiplier)` (`threshold_atr_mult`):**
* *Default:* 0.5
* *Purpose:* Key setting for **aggression**. The last bar's body size (`close - open`) must be greater than `ATR * this_multiplier` to be initially classified as "Upward" or "Downward".
* *Effect:* **Lower values** make the indicator **more aggressive** (easier to predict direction). Higher values require a stronger price move relative to volatility and result in more "Neutral" predictions.
### Volume Confirmation
* **`Volume Avg Lookback` (`vol_avg_len`):**
* *Default:* 20
* *Purpose:* Number of bars used to calculate the simple moving average of volume.
* **`Volume Confirmation Multiplier` (`vol_confirm_mult`):**
* *Default:* 1.5
* *Purpose:* Volume on the last bar is considered "High" if it's greater than `Average Volume * this_multiplier`.
* *Effect:* Primarily adds context "(High Vol)" or "(Low Vol)" to the display text for directional predictions. Doesn't change the core prediction state itself.
### Wick Rejection
* **`Wick Rejection Multiplier` (`wick_rejection_mult`):**
* *Default:* 1.0
* *Purpose:* If an opposing wick (upper wick on an up-candle, lower wick on a down-candle) is larger than `body size * this_multiplier`, the directional prediction is overridden to "Neutral".
* *Effect:* Higher values require a much larger opposing wick to cause a rejection override. Lower values make wick rejection more likely.
### Projection Settings
* **`Projection Multiplier (ATR based)` (`projection_mult`):**
* *Default:* 1.0
* *Purpose:* Scales the projected *magnitude* of the prediction line. The projected price change shown by the line is `+/- ATR * this_multiplier`.
* *Effect:* Adjusts how far up or down the prediction line visually slopes. Does not affect the predicted direction.
* **`Prediction Line Length (Bars)` (`line_length`):**
* *Default:* 20
* *Purpose:* Controls how many bars forward the **visual** prediction line extends.
* *Effect:* Purely visual length adjustment.
### Visuals
* **`Upward Color` (`bullish_color`):** Color for Upward predictions.
* **`Downward Color` (`bearish_color`):** Color for Downward predictions.
* **`Neutral Color` (`neutral_color`):** Color for Neutral predictions (including Wick Rejections).
* **`Show Prediction Shapes` (`show_shapes`):** Toggle visibility of the triangles/diamonds on the chart.
* **`Show Prediction Line` (`show_line`):** Toggle visibility of the projected line.
* **`Show Prediction Label` (`show_label`):** Toggle visibility of the text label at the end of the line.
* **`Show Info Table` (`show_table`):** Toggle visibility of the information table.
### Table Positioning
* **`Table X Offset (Bars)` (`table_x_offset`):**
* *Default:* 3
* *Purpose:* How many bars to the right of the current bar the info table should appear.
* **`Table Y Offset (ATR Multiplier)` (`table_y_offset_atr`):**
* *Default:* 0.5
* *Purpose:* How far above the high of the last bar the info table should appear, measured in multiples of ATR.
## How to Use
1. Open the Pine Editor in TradingView.
2. Paste the complete script code.
3. Click "Add to Chart".
4. Adjust the input settings (especially `threshold_atr_mult`) to tune the indicator's aggressiveness and visual preferences.
5. Observe the prediction elements alongside your other analysis methods.
## Disclaimer
**This indicator is for informational and educational purposes only. It does not constitute financial advice or a recommendation to buy or sell any asset.** Trading financial markets involves significant risk, and you could lose money. Predictions about future price movements are inherently uncertain. The performance of this indicator depends heavily on market conditions and the settings used. Always perform your own due diligence and consider multiple factors before making any trading decisions. Use this indicator at your own risk.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Untuk akses pantas pada carta, tambah skrip ini kepada kegemaran anda — ketahui lebih lanjut di sini.
Penafian
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Untuk akses pantas pada carta, tambah skrip ini kepada kegemaran anda — ketahui lebih lanjut di sini.