OPEN-SOURCE SCRIPT
更新済

Adaptive Ichimoku Nexus [WillyAlgoTrader]

24 355
☁️ Adaptive Ichimoku Nexus — a modern approach to the legendary all-time indicator Ichimoku Kinko Hyo. This overlay indicator replaces the fixed periods of the classic Ichimoku system with a volatility-adaptive engine that dynamically scales Tenkan-Sen, Kijun-Sen, and Senkou Span B lookback periods based on current market conditions. Every TK cross signal is scored by an 8-factor confluence engine (0–100) that combines all five Ichimoku dimensions with volume, momentum pulse, and momentum acceleration. The indicator also includes a dedicated Kumo breakout engine with retest detection, three Ichimoku-anchored SL modes with R:R-based TP levels, and a multi-timeframe Ichimoku alignment panel — creating a complete trading system built entirely on Ichimoku principles enhanced with adaptive intelligence.

Ichimoku Kinko Hyo was designed in the 1930s with fixed periods (9/26/52) calibrated for the Japanese trading week. These periods remain the default worldwide, but modern markets are faster, more volatile, and trade 24/7. A fixed 26-period Kijun-Sen responds identically whether the market is in a tight range or a momentum breakout — producing late signals in trends and whipsaws in consolidation.

This indicator preserves the complete Ichimoku structure — all five lines, the cloud, and the displacement — while making the periods responsive to current volatility. In high-volatility environments, all three Donchian-based periods shorten → the Tenkan reacts faster, the Kijun adapts sooner, the cloud thins and pivots quicker. In low-volatility consolidation, the periods lengthen → noise is filtered, fewer false TK crosses, thicker cloud provides stronger S/R. The entire Ichimoku system breathes with the market.


🧩 WHY THESE COMPONENTS WORK TOGETHER

Classic Ichimoku already integrates five components into one system: Tenkan-Sen (momentum), Kijun-Sen (trend), Senkou Span A/B (future S/R), and Chikou Span (lagging confirmation). The genius of Ichimoku is that these five dimensions are designed to confirm each other — a "5/5 alignment" is one of the strongest signals in technical analysis.

This indicator enhances the system at three levels:

Level 1 — Adaptive periods: The volatility engine scales all three Donchian-based components (Tenkan, Kijun, Span B) proportionally, preserving the Ichimoku ratios while adapting the speed. This means the relationship between Tenkan and Kijun (the core signal mechanism) stays consistent — they just both become faster or slower together.

Level 2 — Confluence scoring: Instead of manually checking "Is Tenkan above Kijun? Is price above cloud? Is Chikou confirming?" — the 8-factor engine quantifies every Ichimoku dimension plus volume and momentum into a single 0–100 score. A score of 85 means virtually every Ichimoku component plus momentum and volume agrees. A score of 35 means the signal is conflicted — skip it.

Level 3 — Structural TP/SL: The Kumo edge and Kijun-Sen are natural Ichimoku support/resistance levels. Using them as stop-loss anchors (instead of arbitrary ATR multiples) produces structurally meaningful stops that respect the same framework generating the signals.

Level 4 — Momentum Pulse: Classic Ichimoku has no built-in momentum acceleration measure. The Momentum Pulse engine quantifies how fast the TK spread is changing and which direction the future cloud is rotating — capturing the urgency behind each signal.

Without adaptive periods, the system is rigid. Without scoring, you must manually assess 5+ factors. Without structural SL, your risk management ignores Ichimoku's own S/R levels. Without the Momentum Pulse, you can't distinguish between a strong and a fading TK cross. Each layer adds a dimension that classic Ichimoku lacks.


🔍 WHAT MAKES IT ORIGINAL

1️⃣ Volatility-adaptive Ichimoku periods.
When Adaptive mode is on, each Donchian midline (Tenkan, Kijun, Span B) uses a volatility-scaled period:

adaptedPeriod = basePeriod × (1 + strength × (1 − 2 × volRatio))

