# AlphaRSI Pro

AlphaRSI Pro is an advanced momentum indicator built on the standard Relative Strength Index (RSI), incorporating adaptive volatility levels and trend confirmation to reduce false signals.

| Component | Standard Tool | Enhancement | Key Mathematical Concept |
| :--- | :--- | :--- | :--- |
| **Core** | RSI(14) | WMA/SMA Smoothing (Period $m$) | Reduces high-frequency noise while preserving signal integrity. |
| **Levels** | Fixed (70/30) | Adaptive Volatility Ratio ($\text{VR}$) | Levels dynamically adjust based on market volatility (ATR). |
| **Signals** | RSI Crossovers | Trend Bias Filter ($\text{Bias}$) | Filters signals to align with the underlying long-term trend (SMA slope). |

---

### 1. Smoothed RSI Calculation

The standard RSI is smoothed to reduce noise, improving reliability over the raw calculation.

| Step | Formula | Rationale |
| :--- | :--- | :--- |
| **Standard RSI** | $R S I = 100 - \frac{100}{1 + \frac{A G}{A L}}$ | Measures price momentum speed and change. |
| **Smoothing** | $R S I_{\text{smooth}, t} = M A(R S I, m)$ | A Moving Average (e.g., SMA or WMA) over period $m$ is applied to the raw RSI output. |

### 2. Adaptive Level System

This system prevents overbought/oversold levels from being too rigid during volatile or quiet markets. 

#### A. Volatility Ratio ($\text{VR}$)

$$\text{VR}_{t} = \frac{A T R_{t}}{M A(A T R, L)}$$
* $A T R_{t}$: Current Average True Range (Volatility)
* $M A(A T R, L)$: Long-term moving average of ATR (Average Volatility)

#### B. Dynamic Adjustment

The adjustment term scales the deviation from average volatility by a sensitivity factor (20).

$$\text{Adjustment}_{t} = (\text{VR}_{t} - 1) \times 20$$

#### C. Adaptive Levels (Bounded)

The base levels ($B_{OB}=70$, $B_{OS}=30$) are adjusted and constrained within practical limits (e.g., 65-85 for OB, 15-35 for OS).

* $$\text{OB}_{\text{adaptive}, t} = \text{Bound}(\text{B}_{\text{OB}} + \text{Adjustment}_{t})$$
* $$\text{OS}_{\text{adaptive}, t} = \text{Bound}(\text{B}_{\text{OS}} - \text{Adjustment}_{t})$$

> **Key Effect:** In **High Volatility ($\text{VR} > 1$)**, the levels widen (OB rises, OS drops), requiring more extreme momentum readings for a signal. In **Low Volatility ($\text{VR} < 1$)**, the levels narrow, making the indicator more sensitive.

---

### 3. Trend Bias Integration

A long-term Simple Moving Average (SMA) slope determines the direction and filters momentum signals.

$$\text{Bias}_{t} = \begin{cases} +1 & \text{if } S M A_{t} > S M A_{t-1} \text{ (Uptrend)} \\ -1 & \text{if } S M A_{t} < S M A_{t-1} \text{ (Downtrend)} \end{cases}$$

### 4. Strong Signal Generation Logic

Signals are only considered "Strong" and tradeable when the momentum reading aligns with the underlying trend bias, significantly reducing noise from counter-trend moves.

* **Strong Bullish Signal (Long Entry):**
    * $R S I_{\text{smooth}, t}$ crosses **above** $\text{OS}_{\text{adaptive}, t}$
    * **AND** $\text{Bias}_{t} = +1$ (Uptrend Confirmation)
* **Strong Bearish Signal (Short Entry):**
    * $R S I_{\text{smooth}, t}$ crosses **below** $\text{OB}_{\text{adaptive}, t}$
    * **AND** $\text{Bias}_{t} = -1$ (Downtrend Confirmation)

### 5. Divergence Detection

The indicator automatically checks for classic divergences between price pivots and corresponding $R S I_{\text{smooth}}$ pivots (e.g., Price makes a Lower Low while RSI makes a Higher Low), providing an early warning for potential trend reversals.