OPEN-SOURCE SCRIPT
מעודכן

VWAP Cross Flow Engine [AGPro Series]

1 860
VWAP Cross Flow Engine [AGPro Series]

🔹 OVERVIEW

VWAP Cross Flow Engine is a precision scoring system for price-to-VWAP
crossovers. Instead of treating every VWAP cross as a binary signal,
this indicator measures the QUALITY of each crossover event in real
time using a weighted composite score derived from momentum, volume
expansion and optional sigma-band confluence. The engine is designed
for intraday scalpers and swing traders who rely on VWAP as a dynamic
equilibrium reference and need a structured way to separate high-
conviction continuation crosses from low-quality noise flips.

The script plots an anchored Volume-Weighted Average Price line with
optional volume-weighted standard-deviation bands, detects every
price/VWAP crossover event, scores each one on a 0–100 scale and
visualizes the result through compact X markers, directional bar
coloring, a retrospective quality dashboard and a dynamic bias zone
anchored on the strongest crosses.

תמונת-בזק

🔸 UNIQUE EDGE

Most VWAP-based tools stop at plotting the line and marking raw
crossovers. VWAP Cross Flow Engine adds a multi-factor quality layer
on top of the crossover itself:

• Every cross receives a composite score, not a pass/fail flag
• Momentum sub-score derived from RSI distance from 50 at cross bar
• Volume sub-score derived from current volume vs SMA baseline
• Optional confluence bonus when cross occurs beyond 2-sigma envelope
• Retrospective follow-through measurement in ATR units
• Session-aware counters with automatic daily-vs-higher-timeframe
label switching
• ATR-based cooldown filter that prevents label overlap on any
timeframe, not just bar-count cooldowns that fail on daily charts

The combination of live scoring + retrospective success tracking in a
single panel is the core differentiator. It allows the trader to both
filter new crosses and study the historical reliability of VWAP cross
behavior on any symbol and timeframe.


🔷 METHODOLOGY

1. VWAP CALCULATION
Volume-weighted average of HLC3 (configurable) anchored to the
Session, Week or Month boundary. Cumulative price*volume and
cumulative volume series are reset at every anchor change.

2. SIGMA BANDS (optional)
Volume-weighted variance computed as E[X²] − E[X]² where X is the
source price weighted by volume. Square root produces the true
volume-weighted standard deviation. 1σ and 2σ envelopes are drawn
around the VWAP line.

3. CROSS DETECTION
Standard ta.crossover / ta.crossunder between close and VWAP.

4. QUALITY SCORING
• Momentum sub-score: |RSI(14) − 50|, scaled to 0–40 range
• Volume sub-score: volume / SMA(20), capped at 3x, scaled 0–30
• Confluence bonus: +5 if prior bar touched the opposing 2σ band
• Total live score (max 70 or 75) is rescaled to 0–100

5. COOLDOWN FILTER
A new cross is only plotted if BOTH conditions are met:
• At least N bars since the last plotted cross
• At least K × ATR price distance from the last plotted cross

6. FOLLOW-THROUGH TRACKING
Each cross is stored with its direction, price and ATR at the time
of the event. After N bars, the displacement (in the cross
direction) is measured. Success rate and average follow-through
in ATR units are maintained inside a rolling lookback window.

7. QUALITY ZONE
A rectangle zone (0.8 × ATR tall by default, 60 bars long) is
drawn at every strong cross (score ≥ 70). The zone acts as a
dynamic bias area anchored on high-conviction VWAP interactions.


🔶 SIGNALS & ALERTS

The indicator fires five distinct alert conditions:

1. High-Quality VWAP Cross Up — bullish cross above the min quality
threshold with cooldown satisfied.
2. High-Quality VWAP Cross Down — bearish cross above the min quality
threshold with cooldown satisfied.
3. Strong VWAP Cross (≥70) — score 70 or higher; anchors a new
quality zone.
4. Price Reached +2σ Band — price extended to the upper sigma band
(optional, requires bands enabled).
5. Price Reached −2σ Band — price extended to the lower sigma band
(optional, requires bands enabled).


🔹 KEY INPUTS

