OPEN-SOURCE SCRIPT

VPSA-VTD

Dear Sir/Madam,

I am pleased to present the next iteration of my indicator concept, which, in my opinion, serves as a highly useful tool for analyzing markets using the Volume Spread Analysis (VSA) method or the Wyckoff methodology.

The VPSA (Volume-Price Spread Analysis), the latest version in the family of scripts I’ve developed, appears to perform its task effectively. The combination of visualizing normalized data alongside their significance, achieved through the application of Z-Score standardization, proved to be a sound solution. Therefore, I decided to take it a step further and expand my project with a complementary approach to the existing one.

Theory

At the outset, I want to acknowledge that I’m aware of the existence of other probabilistic models used in financial markets, which may describe these phenomena more accurately. However, in line with Occam's Razor, I aimed to maintain simplicity in the analysis and interpretation of the concepts below. For this reason, I focused on describing the data using the Gaussian distribution.

The data I read from the chart — primarily the closing price, the high-low price difference (spread), and volume — exhibit cyclical patterns. These cycles are described by Wyckoff's methodology, while VSA complements and presents them from a different perspective. I will refrain from explaining these methods in depth due to their complexity and broad scope. What matters is that within these cycles, various events occur, described by candles or bars in distinct ways, characterized by different spreads and volumes. When observing the chart, I notice periods of lower volatility, often accompanied by lower volumes, as well as periods of high volatility and significant volumes. It’s important to find harmony within this apparent chaos. I think that chart interpretation cannot happen without considering the broader context, but the more variables I include in the analytical process, the more challenges arise. For instance, how can I determine if something is large (wide) or small (narrow)? For elements like volume or spread, my script provides a partial answer to this question. Now, let’s get to the point.

Technical Overview

The first technique I applied is Min-Max Normalization. With its help, the script adjusts volume and spread values to a range between 0 and 1. This allows for a comparable bar chart, where a wide bar represents volume, and a narrow one represents spread. Without normalization, visually comparing values that differ by several orders of magnitude would be inconvenient. If the indicator shows that one bar has a unit spread value while another has half that value, it means the first bar is twice as large. The ratio is preserved.

The second technique I used is Z-Score Standardization. This concept is based on the normal distribution, characterized by variables such as the mean and standard deviation, which measures data dispersion around the mean. The Z-Score indicates how many standard deviations a given value deviates from the population mean. The higher the Z-Score, the more the examined object deviates from the mean. If an object has a Z-Score of 3, it falls within 0.1% of the population, making it a rare occurrence or even an anomaly. In the context of chart analysis, such strong deviations are events like climaxes, which often signal the end of a trend, though not always. In my script, I assigned specific colors to frequently occurring Z-Score values:
  • Below 1 – Blue
  • Above 1 – Green
  • Above 2 – Red
  • Above 3 – Fuchsia

These colors are applied to both spread and volume, allowing for quick visual interpretation of data.

Volume Trend Detector (VTD)

The above forms the foundation of VPSA. However, I have extended the script with a Volume Trend Detector (VTD). The idea is that when I consider market structure - by market structure, I mean the overall chart, support and resistance levels, candles, and patterns typical of spread and volume analysis as well as Wyckoff patterns - I look for price ranges where there is a lack of supply, demand, or clues left behind by Smart Money or the market's enigmatic identity known as the Composite Man. This is essential because, as these clues and behaviors of market participants — expressed through the chart’s dynamics - reflect the actions, decisions, and emotions of all players. These behaviors can help interpret the bull-bear battle and estimate the probability of their next moves, which is one of the key factors for a trader relying on technical analysis to make a trade decision.

I enhanced the script with a Volume Trend Detector, which operates in two modes:

Step-by-Step Logic

The detector identifies expected volume dynamics. For instance, when looking for signs of a lack of bullish interest, I focus on setups with decreasing volatility and volume, particularly for bullish candles. These setups are referred to as No Demand patterns, according to Tom Williams' methodology.

Simple Moving Average (SMA)

