PROTECTED SOURCE SCRIPT

PKA Rational Quadratic (Table Signals)

41
Here’s a TradingView-ready publish write-up you can drop straight into the **Description** when you publish the script.

---

## PKA Rational Quadratic (Table Signals)

**PKA Rational Quadratic (Table Signals)** is a clean, chart-friendly trend framework built around a Rational Quadratic–smoothed moving average and a compact table that explains *market state* at a glance.

The philosophy is simple:

* Keep the chart clean (one MA + optional bands)
* Put all interpretation in the table (regime, bias, slope, curvature, stretch, squeeze, projection, band ride)
* Reduce noise with candle-close locking and curvature debounce logic

This is not meant to spam “buy/sell” everywhere. It’s designed to help you answer the trader questions that actually matter:

* “Is this market even worth trading right now?”
* “If it’s trending, is price aligned… or pulling back?”
* “Is the trend accelerating or losing energy?”
* “Am I chasing an extended move?”
* “Is volatility compressing (squeeze)?”
* “Is price riding volatility bands (continuation behavior)?”

---

## What the indicator plots

### 1) The Trend Line (Moving Average)

The main line is your selected moving average, optionally smoothed using a **Rational Quadratic smoother** and/or an additional “Sigmoid” smoothing mode.

You can choose between:

* **CPMA** (from the imported CSM library)
* **FRMA** (FRAMA-style adaptive average)
* **RationalQuad** (Rational Quadratic smoothing applied directly to price)

The trend line is colored using the CSM library gradient coloring so you get an intuitive visual read without extra clutter.

### 2) Optional ATR Bands (default OFF)

If enabled, ATR bands are plotted around the MA:

* **Upper Band** = MA + (ATR × Multiplier)
* **Lower Band** = MA − (ATR × Multiplier)

When a volatility **squeeze** is detected, the bands switch to **yellow** to make compression phases obvious.

---

## Why this is powerful

Most indicators try to do one thing:

* trend direction, or
* volatility, or
* momentum, or
* mean reversion

This script combines those ideas into a **single decision dashboard**.

Instead of guessing, you get a state-based read:

* **Regime** tells you whether trading conditions are favorable (TREND vs CHOP).
* **Bias** tells you whether price is aligned with structure (BULL/BEAR) or temporarily fighting it (PULLBACK/RALLY).
* **Stretch** tells you if you’re late / chasing.
* **Curvature** tells you if slope is accelerating or decelerating.
* **Squeeze** highlights contraction (where breakouts or whipsaw are more likely).
* **Band Ride** identifies strong continuation behavior.
* **Projection** gives a simple forward read based on current MA slope (not “predicting price,” but projecting MA direction/level).

Two key features make it practical:

1. **Regime and Bias lock on candle close**, so your table doesn’t flicker intrabar.
2. **Curvature debounce** reduces false “flip spam” when price chops near the MA.

---

## Table guide (every row explained)

### MA Mode

Shows your selected MA source:

* CPMA / FRMA / RationalQuad

---

### Regime: TREND vs CHOP

This is your “permission to trade” filter.

It uses normalized slope strength:

* `|MA slope| / ATR`

Then applies **hysteresis**:

* Enter TREND above a higher threshold
* Exit TREND below a lower threshold

This makes regime switching **more sensitive but stable** (less flip-flopping).

**Interpretation**

* **TREND** = conditions are strong enough to trade trend setups
* **CHOP** = conditions are weak / noisy (better to wait)

---

### Bias: BULL / BEAR / PULLBACK / RALLY

Bias describes structure + price agreement:

* **BULL**: MA slope up AND price above MA
* **PULLBACK**: MA slope up BUT price below MA
* **BEAR**: MA slope down AND price below MA
* **RALLY**: MA slope down BUT price above MA

This is what most traders *actually* want: direction + whether price is aligned or temporarily counter-trending.

**Bias updates on candle close** (so it won’t twitch intrabar).

---

### Slope (UP/DOWN + strength)

Slope is the direction of the MA plus a normalized strength value:

* Green background when slope is up
* Red background when slope is down

If slope strength is weak, you’ll generally see more CHOP regimes.

---

### Curvature (CURV+ / CURV- / 0)

Curvature is the “acceleration” of the MA slope (second derivative concept).

* **CURV+**: slope is accelerating upward
* **CURV-**: slope is accelerating downward
* **0**: neutral

This is useful for catching transitions like:

* pullback → continuation (CURV+ returning in an uptrend)
* rally → continuation (CURV- returning in a downtrend)

To reduce noise, curvature uses:

* a deadband (ATR-based)
* a cooldown timer
* an optional CHOP gate (suppresses flashes unless stretched)

---

### Stretch (OK / WARN / Z± EXT)

Stretch measures how far price is from the MA in ATR units:

* **OK**: normal distance
* **WARN**: getting extended
* **Z+ EXT**: extremely above MA (often late for fresh longs)
* **Z- EXT**: extremely below MA (often late for fresh shorts)

This helps prevent chasing.

Color logic:

* Z+ EXT = orange
* Z- EXT = aqua
* WARN = yellow

---

### Squeeze (ratio + YES/NO)

Squeeze detects volatility contraction using the ATR band base compared to its longer baseline:

* Ratio below threshold = **Squeeze YES**
* Bands visually turn **yellow** in squeeze

Squeeze can mean:

* conditions are compressing (breakouts more likely)
* OR whipsaw risk is higher if you trade blindly inside the compression

---

### Projection (UP/DOWN | ABOVE/BELOW/CROSS)

Projection is a simple, intuitive forward read:

* It projects the MA forward using current slope:

* `maPred = ma + (slope × projBars)`

Then it reports:

* **UP/DOWN** = MA slope direction
* **ABOVE/BELOW** = where price is relative to the projected MA level
* **CROSS UP / CROSS DOWN** = if price crosses the projected level

This is not a crystal ball. It’s a slope-based context tool.

---

### Band Ride (RIDE↑ / RIDE↓)

Band Ride detects strong continuation behavior:

* **RIDE↑** = price has stayed near the upper band for a set number of bars
* **RIDE↓** = price has stayed near the lower band

When ride triggers, it often signals:

* trend strength
* continuation conditions
* “don’t fade this too early” market behavior

---

## Suggested ways to use it (simple and effective)

### 1) Regime first

* Only trade trend setups when **Regime = TREND**
* Treat **CHOP** as “wait / reduce size / tighten criteria”

### 2) Use Bias as your directional compass

* In TREND:

* **PULLBACK** = look for long continuation conditions
* **RALLY** = look for short continuation conditions
* **BULL/BEAR** = confirmation that price and structure agree

### 3) Use Stretch to avoid chasing

* Avoid initiating longs in **Z+ EXT**
* Avoid initiating shorts in **Z- EXT**
* Prefer entries in **OK/WARN** zones

### 4) Use Curvature + Bias to time continuation

* Uptrend continuation commonly appears as:

* TREND + PULLBACK + CURV+
* Downtrend continuation commonly appears as:

* TREND + RALLY + CURV-

### 5) Use squeeze and band ride as context

* Squeeze = compression (breakout/whipsaw context)
* Band Ride = strong continuation context

---

## Disclaimer

This script is provided for **educational and informational purposes only** and does not constitute financial advice. Trading involves risk, and you are responsible for your own decisions. Always test strategies on historical data and in simulation before risking real capital.

---

免责声明

这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。