OPEN-SOURCE SCRIPT
已更新

DELTA Stochastic

487
🔵 DELTA Stochastic** is a self-configuring stochastic oscillator that selects the right variant, OB/OS thresholds, trend filter, and signal parameters automatically based on what you're trading and what timeframe you're on. Drop it on a chart and it works — no manual tuning required.

* * *

### Why another stochastic?

The classic stochastic has two failure modes:

1. **Wrong speed** — a 14,3,3 stoch is too slow for scalping and too noisy for swing trading. Most traders pick one and use it everywhere.
2. **Catching falling knives** — mean-reversion setups against a strong trend destroy accounts. Most stochastics don't know which direction the trend is going.

DELTA Stochastic solves both by auto-routing the lead variant to the chart timeframe and gating signals with a trend EMA filter.

* * *

### Auto-Routing — One Lead Line Per Chart

| Timeframe | Lead stochastic | Settings |
| --- | --- | --- |
| ≤ 5m (fast) | Fast StochRSI | 3,3,14,14 |
| 15m–2H (medium) | Standard Stoch | 14,3,3 |
| 4H+ / Daily (slow) | Slow StochRSI | 5,5,21,21 |

You always see one clean K/D pair. No multi-line clutter. No averaging that dilutes signals.

* * *

### 5 Asset Presets

Preset routing adjusts OB/OS thresholds, cooldown, trend filter, and EMA length per asset class:

* **X-ETF** — leveraged ETFs (SOXL, TQQQ, etc.) · tight 80/20 zones · fast 20-EMA filter
* **STK** — stocks (AAPL, PLTR, etc.) · 75/25 zones · 50-EMA filter
* **ETF** — non-leveraged funds (SPY, QQQ) · 75/25 · 50-EMA filter
* **Met** — miners and metals (AG, SLV, NUGT, GDX) · wider 73/27 zones
* **CPT** — crypto (BTC, ETH) · 78/22 · trend filter OFF by default

Detection is fully automatic. A 🎯 in the info table means auto-detected. ✋ means manually overridden.

* * *

### 3 Signal Types

🟢 **BUY triangle** — K crosses above D inside the OS zone (with trend filter agreement)🔴 **SELL triangle** — K crosses below D inside the OB zone (with trend filter agreement)💎 **S-BUY / S-SELL** — cross + divergence within the lookback window = highest conviction setup

Plain triangles = watch. 💎 labels = act with conviction.

* * *

### Momentum K Line Coloring

Default mode mirrors SMTF-style trend coloring:

* 🟢 **Green** = K above D and rising — bullish momentum flowing
* 🔴 **Red** = K below D and falling — bearish momentum flowing
* 🟡 **Yellow** = flat or transitioning — wait

Alternative modes: **Zone** (OB=red / OS=green) or **Flat Cyan** (monochrome).

* * *

### Divergence Engine

Ported from **tista's "Stochastic RSI Divergences"** (MPL 2.0, attribution preserved).

Detects all four divergence types — regular bullish/bearish and hidden bullish/bearish — on the smoothed lead K. Pivot lookback of 5 bars on each side = **repaint-free signals** (fires 5 bars late, never redraws history).

Divergences feed directly into the 💎 Strong Signal logic — a cross that agrees with a recent divergence upgrades to S-BUY or S-SELL automatically.

* * *

### Info Table (top-right)

Shows live: preset, TF tier, K value + zone status, last signal, and signal count today.

* * *

### Alerts

Six alert conditions: BUY · SELL · S-BUY · S-SELL · Bull Divergence · Bear Divergence

All alerts respect the signal cooldown — no duplicate alerts in choppy zones. Wire to TradersPost, Telegram, or any webhook-compatible service.

* * *

### Part of the DELTA Trading Suite

DELTA Stochastic is designed to run alongside **🔺 DELTA Go Desk** (master dashboard) and includes a Go Desk integration hook for future confluence scoring.
-------------------------------------------------------------------------------------------
🔵 DELTA Stochastic — Quick Start Guide

**Part of the DELTA Trading Suite · PJ_FatCat (DELTA Trading)***v2.13+ · Pine Script v6 · TradingView*

* * *

## What It Does in 30 Seconds

DELTA Stochastic automatically selects the right stochastic variant for your asset and timeframe — one clean K/D pair, three signal types, and a divergence engine underneath. Drop it on any chart and it routes itself.

* * *

## The 3 Signal Types

| Signal | What it means | How to act |
| --- | --- | --- |
| 🟢 **BUY triangle** | K crosses above D inside the OS zone | Entry candidate — confirm with trend tint |
| 🔴 **SELL triangle** | K crosses below D inside the OB zone | Exit/short candidate |
| 💎 **S-BUY / S-SELL** | Cross + divergence within 10 bars | Highest conviction — size up |