Where volRatio = (currentATR − lowestATR) / (highestATR − lowestATR) over the volatility lookback (default 50 bars), normalized to 0–1.

When volRatio → 1 (high volatility): adaptedPeriod = basePeriod × (1 − strength) — periods shorten
When volRatio → 0 (low volatility): adaptedPeriod = basePeriod × (1 + strength) — periods lengthen

The Adapt Strength parameter (default 0.4 = ±40%) controls the range of scaling. With basePeriod=26 and strength=0.4: periods range from 16 (high vol) to 36 (low vol). Each adapted period is clamped to a valid range and fed into the standard Donchian midline formula: (highest(high, period) + lowest(low, period)) / 2.

This means all five Ichimoku lines (Tenkan, Kijun, Senkou A, Senkou B, Chikou) adapt proportionally — the system remains internally consistent. In Classic mode, the standard fixed periods are used unchanged.

2️⃣ 8-factor confluence scoring engine (0–100).
Every bar computes both a bullish and bearish score from 8 factors:

— 📐 Price vs Cloud (20 pts): above cloud = 20, inside = 8, below = 0 (bull). Symmetric for bear. The cloud is the strongest S/R in Ichimoku.
— ⚡ TK alignment (15 pts): Tenkan > Kijun = 15 (bull). The core Ichimoku momentum signal.
— 👁️ Chikou confirmation (15 pts): Chikou Span above price at displaced position = 15 (bull). The lagging confirmation.
— ☁️ Cloud direction (10 pts): Span A slope > Span B slope = 10 (bull). Future cloud turning bullish indicates trend momentum.
— 📏 Kumo thickness (8 pts): thick cloud = 8, thin cloud = 2. Thick cloud provides stronger S/R backing.
— 📈 Volume (10 pts): volume > SMA(20) × 1.2 = 10. Confirms institutional participation.
— 💪 Momentum alignment (12 pts): Momentum Pulse > 20 = 12, > 0 = 6. Strong momentum behind the signal.
— 🚀 Momentum acceleration (10 pts): Momentum Pulse rising = 10. Trend is accelerating, not fading.

Max score = 100. Signals require score ≥ Min Confluence Score (default 50). Grades: Strong (≥ 80), Standard (≥ 50), Weak (< 50).

3️⃣ Momentum Pulse engine (−100 to +100).
A composite momentum measure built from three Ichimoku-derived components:

TK spread normalized by ATR (weight 40): tkSpreadNorm = (Tenkan − Kijun) / ATR. Measures how far apart the momentum and trend lines are relative to volatility.
TK spread acceleration (weight 100): tkSpreadNorm − tkSpreadNorm[3]. Measures how fast the spread is changing — captures momentum buildup.
Cloud slope differential (weight 30): (ΔSpanA − ΔSpanB) / ATR over 5 bars. Measures whether the future cloud is rotating bullish or bearish.

Combined: momentumPulse = tkSpread×40 + tkAcceleration×100 + cloudSlope×30, clamped to [−100, +100], smoothed with EMA(5). States: Accelerating (rising + positive), Bull Fading (falling + positive), Bear Accelerating (falling + negative), Bear Fading (rising + negative).

4️⃣ Three Ichimoku-anchored SL modes.
Stop-loss placement uses Ichimoku structure:
Kumo Edge (default): SL at the nearest cloud boundary (kumoBot for longs, kumoTop for shorts) + ATR buffer. The cloud is Ichimoku's primary S/R — placing the stop here means your stop is at the strongest structural level in the framework.
Kijun: SL at the Kijun-Sen ± ATR buffer. The Kijun is Ichimoku's equilibrium line — price tends to return to it.
ATR: SL at entry ± 2× ATR. Pure volatility-based fallback.

TP1/TP2/TP3 are R:R multiples of the risk distance (default 1.5/2.5/4.0). A minimum risk distance of 0.5× ATR is enforced.

