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が提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。