PROTECTED SOURCE SCRIPT
Telah dikemas kini

Elliott Wave / NeoWave Rule Engine – v6.9

393
This script functions as a "rule engine" that automatically identifies significant price swings and then tests them against a comprehensive set of Elliott Wave rules and guidelines.

The goal is to filter out low-probability setups and identify valid motive (impulse and diagonal) waves by applying user-defined tolerances. The script plots swings on the chart and can display a real-time dashboard that shows which rules are passing or failing. When a valid motive wave is detected, it can generate buy or sell signals.

User Settings
The script's behavior is controlled by a set of user inputs, organized into four main groups.

Swing / ZigZag Detection
These settings control how the script identifies the price swings that form the basis of the wave patterns.

Pivot Left Bars & Pivot Right Bars: These two values determine the sensitivity of the swing detection. A pivot point (a high or low) is only identified if it is the highest or lowest price within the specified number of bars to its left and right. Increasing these numbers will result in fewer, larger swings.

Minimum swing % (filter micro noise): This is a crucial filter. It ignores swings that are too small to be considered significant, helping to clean up the chart and prevent the engine from analyzing "noise." For example, a value of 0.3 means any swing that is less than 0.3% of the price range will be ignored.

Rule Engine Tolerances
This group allows you to define how strict the validation rules are.

Fibonacci tolerance (±%): This sets the acceptable margin of error for Fibonacci relationships (e.g., a 0.618 retracement). A value of 0.001 means a retracement between 0.617 and 0.619 will be considered a valid match.

Same-degree TIME proportion max (x): This sets the maximum time difference allowed between waves of the same degree (e.g., Wave 1 and Wave 3) to still be considered "proportional." A value of 1 means Wave 3's duration can be up to 1 time longer than Wave 1's duration, and vice-versa.

Same-degree PRICE proportion max (x): Similar to the time tolerance, this sets the maximum price difference allowed between waves of the same degree to still be considered proportional.

Alternation slope ratio threshold: This is a key NeoWave guideline. It checks if Wave 2 and Wave 4 have different "sharpness" (price change per bar). A higher value makes the alternation rule stricter.

Min guideline passes for motive validation (0–7): This is the gating feature. Even if a pattern passes all the hard Elliott Wave rules (e.g., no overlap, Wave 3 isn't the shortest), you can still require it to pass a minimum number of guidelines (like Fibonacci relationships, alternation, etc.) before a signal is generated. A value of 7 means every guideline must be met.

Momentum / Volume Guidelines
These are additional checks for pattern validation.

Momentum length:
This setting controls a proxy for momentum, which is calculated based on the speed of price movement.

Use volume checks: This is a placeholder for future functionality. It does not currently affect the script's behavior.

UI / Debug
These settings control the visual aspects of the script on your chart.

Max swings to keep/evaluate: This determines how far back the script looks to find and analyze swings. A larger number will analyze more historical patterns but may impact performance.

Show detected labels: Toggles the display of numerical (1-2-3-4-5) and letter (A-B-C) labels on the detected waves.

Show rule PASS/FAIL dashboard: Toggles the on-chart table that provides a detailed breakdown of which rules and guidelines are met.

Table Position: Controls where the rule dashboard is located on your chart.

Print debug info to Data Window: If you are a developer or want to see the underlying data, this will print information to TradingView's Data Window.

Show Buy/Sell Signals: Toggles the display of Buy/Sell signals. These signals are only generated when a pattern passes all the hard rules and your minimum guideline pass requirement.
Nota Keluaran
What it does

This tool scans price action for small and large swings using looped pivot searches, then evaluates the most recent 6/4 swing sets against a compact Elliott/NeoWave rule engine. When an Impulse (or Diagonal) satisfies hard rules and enough guidelines, it can emit Buy/Sell labels gated by loop consensus and configurable tolerances. Corrective (ABC) checks are included for context and a lightweight PASS/WARN/FAIL dashboard is available.

Key Features
• aggregating pivots with % change gating inside the loop,
• filtering post-aggregation by minimum swing %,
• optionally aligning small vs. large structure before signaling.
• Two looped swing detectors
• Small swings (left/right windows you set) with post-aggregation min % filter
• Large swings (separate windows) with their own min % filter
• Loop consensus metrics
• Counts how many (left,right) combos agree a bar is a pivot → Buy/Sell consensus ratios

Elliott/NeoWave rule engine

Hard rules: W2 not beyond W1 start; W3 not the shortest; W4 doesn’t overlap W1

Guidelines (score out of 7): fib-ish retracements (W2/W4), momentum/“strength” of W3, alternation, price/time proportionality, W5 weaker than W3

Diagonal fallback: if overlap rule fails but others pass and guidelines meet your bar

Signal gating

Minimum small/large loop consensus, consensus margin vs. opposite, optional small/large directional alignment, optional “Large 1–5 valid” required, and final score threshold

Clear visuals

Blue (small) and orange (large) swing segments

Optional labels (1-5 / A-B-C) and a table dashboard with per-rule status

Inputs (high level)
Smaller Wave Swing Detection (Looped)

Small Left/Right Min/Max: pivot scan windows (looped combinations)

Small Minimum swing % (post-aggregation): filters tiny swings before they enter the array

Larger Wave Swing Detection (Looped)

Large Left/Right Min/Max: independent windows for broader structure

Large Minimum swing % (post-aggregation)

Loop Filters (inside the loop)

Small/Large loop min % change: a pivot counts only if change vs. last opposite swing ≥ this

Rule Engine Tolerances

Fibonacci tolerance (±%)

Same-degree TIME/PRICE proportion max (x)

Alternation slope ratio threshold (higher = stricter)

Min guideline passes for motive validation (0–7)

Signal Probability (Loop Consensus)

Toggle signals, set min small/large consensus (0..1), consensus margin, require alignment, require Large 1–5 valid, min final score, and score annotation on labels

UI / Debug

Max swings to keep, Show labels, Show rule dashboard + position, Print debug, and loop combo warning

How signals are decided (simplified)

The latest small swings are tested for Impulse/Diagonal validity.

If valid, optional large swings are also tested to confirm direction/quality.

On the bar where a new pivot is accepted, the script checks:

Small-side consensus ≥ Min SMALL loop consensus,

Consensus margin vs. opposite side,

(Optional) Small/large alignment and Large pattern valid,

Final score (consensus × quality) ≥ threshold.

If all pass, a Buy (green) or Sell (red) label is plotted (optionally with % score).

Tips & recommended starting points

If you see too many micro-swings, raise Small Minimum swing % or Small loop min % change.

If large structure seems noisy, widen Large Left/Right and/or raise Large Minimum swing %.

Tighten Fibonacci tolerance and Alternation threshold to be stricter; loosen to get more candidates.

Want higher-quality signals? Increase Min guideline passes, consensus thresholds, and Min final score.

Turn on Show rule PASS/FAIL dashboard to understand why a candidate passed or failed.

Notes & limitations

Works best on instruments/timeframes with reasonably clean swings; noisy ranges may require stricter % thresholds.

Labels are not repaint-free until a pivot is fully formed by the chosen left/right windows; this script only signals when a new pivot is finalized under your gating.

The guideline score is a heuristic—use alongside your own analysis and risk management.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.