5️⃣ Kumo breakout engine with retest detection.
Detects when price closes above the cloud (was below or inside on the previous bar) with volume confirmation:
— kumoBreakUp: close > kumoTop AND previous close ≤ kumoTop AND volume > SMA(20) × breakoutMultiplier
— kumoBreakDown: close < kumoBot AND previous close ≥ kumoBot AND same volume condition

After a breakout, a retest signal fires if within 10 bars, price touches the cloud edge and closes back on the breakout side — confirming the cloud has flipped from resistance to support (or vice versa). Retest signals appear as small circles distinct from the larger diamond breakout markers.

6️⃣ Kijun-Sen S/R zone detection.
When the Kijun-Sen has been flat for 4+ consecutive bars and then starts moving, the flat level is marked as a support/resistance zone (shaded box ± 0.15× ATR). Flat Kijun is a well-known Ichimoku S/R concept — price tends to be attracted to flat Kijun levels. The indicator automates this detection and visualization.

7️⃣ Multi-timeframe Ichimoku alignment panel.
Three configurable timeframes (default 15M/1H/4H) each compute a full Ichimoku state using the classic periods:
— Bull ● : close > cloud AND Tenkan > Kijun
— Bear ● : close < cloud AND Tenkan < Kijun
— Neutral ○ : anything else

The panel shows per-TF alignment plus a summary: ALL BULL ✓ (all 3 TFs bullish), ALL BEAR ✓ (all 3 bearish), or Mixed. All MTF data uses [1] + lookahead_on for non-repainting.


⚙️ HOW IT WORKS — CALCULATION FLOW

Step 1 — Volatility measurement: ATR(14) is normalized to 0–1 by its position within the recent high-low range over the volatility lookback.

Step 2 — Period adaptation: Each base period (9/26/52) is scaled by the adapt strength and vol ratio. High vol → shorter periods, low vol → longer. Classic mode bypasses this.

Step 3 — Ichimoku calculation: Tenkan = Donchian midline (adapted period). Kijun = Donchian midline (adapted period). Senkou A = avg(Tenkan, Kijun). Senkou B = Donchian midline (adapted period). Chikou = source price. Cloud displaced forward by displacement bars.

Step 4 — Kumo at current bar: Span A and Span B are read at displacement offset to get the current cloud boundaries. Thickness, price position (above/below/inside), and thin-cloud status are computed.

Step 5 — Momentum Pulse: TK spread, spread acceleration (vs 3 bars ago), and cloud slope differential — combined and EMA-smoothed.

Step 6 — Confluence scoring: 8 factors evaluated. Bull and bear scores computed independently.

Step 7 — Signals: TK cross + score threshold + enabled filters (Kumo thickness, volume, Chikou) → confirmed buy/sell. Kumo breakout: cloud boundary cross + volume surge → breakout signal. Retest: cloud edge touch within 10 bars of breakout.

Step 8 — TP/SL: SL from Kumo edge / Kijun / ATR mode. TPs as R:R multiples. TP/SL hits tracked per trade.


📖 HOW TO USE

🎯 Quick start:
1. Add the indicator — the Ichimoku cloud and lines appear (adaptive by default)
2. "Long 78%" / "Short 65%" labels = TK cross signals with confluence score
3. ☁▲ / ☁▼ diamonds = Kumo breakout signals
4. Entry, SL, TP1–TP3 lines appear on each signal
5. Check the MTF panel for multi-timeframe alignment

👁️ Reading the chart:
— 🔵 Blue line = Tenkan-Sen (conversion, fast)
— 🔴 Pink line = Kijun-Sen (base, slow)
— 🟠 Orange line (displaced back) = Chikou Span
— 🟩🟥 Cloud fill = Kumo (green bullish, red bearish)
— 🟢 "Long XX%" label = confirmed bullish TK cross with score
— 🔴 "Short XX%" label = confirmed bearish TK cross with score
— 💎 Cyan diamond = Kumo breakout (☁▲ up / ☁▼ down)
— ⚫ Small circle = Kumo edge retest
— 🟪 Shaded zone = flat Kijun S/R area
— 🔵 Blue line = entry, 🔴 red = SL, 🟢 green = TP1/TP2/TP3

