OPEN-SOURCE SCRIPT
Advanced SuperTrend and Volume Oscillator Indicator

Overview
This is an Advanced Momentum Confluence Engine which is a state-aware, intraday algorithmic trading script. It blends structural trend identifiers (SuperTrend, VWAP) with raw momentum oscillators (Volume, Stochastic RSI).
The system ensures high-probability entries through strict 2-bar trajectory confirmation and price-action validation. It features an isolated state machine, custom time-based end-of-day (EOD) square-offs tailored for the Indian market, and structured JSON outputs for seamless integration with external Python execution engines.
Core Indicator Components
A. Trend Structure: SuperTrend
Acts as the macro directional bias and dynamic trailing support/resistance.
Calculation: Standard ATR-based multiplier.
Parameters: ATR Length = 10, Multiplier = 3.0.
System States: Bullish (stGreen), Bearish (stRed).
B. Intraday Mean: Volume Weighted Average Price (VWAP)
Acts as the baseline for intraday valuation, structural trade confirmation, and early stop-loss triggers.
Calculation: Standard Session VWAP based on Typical Price (hlc3).
C. Volume Acceleration: Raw Volume Oscillator
Measures relative volume momentum to confirm institutional participation without lagging EMA overlays.
Calculation: $100 \times \frac{EMA(Volume, 5) - EMA(Volume, 10)}{EMA(Volume, 10)}$
Parameters: Short EMA = 5, Long EMA = 10.
D. Price Velocity: Averaged Stochastic RSI
Measures the speed of price movement relative to its recent intraday range.
Calculation: Computes the mathematical average of the %K and %D lines (avgStoch).
Parameters: RSI Length = 14, Stochastic Length = 14, K Smooth = 3, D Smooth = 3.
Extremity Zones: Oversold (< 20), Overbought (> 80), Stuck Bottom (<= 1), Stuck Top (>= 99).
3. Signal Validation & Price Action Filters
To eliminate "head fake" signals and slippage, the engine requires a combination of sustained momentum and immediate price action alignment.
2-Bar Momentum Trajectory:
Both the Volume Oscillator and the Stochastic RSI must be actively moving in the intended direction for two consecutive bars.
Rising: ta.rising(val, 2) (Current > Previous > 2 Bars Ago).
Falling: ta.falling(val, 2) (Current < Previous < 2 Bars Ago).
Candle Color Validation: The engine will not buy into active selling or sell into active buying.
Long Requirement: Execution candle must be Green (close > open).
Short Requirement: Execution candle must be Red (close < open).
This is an Advanced Momentum Confluence Engine which is a state-aware, intraday algorithmic trading script. It blends structural trend identifiers (SuperTrend, VWAP) with raw momentum oscillators (Volume, Stochastic RSI).
The system ensures high-probability entries through strict 2-bar trajectory confirmation and price-action validation. It features an isolated state machine, custom time-based end-of-day (EOD) square-offs tailored for the Indian market, and structured JSON outputs for seamless integration with external Python execution engines.
Core Indicator Components
A. Trend Structure: SuperTrend
Acts as the macro directional bias and dynamic trailing support/resistance.
Calculation: Standard ATR-based multiplier.
Parameters: ATR Length = 10, Multiplier = 3.0.
System States: Bullish (stGreen), Bearish (stRed).
B. Intraday Mean: Volume Weighted Average Price (VWAP)
Acts as the baseline for intraday valuation, structural trade confirmation, and early stop-loss triggers.
Calculation: Standard Session VWAP based on Typical Price (hlc3).
C. Volume Acceleration: Raw Volume Oscillator
Measures relative volume momentum to confirm institutional participation without lagging EMA overlays.
Calculation: $100 \times \frac{EMA(Volume, 5) - EMA(Volume, 10)}{EMA(Volume, 10)}$
Parameters: Short EMA = 5, Long EMA = 10.
D. Price Velocity: Averaged Stochastic RSI
Measures the speed of price movement relative to its recent intraday range.
Calculation: Computes the mathematical average of the %K and %D lines (avgStoch).
Parameters: RSI Length = 14, Stochastic Length = 14, K Smooth = 3, D Smooth = 3.
Extremity Zones: Oversold (< 20), Overbought (> 80), Stuck Bottom (<= 1), Stuck Top (>= 99).
3. Signal Validation & Price Action Filters
To eliminate "head fake" signals and slippage, the engine requires a combination of sustained momentum and immediate price action alignment.
2-Bar Momentum Trajectory:
Both the Volume Oscillator and the Stochastic RSI must be actively moving in the intended direction for two consecutive bars.
Rising: ta.rising(val, 2) (Current > Previous > 2 Bars Ago).
Falling: ta.falling(val, 2) (Current < Previous < 2 Bars Ago).
Candle Color Validation: The engine will not buy into active selling or sell into active buying.
Long Requirement: Execution candle must be Green (close > open).
Short Requirement: Execution candle must be Red (close < open).
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.