OPEN-SOURCE SCRIPT
업데이트됨

PVSRA v5

2 717
Overview of the PVSRA Strategy

This strategy is designed to detect and capitalize on volume-driven threshold breaches in price candles. It operates on the premise that when a high-volume candle breaks a critical price threshold, not all orders are filled within that candle’s range. This creates an imbalance—similar to a physical system being perturbed—causing the price to revert toward the level where the breach occurred to “absorb” the residual orders.

Key Features and Their Theoretical Underpinnings

Dynamic Volume Analysis and Threshold Detection

Volume Surges as Market Perturbations:
The script computes a moving average of volume over a short window and flags moments when the current volume significantly exceeds this average. These surges act as a perturbation—injecting “energy” into the market.
Adaptive Abnormal Volume Threshold:
By calculating a dynamic abnormal threshold using a daily volume average (via an 89-period VWMA) and standard deviation, the strategy identifies when the current volume is abnormally high. This mechanism mirrors the idea that when a system is disturbed (here, by a volume surge), it naturally seeks to return to equilibrium.
Candle Coloring and Visual Signal Identification

Differentiation of Candle Types:
The script distinguishes between bullish (green) and bearish (red) candles. It applies different colors based on the strength of the volume signal, providing a clear, visual representation of whether a candle is likely to trigger a price reversion.
Implication of Unfilled Orders:
A red (bearish) candle with high volume implies that sell pressure has pushed the price past a critical threshold—yet not all buy orders have been fulfilled. Conversely, a green (bullish) candle indicates that aggressive buying has left pending sell orders. In both cases, the market is expected to reverse toward the breach point to restore balance.
Trade Execution Logic: Normal and Reversal Trades

Normal Trades:
When a high-volume candle breaches a threshold and meets the directional conditions (e.g., a red candle paired with price above a daily upper band), the strategy enters a trade anticipating a reversion. The underlying idea is that the market will move back to the level where the threshold was crossed—clearing the residual orders in a manner analogous to a system following the path of least resistance.
Reversal Trades:
The strategy also monitors for clusters of consecutive signals within a short lookback period. When multiple signals accumulate, it interprets this as the market having overextended and, in a corrective move, reverses the typical trade direction. This inversion captures the market’s natural tendency to “correct” itself by moving in discrete, quantized steps—each step representing the absorption of a minimum quantum of order imbalance.
Risk and Trade Management

Stop Loss and Take Profit Buffers:
Both normal and reversal trades include predetermined buffers for stop loss and take profit levels. This systematic risk management approach is designed to capture the anticipated reversion while minimizing potential losses, aligning with the idea that market corrections follow the most energy-efficient path back to equilibrium.
Symbol Flexibility:
An option to override the chart’s symbol allows the strategy to be applied consistently across different markets, ensuring that the volume and price dynamics are analyzed uniformly.
Conceptual Bridge: From Market Dynamics to Trade Execution

At its core, the strategy treats market price movements much like a physical system that seeks to minimize “transactional energy” or inefficiency. When a price candle breaches a key threshold on high volume, it mimics an injection of energy into the system. The subsequent price reversion is the market’s natural response—moving in the most efficient path back to balance. This perspective is akin to the principle of least action, where the system evolves along the trajectory that minimizes cumulative imbalance, and it acknowledges that these corrections occur in discrete steps reflective of quantized order execution.

This unified framework allows the PVSRA strategy to not only identify when significant volume-based threshold breaches occur but also to systematically execute trades that benefit from the expected corrective moves.
릴리즈 노트
Strategy Declaration
This section sets the version and basic properties for the strategy. It defines the strategy's title, a shorter version of the title, whether to overlay the strategy on the chart, and how many entries (pyramiding) are allowed. It’s the foundation for how the script will be executed and displayed.

Inputs
This part defines user-configurable parameters. It includes settings for overriding the chart symbol, choosing a specific symbol, enabling candle color changes, and adjusting risk management settings (stop loss and take profit buffers). It also provides inputs for reversal trade conditions and the lookback period for core trade signals. These inputs make the strategy customizable to different trading styles.

Daily Bollinger Band (Logic Only)
This section calculates key technical indicators on a daily timeframe. It computes an 89-period VWMA and standard deviation, then uses these to establish upper and lower Bollinger band levels. The daily close is also fetched. These values are later used to filter entries based on broader market conditions.

Custom Sum Function
A helper function is defined here to sum a series over a given number of bars. This function is particularly used to count reversal signals over a custom lookback period, making it easier to evaluate signal strength over multiple bars.

Security Function
This block creates a function that fetches data (volume, high, low, close, open) from either an overridden symbol or the current chart symbol. It ensures that data retrieval is consistent across different symbols and provides flexibility if you wish to analyze a different asset without changing the chart.

Calculations
Here, the code computes volume sums and averages over a 10-bar period. It also calculates a value based on volume and the price range, and identifies the highest such value over 10 bars. These metrics form the basis for later volume analysis and signal generation.

Volume Analysis (VA)
This section uses conditional logic to assess if the volume is significantly above the average. It assigns specific values based on the conditions met. This analysis distinguishes between different volume levels (high or extremely high) and adapts based on whether an override symbol is used.

Candle Coloring
Based on whether a bar is bullish or bearish and the volume analysis, this part assigns different colors to the candles. The colors are defined for normal and abnormal volume conditions, helping traders visually identify potential trade signals directly on the chart.

Dynamic Average Daily Volume Calculation
The script calculates the average daily volume (ADV) using an exponential moving average over 365 days. It then derives an abnormal volume threshold dynamically based on the ADV and the current timeframe. This threshold is plotted for reference, providing context for volume-based signals.

Signal Definitions
This section defines the conditions for triggering trades. It checks if volume from a specific lookback period exceeds the dynamically calculated threshold and whether the price action indicates a bullish or bearish bar. These triggers form the core signals that initiate the trades.

Reversal Conditions
By using the custom sum function, this block counts the number of reversal signals (both red and green) over a defined lookback period. It sets flags to indicate if enough reversal signals have occurred, and only then will reversal trades be considered, ensuring that a trend reversal is substantiated.

Strategy Logic
The final section implements the trade entries and exits based on the signals and market conditions. It first checks for reversal trade conditions, applying a different logic for entries and exits. If no reversal conditions are met, it then checks for normal trade entries and manages risk by setting stop loss and take profit levels based on historical bars. This logic is executed only when no position is open, ensuring clear entry points.

면책사항

이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.