📊 Dashboard fields:
— Mode: Adaptive / Classic
— Trend: Bullish / Bearish / Neutral (price vs cloud + TK alignment)
— Signal: last signal with bars elapsed
— Score: confluence percentage with color grade
— Momentum: Pulse state + value (Accelerating / Bull Fading / Bear Accel / etc.)
— Cloud: price position (Above / Below / Inside / Thin)
— Trade: TP/SL progress (→ TP1, TP1 ✓ → TP2, TP3 ✓ Closed, SL ✗ Closed)
— MTF: 3-timeframe Ichimoku alignment + summary (ALL BULL / ALL BEAR / Mixed)
— Version

🔧 Tuning guide:
Too many weak signals: increase Min Score (60–80), enable all filters
Missing signals: decrease Min Score (30–40), disable Chikou filter
Adaptive too aggressive: decrease Adapt Strength (0.2–0.3) or increase Volatility Lookback (100+)
Want classic Ichimoku: switch to Classic mode — pure 9/26/52 with scoring and TP/SL
Stops too tight: increase SL ATR Buffer (0.7–1.0) or switch to ATR SL mode
Scalping: Conversion 5, Base 13, Span B 26, Displacement 13, Min Score 40
Swing: Conversion 12, Base 34, Span B 68, Displacement 34, Min Score 65


⚙️ KEY SETTINGS REFERENCE

⚙️ Main:
Calculation Mode (default Adaptive): Adaptive / Classic
Conversion/Base/Span B/Displacement (default 9/26/52/26)

🔄 Adaptive Engine:
Volatility Lookback (default 50): ATR normalization window
Adapt Strength (default 0.4): period scaling range (±40%)

🔍 Filters:
Min Confluence Score (default 50): 0–100 threshold
Kumo Thickness Filter (default On): suppress in thin cloud
Volume Filter (default On): auto-disabled on forex
Chikou Confirmation (default On): require lagging span alignment

🎯 Smart TP/SL:
SL Mode (default Kumo Edge): Kumo Edge / Kijun / ATR
SL ATR Buffer (default 0.5): padding beyond SL level
TP1/TP2/TP3 R:R (default 1.5/2.5/4.0)

💥 Kumo Breakout:
Breakout Vol Mult (default 1.3): volume surge requirement
Show Retest Signals (default On): cloud edge retest detection

🔄 Multi-Timeframe:
TF 1/2/3 (default 15/60/240): configurable timeframes


🔔 Alerts

— 🟢 BUY / 🔴 SELL — TK cross with score, SL, TP1–TP3
— ☁️▲ KUMO BREAK UP / ☁️▼ KUMO BREAK DOWN
— 🎯 TP1 HIT / 🛑 SL HIT
All support plain text and JSON webhook format. Bar-close confirmed.


⚠️ IMPORTANT NOTES

— 🚫 No repainting. All TK cross signals and Kumo breakouts require barstate.isconfirmed. MTF data uses [1] + lookahead_on. A warmup period (Span B + displacement, minimum 80 bars) prevents signals during insufficient data.
— ☁️ This preserves the complete Ichimoku structure. All five lines, the cloud, displacement, and Chikou are computed exactly as Ichimoku specifies — the only change is that in Adaptive mode, the three Donchian periods scale with volatility. Switching to Classic mode produces a standard Ichimoku with no modifications.
— 📐 The adaptive engine scales all three periods proportionally using the same vol ratio and strength. The relationship between Tenkan (fast) and Kijun (slow) is preserved — they don't drift independently.
— ⚖️ The confluence score is Ichimoku-native. Six of eight factors (price vs cloud, TK alignment, Chikou, cloud direction, Kumo thickness, momentum) are derived directly from Ichimoku components. Only volume and momentum acceleration are external additions.
— 📊 The Momentum Pulse is not a standalone oscillator — it's derived from TK spread dynamics and cloud rotation, both Ichimoku-native measurements. It quantifies what experienced Ichimoku traders assess visually: "Is this TK cross strong and accelerating, or weak and fading?"
— 🔄 Kumo breakout retest detection uses a 10-bar window after the initial breakout. Retests beyond 10 bars are not tracked.
— 🛠️ This is a signal and analysis tool, not an automated trading bot. It enhances Ichimoku with adaptive periods, scoring, and risk management — trade decisions remain yours.
— 🌐 Works on all markets and timeframes. Volume filter auto-disables on instruments without volume data.
リリースノート
MAJOR UPDATE — v2.0.1 → v2.3.0