The detector can also operate based on a simple moving average, helping to identify systematic trends in declining volume, indicating potential imbalances in market forces.

I’ve designed the program to allow the selection of candle types and volume characteristics to which the script will pay particular attention and notify me of specific market conditions.
Advantages and Disadvantages

Advantages:

  • Unified visualization of normalized spread and volume, saving time and improving efficiency.
  • The use of Z-Score as a consistent and repeatable relative mechanism for marking examined values.
  • The use of colors in visualization as a reference to Z-Score values.
  • The possibility to set up a continuous alert system that monitors the market in real time.
  • The use of EMA (Exponential Moving Average) as a moving average for Z-Score.


The goal of these features is to save my time, which is the only truly invaluable resource.

Disadvantages:

  • The assumption that the data follows a normal distribution, which may lead to inaccurate interpretations.
  • A fixed analysis period, which may not be perfectly suited to changing market conditions.
  • The use of EMA as a moving average for Z-Score, listed both as an advantage and a disadvantage depending on market context.

I have included comments within the code to explain the logic behind each part. For those who seek detailed mathematical formulas, I invite you to explore the code itself.

Defining Program Parameters:

Numerical Conditions:
  • VPSA Period for Analysis – The number of candles analyzed.
  • Normalized Spread Alert Threshold – The expected normalized spread value; defines how large or small the spread should be, with a range of 0-1.00.
  • Normalized Volume Alert Threshold – The expected normalized volume value; defines how large or small the volume should be, with a range of 0-1.00.
  • Spread Z-SCORE Alert Threshold – The Z-SCORE value for the spread; determines how much the spread deviates from the average, with a range of 0-4 (a higher value can be entered, but from a logical standpoint, exceeding 4 is unnecessary).
  • Volume Z-SCORE Alert Threshold – The Z-SCORE value for volume; determines how much the volume deviates from the average, with a range of 0-4 (the same logical note as above applies).

Logical Conditions:

Logical conditions describe whether the expected value should be less than or equal to or greater than or equal to the numerical condition.
All four parameters accept two possibilities and are analogous to the numerical conditions.

Volume Trend Detector:
  • Volume Trend Detector Period for Analysis – The analysis period, indicating the number of candles examined.
  • Method of Trend Determination – The method used to determine the trend. Possible values: Step by Step or SMA.
  • Trend Direction – The expected trend direction. Possible values: Upward or Downward.
  • Candle Type – The type of candle taken into account. Possible values: Bullish, Bearish, or Any.


The last available setting is the option to enable a joint alert for VPSA and VTD.
When enabled, VPSA will trigger on the last closed candle, regardless of the VTD analysis period.

Example Use Cases (Labels Visible in the Script Window Indicate Triggered Alerts):

cuplikan

cuplikan

The provided labels in the chart window mark where specific conditions were met and alerts were triggered.

Summary and Reflections

The program I present is a strong tool in the ongoing "game" with the Composite Man.
However, it requires familiarity and understanding of the underlying methodologies to fully utilize its potential.
Of course, like any technical analysis tool, it is not without flaws. There is no indicator that serves as a perfect Grail, accurately signaling Buy or Sell in every case.

I would like to thank those who have read through my thoughts to the end and are willing to take a closer look at my work by using this script.

If you encounter any errors or have suggestions for improvement, please feel free to contact me.

I wish you good health and accurately interpreted market structures, leading to successful trades!

CatTheTrader
Candlestick analysisDemand ZoneSupply ZoneTrend AnalysisVolumevpsaVSAwyckoff

Skrip open-source

Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menerbitkannya sebagai sumber terbuka, sehingga para trader dapat memahami dan memverifikasinya. Hormat untuk penulisnya! Anda dapat menggunakannya secara gratis, namun penggunaan kembali kode ini dalam publikasi diatur oleh Tata Tertib. Anda dapat memfavoritkannya untuk digunakan pada chart

Inggin menggunakan skrip ini pada chart?


Juga di:

Pernyataan Penyangkalan