> **Rule of thumb:** Plain triangles = watch. 💎 labels = act.

* * *

## 5-Minute Setup

### Step 1 — Load the indicator

Add `🔵 DELTA Stochastic` to any chart. It auto-detects everything.

### Step 2 — Check the info table (top-right of pane)

| Table field | What to look for |
| --- | --- |
| **Preset** | 🎯 = auto-detected · ✋ = manual override needed |
| **Lead** | Which stochastic is active (Fast StochRSI / Standard Stoch / Slow StochRSI) |
| **K value** | Live K reading + zone status (OVERBOUGHT / OVERSOLD / Bullish / Bearish) |
| **Signal** | Last signal fired this session |
| **Today** | Count of buys and sells fired today |

### Step 3 — Confirm the preset is right

* On SOXL/TQQQ → should show **X-ETF 🎯**
* On AAPL/AMZN → should show **STK 🎯**
* On AG/SLV/NUGT → should show **Met 🎯**
* On BTC/ETH → should show **CPT 🎯**
* On SPY/QQQ → should show **ETF 🎯**

If wrong: Settings → **Instrument** → pick the right one manually.

### Step 4 — Confirm Auto-Apply is ON

Settings → **🎯 Auto-Apply Preset** → ON ✅

This is the master switch. OFF = fully manual, you're on your own for all 6 parameters.

* * *

## The K Line Colors

Default mode is **Momentum** (SMTF-style):

| Color | Meaning |
| --- | --- |
| 🟢 **Green** | K > D and rising — bullish momentum flowing |
| 🔴 **Red** | K < D and falling — bearish momentum flowing |
| 🟡 **Yellow** | Flat or transitioning — stand aside |

Alternative modes (Settings → **K Line Color Mode**):

* **Zone** — green in OS, red in OB (pure mean-reversion view)
* **Flat Cyan** — monochrome, no dynamic color

* * *

## Trend Filter (Default ON for all non-crypto)

The trend filter blocks counter-trend signals:

* **BUY signals only fire when price is ABOVE the trend EMA**
* **SELL signals only fire when price is BELOW the trend EMA**

This is the #1 protection against catching falling knives. Leave it ON unless you're testing raw stochastic crosses.

> ⚠️ **CPT (crypto) only:** Trend filter defaults OFF. Silvia P8 showed it doesn't help on BTC.

* * *

## Auto-Routing Logic

| Chart timeframe | Lead stochastic selected | Why |
| --- | --- | --- |
| ≤ 5m | Fast StochRSI (3,3,14,14) | Speed for scalps |
| 15m – 2H | Standard Stoch (14,3,3) | Balanced noise/speed |
| 4H+ / Daily | Slow StochRSI (5,5,21,21) | Structure, fewer false signals |

Override: Settings → **Timeframe Tier** or **Lead Stochastic** → select manually.

* * *

## Per-Asset Preset Defaults

| Preset | OB/OS | Cooldown | Trend Filter | EMA | Notes |
| --- | --- | --- | --- | --- | --- |
| **X-ETF** | 80/20 | 6 bars | ✅ ON (20-EMA) | 20 | Fast-trending leveraged |
| **CPT** | 78/22 | 8 bars | ❌ OFF | 50 | Crypto — Silvia P8 |
| **STK** | 75/25 | 4 bars | ✅ ON (50-EMA) | 50 | Standard stocks |
| **ETF** | 75/25 | 5 bars | ✅ ON (50-EMA) | 50 | Non-leveraged funds |
| **Met** | 73/27 | 5 bars | ✅ ON (50-EMA) | 50 | Miners / metals (wider zones) |

> All presets are Silvia-validation pending (Project 14e). Treat as smart defaults, not gospel.

* * *

## The Divergence Engine

Ported from tista's "Stochastic RSI Divergences" (MPL 2.0). Runs on a smoothed version of the lead K line.

| Divergence type | What it signals |
| --- | --- |
| **Bull (regular)** | Price making lower lows, K making higher lows → reversal up |
| **Bear (regular)** | Price making higher highs, K making lower highs → reversal down |
| **Bull (hidden)** | Price higher low, K lower low → uptrend continuation |
| **Bear (hidden)** | Price lower high, K higher high → downtrend continuation |

**Key setting:** Pivot Lookback Right (default 5) = signals fire 5 bars late, but are **repaint-free**.

Enable divergence lines: Settings → **Show Divergence Lines** → ON (off by default to keep pane clean).

* * *

## RSI Overlay Line

Optional dashed RSI(14) line on the same 0-100 scale. Mirrors the K line color mode.

**Why it's useful:** When K and RSI agree (both green rising / both red falling) = momentum confluence. When they disagree = one is transitioning ahead of the other = potential turn warning.

* * *

## Alerts Setup

Six alert conditions available:

| Alert name | When it fires |
| --- | --- |
| `BUY Signal` | Any BUY (plain or strong) |
| `SELL Signal` | Any SELL (plain or strong) |
| `STRONG BUY (cross + divergence)` | 💎 S-BUY only |
| `STRONG SELL (cross + divergence)` | 💎 S-SELL only |
| `Bullish Divergence` | Any bull divergence confirmed |
| `Bearish Divergence` | Any bear divergence confirmed |

**Alert cooldown is automatic** — baked into the same signal cooldown logic. No duplicate alerts in choppy zones.

* * *

## Go Desk Integration Hook

Settings → **🔵 DELTA Stoch Active (Go Desk hook)** → ON

Turn this on when DELTA Stochastic is on your chart. A future Go Desk version will read this flag to incorporate stochastic confluence into its overall signal score.

No functional effect in the current Go Desk version — it's a reserved wire.

* * *

## Quick Troubleshooting

| Problem | Fix |
| --- | --- |
| No signals firing | Check trend filter isn't blocking everything. Try Settings → Trend Filter → OFF temporarily to test. |
| Too many signals | Increase signal cooldown (default 6). Try 8–10 for noisy assets. |
| Wrong preset auto-detected | Settings → Instrument → manually select correct preset. |
| Signals firing mid-zone | Check Zone Tolerance isn't set too high (default 0). |
| K line is all yellow | Usually means the asset is in consolidation. This is correct behavior. |
| Divergence labels showing too early | Increase Pivot Lookback Right (increases confirmation delay). |

* * *

*For strategy context, backtest results, and validation status see DELTA_MASTER.md**Author: PJ_FatCat (DELTA Trading) — //PJ_FatCat
版本注释
🆕 Update — v2.22 (July 2026)

**Dynamic K Line Thickness**The K line now renders with true dynamic thickness — fat (3px) when momentum is directional, thin (1px) when flat or transitioning. This replaces the fixed-width line from the original publish. At a glance you can now see *conviction* in the K line, not just direction.

**Composite Score Engine**A live scoring system now runs across all indicator signals simultaneously. Displayed in the info table as a 10-block progress bar with net score:

* 🟢 Green = net score > +3 (bullish conviction)
* 🟡 Yellow = -3 to +3 (mixed / neutral — stand aside)
* 🔴 Red = net score < -3 (bearish conviction)

Score sources (±15 max): K direction · K momentum · OB/OS zone · trend tint regime · RSI direction · BUY/SELL signals · S-BUY/S-SELL · divergence · SMTF K (optional wire-in, ±3)

**SMTF Wire-In**Compatible with **Smart Multi-TF Stochastic** by kompas2024. Wire the SMTF K output into Settings → *SMTF Stoch K (source)* to add up to ±3 points to the composite score (direction + midline + zone).

**Go Desk Output Wire**`score_net` is exported as a hidden plot for future DELTA Go Desk integration. No user action needed — wire is live, Go Desk hook coming in a future session.

**Info Table Redesigned**New row order for faster live reads:| Row | Content ||---|---|| 1 | Score bar + net number || 2 | Last signal (💎 S-BUY / BUY / Bear Div etc.) || 3 | Lead stochastic variant || 4 | K value + zone status || 5 | Today's signal count (color-coded) || 6 | Now B/B — live bull/bear point split |

**Credits added:** SMTF source indicator — Smart Multi-TF Stochastic by kompas2024

* * *

## 📋 Quick Start Guide — Amendments Only

**Add these sections to the existing guide**

* * *

### NEW: The Score Bar (v2.22+)

The top row of the info table now shows a composite score bar:

Score ████████░░ +8

**What it measures:** Every bullish or bearish condition currently active across the indicator — K momentum, RSI, zone position, trend tint, active signals, divergence, and SMTF (if wired). Each contributes weighted points. Net range is -15 to +15.

**Color thresholds:**| Color | Meaning | Action ||---|---|---|| 🟢 Green (>+3) | Multiple bull conditions stacking | Conditions favor long || 🟡 Yellow (-3 to +3) | Mixed / transitioning | Wait — no dominant momentum || 🔴 Red (<-3) | Multiple bear conditions stacking | Conditions favor short/exit |

**Key point:** Score = *conditions*. Signal (row 2) = *trigger*. You want both green + a signal to fire before acting with full size.

* * *

### NEW: Now B/B Row (v2.22+)

Bottom row of the table shows the raw bull/bear point split:

Now B/B 🟢 8 🔴 2

* Left number = total bull points scoring *right now*
* Right number = total bear points scoring *right now*
* Color = green if bull dominant, red if bear dominant, white if tied
* This lets you see *why* the Score bar is where it is

**Difference from Today row:** Today counts signal events (crosses that fired). Now B/B counts current conditions (how many factors are active right now). They measure different things.

* * *

### NEW: SMTF Wire-In (v2.22+)

