OPEN-SOURCE SCRIPT
Diupdate

0 Anchored VWAP Strategy - Full Suite v21

972
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.
Catatan Rilis
Stoch to 47
Catatan Rilis
added Market Capital
Catatan Rilis
small BugFixes
Catatan Rilis
Bugfixes
Catatan Rilis
//Update v31: Added Exposure (Time in Market) tracking. Calmar Ratios are now strictly exposure-adjusted.
Catatan Rilis
//Update v33: Added Minimum Hold Time to prevent immediate VWAP exits after an entry.
Catatan Rilis
added Sharpe Ratio
Catatan Rilis
Update v38: Integrated Full 21-Row Performance Dashboard & frozen end-date metrics.

Pernyataan Penyangkalan

Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.