VWAP Reference
• Source — price series used for VWAP (default HLC3)
• Anchor Type — Session / Week / Month
• Show VWAP Line

Sigma Bands
• Show Sigma Bands (default OFF)
• Inner Band Multiplier (default 1.0)
• Outer Band Multiplier (default 2.0)

Quality Engine
• Momentum (RSI) Length
• Volume Average Length
• Follow-Through Bars
• ATR Length
• Min Quality To Plot (default 50)
• Use Sigma Confluence Bonus
• Cooldown — Minimum Bars (default 5)
• Cooldown — Minimum ATR Distance (default 0.5)

Visuals
• Show Cross X Labels
• Show Target Projection (default OFF)
• Show Quality Zone
• Quality Zone Height (ATR) / Length (Bars)
• Color Bars By Cross Strength
• Auto Label Size (upscale on 1D+)

Panel
• Show Dashboard Panel
• Panel Position (6 positions)
• Panel Theme (Dark / Light)
• Panel Font Size
• Success Rate Lookback Bars


🔸 HOW TO USE

• INTRADAY SCALPING — use Session anchor on 5m–1h charts. Focus on
crosses scoring 70 or higher. The quality zone becomes a short-term
bias area: price holding above a bull zone mid-line tends to favor
continuation, breaks back through the mid-line tend to indicate
weakening conviction.

• SWING BIAS — use Week or Month anchor on 4h and daily charts. Treat
strong crosses as potential regime-shift events. Monitor the
Success Rate metric to calibrate expectations for the current
market and instrument.

• MEAN-REVERSION — enable sigma bands and confluence bonus. Crosses
that form after a 2σ stretch tend to score higher and mark
statistically meaningful reversal attempts.

• FILTER CALIBRATION — raise Min Quality To Plot to 60 or 70 for
high-selectivity environments; lower to 40 for noisier instruments
where you want earlier confirmation.

The dashboard gives at-a-glance context: how many crosses have fired
this session, how many were strong, what the historical win rate
looks like in the current lookback window, the average ATR-normalized
follow-through, and whether price is currently above or below VWAP.


🔷 LIMITATIONS & TRANSPARENCY

• This is NOT a strategy and does not generate buy/sell orders.
• Score is a quality filter, not a directional prediction. A high-
score cross still carries market risk and can fail.
• Follow-through statistics depend on lookback window size and
timeframe; adjust Success Rate Lookback to match your trading
horizon.
• Sigma bands require a reliable volume feed. On low-liquidity
instruments the bands may be noisy or meaningless.
• Anchored VWAP resets at each new anchor (Session / Week / Month);
early-in-anchor values use fewer samples and are less stable.
• The indicator repaints only within the cross bar itself (like any
crossover detector). Once a bar closes, the plotted cross and its
score are fixed.


🔶 RISK DISCLOSURE

This script is a technical analysis tool intended for educational
and analytical purposes. It does not constitute financial advice,
investment advice or a recommendation to buy or sell any asset.
Trading financial markets involves substantial risk of loss. Past
performance of any indicator is not indicative of future results.
Users are fully responsible for their own trading decisions and
should combine this tool with independent analysis and proper risk
management.
הערות שחרור
UPDATE NOTES - v1.4

This update reframes how the engine's output is interpreted and presented,
and corrects how the dashboard measures cross behavior.

This script continues to function as an analytical and visualization tool.
It does not attempt to predict price direction or provide guaranteed outcomes.


------------------------
What Changed
------------------------

- Reframed as a fade / reversion context tool
High-energy crosses that punch through VWAP often behave as exhaustion moves.
The engine now frames a high-quality cross as a potential fade back toward VWAP,
rather than as a continuation signal.

- Dashboard now measures reversion, on high-quality crosses only
Previously the success stats pooled every raw cross. They now reflect only
crosses that pass the quality filter, and they measure how far price reverts
back toward VWAP within the follow-through window. This makes the dashboard
describe the setups the engine actually flags.

- Reversion target projection
The projected target now points back toward VWAP (the reversion target),
shown in a distinct accent color, instead of projecting in the cross direction.

