The indicator is designed to identify shifts or changes in trends as blocks, the indicator's focus on analyzing the Median of Means, Interquartile Range, and Practical Significance for potential trend changes in the market using non parametric Cohen's D. The script is designed to operate on blocks of 21 bars. The key parts of the script related to this are the conditions inside the "if" statements: The bar_index % 21 == 0 condition checks if the current bar index is divisible by 21, meaning it's the beginning of a new block of 21 bars. This condition is used to reset and calculate new values at the start of each block.
Therefore, signals or calculations related to the median of means (MoM), interquartile range (IQR), and Cohen's D are updated and calculated once every 21 bars. What this means is the frequency of signals is shown once every 21 bars. Price Movements of Blocks:
Block-Based Analysis: This approach divides the price data into blocks or segments, often a fixed number of bars or candles. Each block represents a specific interval of time or price action. It involves No Smoothing: Unlike moving averages, block-based analysis does not apply any smoothing to the price data within each block. It directly examines the raw prices within each block.
Let's break down the key concepts and how they are used for trading:
Median of Means (MoM):
The script calculates the median of the means of seven subgroups, each consisting of three bars in shuffled order. Each subgroup's mean is calculated based on the typical price (hlc3) of the bars within that subgroup. The median is then computed from these seven means, representing a central tendency measure. Note: The Median of Means provides a robust measure of central tendency, especially in situations where the dataset may have outliers or exhibit non-normal distribution characteristics. By calculating means within smaller subgroups, the method is less sensitive to extreme values that might unduly influence the overall average. This can make the Median of Means more robust than a simple mean or median when dealing with datasets that have heterogeneity or skewed distributions. Interquartile Range (IQR):
The script calculates the IQR for each block of 21 bars. The IQR is a measure of statistical dispersion, representing the range between the first quartile (Q1) and the third quartile (Q3) of the data. Q1 and Q3 are calculated from the sorted array of closing prices of the 21 bars. Non-Parametric Cohen's D Calculation:
Cohen's D is a measure of effect size, indicating the standardized difference between two means. In this script, a non-parametric version of Cohen's D is calculated, comparing the MoM values of the current block with the MoM values of the previous block. The calculation involves the MoM difference divided by the square root of the average squared IQR values. Practical Significance Threshold:
The user can set a threshold for practical significance using the Threshold input. The script determines practical significance by comparing the calculated Cohen's D with this threshold. Plotting:
The script plots the MoM values using both straight lines and circles, with the color of the circles indicating the direction of the MoM change (green for upward, red for downward, and blue for no change). Triangular shapes are plotted when the absolute value of Cohen's D is less than the practical significance threshold. Overall Purpose for Trading:
The indicator is designed to help traders identify potential turning points or shifts in market sentiment. and use it as levels which needs to be crossed to have a new trend. Changes in MoM, especially when accompanied by practical significance as determined by Cohen's D, may signal the start of a new trend or a significant move in the market. Traders using this indicator would typically look for instances where the MoM values and associated practical significance suggest a high probability of a trend change, providing them with potential entry or exit signals. It's important for users to backtest and validate the indicator's effectiveness in different market conditions before relying on it for trading decisions.