OPEN-SOURCE SCRIPT
تم تحديثه 0 Anchored VWAP Strategy - Full Suite v21

0 Anchored VWAP Strategy - Full Suite
Overview
The "0 Anchored VWAP Strategy - Full Suite" is a comprehensive and highly customizable trading system designed to capture momentum breakouts. At its core, the strategy anchors Volume-Weighted Average Price (VWAP) lines to significant market turning points identified by a Stochastic RSI. It provides a robust framework for both long and short trading, equipped with advanced risk management and filtering tools.
Core Logic
Momentum Identification: The strategy calculates a smoothed Stochastic RSI to detect overbought and oversold market conditions.
Dynamic Anchoring: * A High VWAP (Red Line) is anchored to the peak price when the Stochastic RSI crosses down from the overbought territory.
A Low VWAP (Green Line) is anchored to the lowest price when the Stochastic RSI crosses up from the oversold territory.
Entry & Exit: A Long position is triggered when the price breaks above the resistance of the High VWAP. Conversely, a default exit occurs if the price breaks below the support of the Low VWAP.
Advanced Features & Modules
This "Full Suite" version includes a modular set of advanced filters and exits that can be individually toggled in the settings to adapt to any asset or timeframe:
MTF Trend Filter: A Multi-Timeframe Moving Average (SMA or EMA). When enabled, trades are only taken in the direction of the macro trend (e.g., requiring the price to be above the 250-day EMA for longs), protecting against prolonged bear markets.
Volume Confirmation: Filters out fakeouts by requiring the breakout candle to have trading volume significantly higher than the recent average.
Short Selling: Fully supports short trades with mirrored logic for downtrends.
ATR Stop-Loss: A dynamic, volatility-based hard stop-loss to limit drawdowns in case the market crashes before the VWAP exit triggers.
Partial Take Profits (Scaling Out): Automatically secures profits by selling a defined percentage of the position once a specific target (in %) is reached.
Built-In Performance Dashboard
The strategy features an integrated, on-chart performance table that updates in real-time. It compares the strategy's metrics directly against a standard "Buy & Hold" approach over your defined backtest period. Metrics include:
Total Return (%)
CAGR (Compound Annual Growth Rate)
Maximum Drawdown (%) & Date of Max DD
Relative Performance (Strategy vs. Buy & Hold)
Total Number of Trades closed
Visualization
An optional "Relative Equity Curve" can be displayed directly on the main chart, scaled to the starting price of the backtest. This allows for an immediate visual comparison of how the strategy performs relative to the underlying asset's price action.
Overview
The "0 Anchored VWAP Strategy - Full Suite" is a comprehensive and highly customizable trading system designed to capture momentum breakouts. At its core, the strategy anchors Volume-Weighted Average Price (VWAP) lines to significant market turning points identified by a Stochastic RSI. It provides a robust framework for both long and short trading, equipped with advanced risk management and filtering tools.
Core Logic
Momentum Identification: The strategy calculates a smoothed Stochastic RSI to detect overbought and oversold market conditions.
Dynamic Anchoring: * A High VWAP (Red Line) is anchored to the peak price when the Stochastic RSI crosses down from the overbought territory.
A Low VWAP (Green Line) is anchored to the lowest price when the Stochastic RSI crosses up from the oversold territory.
Entry & Exit: A Long position is triggered when the price breaks above the resistance of the High VWAP. Conversely, a default exit occurs if the price breaks below the support of the Low VWAP.
Advanced Features & Modules
This "Full Suite" version includes a modular set of advanced filters and exits that can be individually toggled in the settings to adapt to any asset or timeframe:
MTF Trend Filter: A Multi-Timeframe Moving Average (SMA or EMA). When enabled, trades are only taken in the direction of the macro trend (e.g., requiring the price to be above the 250-day EMA for longs), protecting against prolonged bear markets.
Volume Confirmation: Filters out fakeouts by requiring the breakout candle to have trading volume significantly higher than the recent average.
Short Selling: Fully supports short trades with mirrored logic for downtrends.
ATR Stop-Loss: A dynamic, volatility-based hard stop-loss to limit drawdowns in case the market crashes before the VWAP exit triggers.
Partial Take Profits (Scaling Out): Automatically secures profits by selling a defined percentage of the position once a specific target (in %) is reached.
Built-In Performance Dashboard
The strategy features an integrated, on-chart performance table that updates in real-time. It compares the strategy's metrics directly against a standard "Buy & Hold" approach over your defined backtest period. Metrics include:
Total Return (%)
CAGR (Compound Annual Growth Rate)
Maximum Drawdown (%) & Date of Max DD
Relative Performance (Strategy vs. Buy & Hold)
Total Number of Trades closed
Visualization
An optional "Relative Equity Curve" can be displayed directly on the main chart, scaled to the starting price of the backtest. This allows for an immediate visual comparison of how the strategy performs relative to the underlying asset's price action.
ملاحظات الأخبار
Stoch to 47ملاحظات الأخبار
added Market Capitalملاحظات الأخبار
small BugFixesملاحظات الأخبار
Bugfixesملاحظات الأخبار
//Update v31: Added Exposure (Time in Market) tracking. Calmar Ratios are now strictly exposure-adjusted.ملاحظات الأخبار
//Update v33: Added Minimum Hold Time to prevent immediate VWAP exits after an entry.ملاحظات الأخبار
added Sharpe Ratioملاحظات الأخبار
Update v38: Integrated Full 21-Row Performance Dashboard & frozen end-date metrics.نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.