- Centered Fade Zone badge
The zone drawn from a strong cross now carries a centered label showing its
anchoring score, for clearer first-glance reading.

- Single active target and zone
Only the latest reversion target and the latest fade zone are kept on the
chart, reducing clutter from older drawings.


------------------------
Visual Improvements
------------------------

- Increased the offset of cross labels so they sit clearly above or below the
candles instead of overlapping them.

- Reduced visual clutter by keeping a single active target and a single zone.

- Refined visual hierarchy: the centered zone badge and the distinct reversion
target color make the key elements stand out.

- Cleaned all on-chart, panel and alert text to plain ASCII for consistent
rendering across devices and platforms.


------------------------
Interface & Usability
------------------------

- Renamed inputs and dashboard rows to match the fade / reversion framing
(Show Fade Zone, Show Reversion Target, Fade Win Rate, Avg Reversion,
Fade Sample).

- Removed an unused success-rate lookback input that did not affect output,
for a cleaner settings panel.

- Renamed alerts to fade-setup language so their intent is clear.


------------------------
Behavior Notes
------------------------

The cross detection and the 0-100 scoring engine (momentum, volume and the
optional sigma-band confluence bonus) are unchanged. What changed is the
interpretation and the dashboard: outputs are now presented as fade /
reversion context, and the statistics measure reversion rather than
continuation. A high score should be read as a high-energy cross that, in
observed samples, has tended to revert toward VWAP - not as a continuation
instruction.


------------------------
Limitations Reminder
------------------------

This remains a rule-based analytical tool. Market conditions such as
volatility, liquidity and timeframe differences affect how crosses and
reversions appear. Outputs should always be interpreted within broader
market context.


------------------------
Risk Reminder
------------------------

This script is for educational and analytical purposes only. It does not
provide financial advice or guaranteed trading outcomes. Users remain
responsible for their own decisions.
הערות שחרור
🔧 UPDATE NOTES - 1.5

This update adds a next-action stance, contrast-safe label text, and consistent
label sizing to the VWAP Cross Flow Engine. The core VWAP, cross scoring and
reversion-tracking logic remain unchanged. This script continues to function as an
analytical context tool. It does not predict price direction or provide guaranteed
outcomes.

------------------------
What Changed
------------------------

- Next-Action Stance Row
The dashboard now includes an Action row that translates distance from VWAP and
the latest cross into a clear fade stance - wait, watch for reversion, fade toward
VWAP, or review a fresh fade setup.

- Contrast-Safe Label Text
A luminance helper now sets the text color for cross labels, the reversion target
tag, and the fade-zone badge, so pink, teal and indigo elements stay clearly
readable.

- Consistent Label Sizing
The reversion target tag and fade-zone badge now follow the script's label-size
setting (and the 1D+ auto-upscale) instead of fixed sizes.

- Safer Volatility Handling
ATR is now guarded against missing or zero values for more robust target, zone and
cooldown spacing on thin or early data.

------------------------
Visual Improvements
------------------------

- Improved readability of cross labels, the target tag and the fade-zone badge
- Kept the VWAP line, sigma bands, fade zone, centered badge and reversion target
intact
- Preserved the clean single-active target and single-active zone behavior
- No added chart clutter

------------------------
Interface & Usability
------------------------

- Added an Action row to the dashboard panel
- Retained the existing Fade Win Rate, Avg Reversion and Fade Sample statistics
- Kept all existing settings and defaults backward compatible
- Enhanced overall experience without changing the core engine

------------------------
Behavior Notes
------------------------

This update does not change how VWAP, sigma bands, cross quality or the reversion
statistics are computed. The goal is added decision context and cleaner text
contrast. Outputs should be interpreted the same way as before.

------------------------
Limitations Reminder
------------------------

The script remains a rule-based analytical tool. Volatility, liquidity and timeframe
differences can affect how crosses and statistics appear. Always interpret outputs
within broader market context.

------------------------
Risk Reminder
------------------------

This script is for educational and analytical purposes only. It does not provide
financial advice or guaranteed trading outcomes. Users remain responsible for their
own decisions.

כתב ויתור

המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.