This is the biggest update since release: a live Honest Stats panel, a full trade-management upgrade, two new signal engines, a redesigned dashboard — and, as always, a full list of the bugs I found and fixed, because you deserve to know exactly what changed under the hood.

■ NEW — HONEST STATS PANEL
The dashboard now shows live statistics for every TP/SL setup on your loaded chart: closed setups, TP1 rate (with a visual gauge), TP2/TP3 rates, SL rate, average R, and a Form strip of the last 10 setups (▰ = TP1 touched, ▱ = closed before TP1).
The R model is fully disclosed right on the panel: 1/3 of the position exits at each TP, the remainder exits at the stop. Intrabar ambiguity resolves WORST-CASE (SL counted before TP). Setups replaced by a new signal are closed at market price for the stats — nothing is silently dropped.
These are on-chart statistics for your symbol, timeframe and settings. They are NOT a backtest and NOT a performance promise.

■ NEW — BREAK-EVEN AFTER TP1 (optional, OFF by default)
The stop moves to entry starting from the bar AFTER TP1 is confirmed. The one-bar delay is intentional: the intrabar sequence of a TP1 touch vs. a same-bar stop run is unknown, so I refuse to pretend otherwise. A break-even stop counts as 0R in the stats. Includes a "SL → BE" alert.

■ NEW — TRADE RECORD VISUALS
Entry/SL/TP lines are now drawn once at entry and persist as a trade record: TP lines turn solid teal with a ✓ on hit, the SL line dims when break-even is active, stop-outs are marked "SL ✗" / "BE ✗". New options: individual line styles for Entry/SL/TP, label font size, and % distance from entry on every label. Closed records auto-clear after a configurable number of bars.

■ NEW — KUMO TWIST SIGNALS
Senkou A/B crosses in the future cloud — the classic early trend-change warning — now marked on chart (⚡▲/⚡▼) with alerts. Informational only: a twist does not arm TP/SL levels.

■ NEW — MOMENTUM DIVERGENCE ENGINE
Regular bullish/bearish divergence between price pivots and the Momentum Pulse. Pivot-based and non-repainting: a signal appears a fixed number of bars after the pivot (the pivot confirmation lag — disclosed in the tooltip, not hidden). Labels + alerts. Informational only.

■ REDESIGNED DASHBOARD
Sectioned layout (Market / MTF / Trade / Honest Stats) with individual toggles, trend-colored header, zebra rows, a tooltip on every cell explaining what you're looking at, dynamic height, a new Middle Right position, and the Trade section collapsing to one row when flat.

■ NEW ALERTS
TP2 and TP3 hits, Kumo retest (bull/bear), Kumo twist, momentum divergence, break-even move. All webhook-JSON compatible where applicable.

■ NEW OPTIONS
"Ignore Signals While Trade Active" — an open setup runs to TP3 or SL instead of being overwritten (OFF by default, legacy behavior preserved). "Show Closed Trade (bars)" — how long a closed record stays on chart.

One behavior change to be aware of: intrabar ambiguity in TP/SL tracking now resolves worst-case — a wide bar touching both a TP and the SL counts as SL. Your stats may look slightly worse than before. They are also more honest, and I'll take honest over pretty every time.

No settings migration needed: all new features default to the legacy behavior. If you spot anything off, comment below — every report gets investigated.

免責事項

これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。