OPEN-SOURCE SCRIPT

asami.PMax on Rsi w T3

68
### **1\. Overview**

**Indicator**: asami.PMax on RSI w T3 (Short: **PmR3**)
**Pane**: Separate (`overlay=false`)
**Goal**: Smooth classic RSI with Tillson T3, overlay ATR-based PMax stops, and highlight momentum shifts with built-in alerts.

### **2\. Code Breakdown**

1. **WWMA-Based RSI**

* Use weighted moving average on up/down moves (`avUp`, `avDown`) to compute `rsi = 100 - 100/(1 + avUp/avDown)`.

2. **ATR on RSI**

* Define true range (`tr`) from RSI high/low differences; compute `atr = sma(tr, periodsATR)`.

3. **Tillson T3 Smoothing**

* Concatenate six EMAs of length `lenT3`, then blend via coefficients derived from `T3a1` to form `mAvg`.

4. **PMax Stop Bands**

* `longStop = mAvg - multiplier * atr` and `shortStop = mAvg + multiplier * atr`.

* Enforce monotonic expansion and pick inner band based on trend direction `dir`.

5. **Signals & Alerts**

* `crossover(mAvg, pMax)` → Buy signal

* `crossunder(mAvg, pMax)` → Sell signal

* Additional alerts on price vs. PMax crosses.

### **3\. Inputs**

| Input Name | Default | Description |
| :---- | :---- | :---- |
| Source | hl2 | Base price series (e.g., (High+Low)/2) |
| ATR Multiplier | 3.0 | Width factor for PMax band |
| Tillson T3 Length | 8 | EMA chain length for T3 smoothing |
| TILLSON T3 Volume Factor | 0.7 | Blending factor for T3 smoothing |
| ATR Length | 10 | Period for ATR calculation |
| RSI Length | 14 | Period for RSI calculation |
| Show RSI? | true | Toggle RSI plot |
| Show Moving Average? | true | Toggle T3-RSI centerline |
| Show Crossing Signals? | true | Toggle Buy/Sell markers |
| Highlighter On/Off? | true | Toggle background color highlights (green/red) |

### **4\. Plots & Signals**

* **RSI \+ Bands**: Plots RSI with 70/30 horizontal lines and semi-transparent background fill.

* **Center Line (T3-RSI)**: Thick black line (`linewidth=2`).

* **PMax**: Thick red line.

* **Buy/Sell Labels**: Tiny up/down labels along the PMax line when enabled.

* **Background Highlight**: Green when `mAvg > pMax`; red when `<`.

### **5\. Use Cases**

* **Day & Swing Trading**: Ideal on 5 min–4 h charts for clean momentum flip detection.

* **Directional Filter**: Restrict long trades to price above PMax, shorts below.

* **Automated Execution**: Hook alerts into webhook-driven bots for live order placement.

### **6\. Tips & Caveats**

* **Whipsaw Control**: In low volatility, ATR contracts excessively—consider longer ATR or additional volatility filters.

* **Multi-Timeframe Alignment**: Validate trend direction on higher timeframes to reduce false signals.

* **Risk Management**: Oscillator-based stops often trigger tight exits; adjust position sizing accordingly.

### **7\. Conclusion**

PmR3 combines RSI, ATR, and Tillson T3 techniques to deliver a noise-reduced, trend-aware momentum indicator. With intuitive color highlights and ready-to-use alerts, it fits both discretionary and algorithmic TradingView strategies.

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.