To activate SMTF scoring:

1. Add **Smart Multi-TF Stochastic** by kompas2024 to the same chart
2. Open DELTA Stochastic settings → **Display** group
3. **SMTF Stoch K (source)** → click dropdown → select the SMTF K plot

Once wired, SMTF contributes up to ±3 points to the score:

* +1 if SMTF K is rising
* +1 if SMTF K is above 50
* +1 if SMTF K is in OS zone (<30)(Bear equivalents apply in reverse)

If left unwired (default `close`), SMTF contributes 0 — no breakage.

* * *

### UPDATED: K Line Visual (v2.22+)

The K line now uses **dynamic thickness** in addition to dynamic color:

* **Fat (3px)** = K is directional (rising green or falling red) — momentum confirmed
* **Thin (1px)** = K is flat or transitioning (yellow) — momentum absent

This replaces the fixed 2px line from the original publish. No setting change needed — it's automatic.

* * *

### UPDATED: RSI Line (v2.22+)

RSI line changed from dotted circles → solid line, linewidth bumped to 2. Easier to read as a confirmation layer alongside K.

* * *

*Amendment for DELTA Stochastic v2.13 → v2.22 · Session 13 · July 2026**Author: PJ_FatCat (DELTA Trading) — //PJ_FatCat**Credits: tista (divergence engine, MPL 2.0) · kompas2024 (SMTF source indicator)
版本注释

**Dynamic K Line Thickness**
The K line now changes thickness in real time — fat (3px) when momentum is directional, thin (1px) when flat. At a glance you can see *conviction*, not just direction.

**Live Composite Score Engine (±15)**
A scoring system now runs across every signal simultaneously and displays in the info table as a color-coded progress bar:
- 🟢 **Green (>+3)** — multiple bull conditions stacking → conditions favor long
- 🟡 **Yellow (-3 to +3)** — mixed/neutral → wait
- 🔴 **Red (<-3)** — multiple bear conditions stacking → conditions favor short/exit

Scores 9 components: K momentum · RSI direction · OB/OS zone · trend tint · BUY/SELL signals · S-BUY/S-SELL · divergence · SMTF K (optional, ±3)

**Smart Multi-TF Stochastic Wire-In**
Now compatible with **Smart Multi-TF Stochastic by kompas2024**. Wire the SMTF K output into Settings → *SMTF Stoch K (source)* → select **"SMTF Stoch: SMART STOCH"**. One-time setup — TradingView remembers it. Adds up to ±3 pts to the score. Note: other dropdown options are in Russian — they are signal plots, not the K line.

**Redesigned Info Table**
Fastest-read layout yet:
```
Score ████████░░ +8 ← conditions
Signal 💎 S-BUY ← trigger
Lead Fast StochRSI
K 54.3 Bullish
Today 🟢 3 🔴 0 ← signals fired today
Now B/B 🟢 8 🔴 2 ← live bull/bear split
```

**Go Desk Output Wire**
`score_net` exported as a hidden plot for future DELTA Go Desk integration. No action needed — wire is live.

**RSI line** changed from dotted circles → solid line for cleaner reading.
版本注释
🔵 DELTA Stochastic — Update Notes (v2.24 → v2.30)
v2.30 — Table polish + Quick Start fix
Eliminated visual gaps between table rows (cell borders removed, outer frame retained). Fixed Quick Start setup guide label accumulation on live chart repaints — now a single clean label that updates in place.
v2.29 — UX improvements across the board

Score display now shows +3/15 or +3/12 format so you always know your maximum possible score at a glance (12 when SMTF is not wired, 15 when it is)
Header row shows ⚠️ -3pts when SMTF toggle is OFF — passive reminder you're leaving points on the table
Score row turns amber if you've wired the SMTF source but forgot to enable the toggle
K line now forces red when in overbought zone and green when in oversold zone, regardless of your color mode setting — mean-reversion extremes are always clearly marked
Added a dismissible Quick Start setup guide on the chart for new users — includes the full SMTF indicator name, author, and exact wiring steps

v2.28 — Critical scoring fix
Fixed a bug where the SMTF composite score (±3 pts) was always active even without the SMTF indicator installed. Root cause: the auto-detection logic compared stochastic K values to the close price — they're almost never equal, so it always evaluated as "wired." Replaced with an explicit ✅ SMTF Wired toggle (default OFF). Score is now accurate whether SMTF is installed or not.
v2.27 — Table clarity
All table colors set to 0% transparency. Semi-transparent cells were causing rendering artifacts and bleed-through from the chart background.
v2.26 — Defaults updated
Table position default changed to Bottom Left. Show Info Table confirmed ON by default.
v2.25 — Table positioning
Added 9-position table placement dropdown (Top/Middle/Bottom × Left/Center/Right). Move the table wherever it fits your layout.

免责声明

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