OPEN-SOURCE SCRIPT

Z-Score Based Momentum Zones with Advanced Volatility Channels

Cập nhật
The indicator "Z-Score Based Momentum Zones with Advanced Volatility Channels" combines various technical analysis components, including volatility, price changes, and volume correction, to calculate Z-Scores and determine momentum zones and provide a visual representation of price movements and volatility based on multi timeframe highest high and lowest low values.

Note: THIS IS A IMPROVEMNT OF "Multi Time Frame Composite Bands" INDICATOR OF MINE WITH MORE EMPHASIS ON MOMENTUM ZONES CALULATED BASED ON Z-SCORES

Input Options

look_back_length: This input specifies the look-back period for calculating intraday volatility. correction It is set to a default value of 5.

lookback_period: This input sets the look-back period for calculating relative price change. The default value is 5.

zscore_period: This input determines the look-back period for calculating the Z-Score. The default value is 500.

avgZscore_length: This input defines the length of the momentum block used in calculations, with a default value of 14.

include_vc: This is a boolean input that, if set to true, enables volume correction in the calculations. By default, it is set to false.

1. Volatility Bands (Composite High and Low):

Composite High and Low: These are calculated by combining different moving averages of the high prices (high) and low prices (low). Specifically:
a_high and a_low are calculated as the average of the highest (ta.highest) and lowest (ta.lowest) high and low prices over various look-back periods (5, 8, 13, 21, 34) to capture short and long-term trends.

b_high and b_low are calculated as the simple moving average (SMA) of the high and low prices over different look-back periods (5, 8, 13) to smooth out the trends.

high_c and low_c are obtained by averaging a_high with b_high and a_low with b_low respectively.

IDV Correction Calulation : In this script the Intraday Volatility (IDV) is calculated as the simple moving average (SMA) of the daily high-low price range divided by the closing price. This measures how much the price fluctuates in a given period.
Composite High and Low with Volatility: The final c_high and c_low values are obtained by adjusting high_c and low_c with the calculated intraday volatility (IDV). These values are used to create the "Composite High" and "Composite Low" plots.

Composite High and Low with Volatility Correction: The final c_high and c_low values are obtained by adjusting high_c and low_c with the calculated intraday volatility (IDV). These values are used to create the "Composite High" and "Composite Low" plots.

2. Momentum Blocks Based on Z-Score:

Relative Price Change (RPC):

The Relative Price Change (rpdev) is calculated as the difference between the current high-low-close average (hlc3) and the previous simple moving average (psma_hlc3) of the same quantity. This measures the change in price over time.

Additionally, std_hlc3 is calculated as the standard deviation of the hlc3 values over a specified look-back period. The standard deviation quantifies the dispersion or volatility in the price data.

The rpdev is then divided by the std_hlc3 to normalize the price change by the volatility. This normalization ensures that the price change is expressed in terms of standard deviations, which is a common practice in quantitative analysis.

Essentially, the rpdev represents how many standard deviations the current price is away from the previous moving average.

Volume Correction (VC): If the include_vc input is set to true, volume correction is applied by dividing the trading volume by the previous simple moving average of the volume (psma_volume). This accounts for changes in trading activity.

Volume Corrected Relative Price Change (VCRPD): The vcrpd is calculated by multiplying the rpdev by the volume correction factor (vc). This incorporates both price changes and volume data.

Z-Scores: The Z-scores are calculated by taking the difference between the vcrpd and the mean (mean_vcrpd) and then dividing it by the standard deviation (stddev_vcrpd). Z-scores measure how many standard deviations a value is away from the mean. They help identify whether a value is unusually high or low compared to its historical distribution.

Momentum Blocks: The "Momentum Blocks" are essentially derived from the Z-scores (avgZScore). The script assigns different colors to the "Fill Area" based on predefined Z-score ranges. These colored areas represent different momentum zones:

Positive Z-scores indicate bullish momentum, and different shades of green are used to fill the area.

Negative Z-scores indicate bearish momentum, and different shades of red are used.

Z-scores near zero (between -0.25 and 0.25) suggest neutrality, and a yellow color is used.
Phát hành các Ghi chú
updated default momentum block length to 14
Bands and ChannelsmomentumanalysisstatisticsVolatilityvolatilitybandsvolatilitybreakout

Mã nguồn mở

Theo tinh thần TradingView thực sự, tác giả của tập lệnh này đã xuất bản dưới dạng nguồn mở để các nhà giao dịch có thể hiểu và xác minh. Chúc mừng tác giả! Bạn có thể sử dụng miễn phí. Tuy nhiên, bạn cần sử dụng lại mã này theo Quy tắc nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?

Thông báo miễn trừ trách nhiệm