OPEN-SOURCE SCRIPT

VIDYA For-Loop | QuantEdgeB

432
Introducing VIDYA For-Loop by QuantEdgeB

Overview
The VIDYA For-Loop indicator by QuantEdgeB is a dynamic trend-following tool that leverages Variable Index Dynamic Average (VIDYA) along with a rolling loop function to assess trend strength and direction. By utilizing adaptive smoothing and a recursive loop for threshold evaluation, this indicator provides a more responsive and robust signal framework for traders.

______

Key Components & Features

📌 VIDYA (Variable Index Dynamic Average)
- Adaptive Moving Average that adjusts its responsiveness based on market volatility.
- Uses a dynamic smoothing constant based on standard deviations.
- Allows for better trend detection compared to static moving averages.

📌 Loop Function (Rolling Calculation)
- A for-loop algorithm continuously compares VIDYA values over a defined lookback range.
- Measures the number of times price trends higher or lower within the rolling window.
- Generates a momentum-based score that helps quantify trend persistence.

📌 Trend Signal Calculation
- A long signal is triggered when the loop score exceeds the upper threshold.
- A short signal is triggered when the loop score falls below the lower threshold.
- The result is a clear directional bias that adapts to changing market conditions.

______

How It Works in Trading

✅ Detects Trend Strength – By measuring cumulative movements within a window.
✅ Filters Noise – Uses adaptive smoothing to avoid whipsaws.
✅ Dynamic Thresholds – Enables customized entry & exit conditions.
✅ Color-Coded Candles – Provides visual clarity for traders.

______

Visual Representation

Trend Signals:
🔵 Blue Candles – Strong Uptrend
🔴 Red Candles – Strong Downtrend

Thresholds:

📈 Long Threshold – Upper bound for bullish confirmation.
📉 Short Threshold – Lower bound for bearish confirmation.
Labels & Annotations (Optional):

✅ Long & Short Labels can be turned on or off for trade signal clarity.
📊 Display of entry & exit points based on loop calculations.

______

Settings:

VIDYA Length: 2 → Number of bars for VIDYA calculation.
SD Length: 5 → Standard deviation length for VIDYA calculation.
Source: Close → Defines the input data source (Close price).
Start Loop: 1 → Initial lookback period for the loop function.
End Loop: 60 → Maximum lookback range for trend scoring.
Long Threshold: 40 → Upper bound for a long signal.
Short Threshold: 10 → Lower bound for a short signal.
Extra Plots: True → Enables additional moving averages for visualization.

______

Conclusion
The VIDYA For-Loop by QuantEdgeB is a next-gen adaptive trend filter that combines dynamic smoothing with recursive trend evaluation, making it an invaluable tool for traders seeking precision and consistency in their strategies.

🔹Who should use VIDYA For Loop:
📊 Trend-Following Traders – Helps identify sustained trends.
⚡ Momentum Traders – Captures strong price swings.
🚀 Algorithmic & Systematic Trading – Ideal for automated entries & exits.

🔹 Disclaimer: Past performance is not indicative of future results. No trading strategy can guarantee success in financial markets.
🔹 Strategic Advice: Always backtest, optimize, and align parameters with your trading objectives and risk tolerance before live trading.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.