This indicator is a tool that uses market data to plot bands along with a price chart.
This tool uses interquartile range (IQR) instead of Standard Deviation (STD) because market returns are not normally distributed. There is also no way to tell if the pocket of the market you are looking at is normally distributed. So using methods that work better with non-normal data minimizes risk more than using a different process.
Percentile Calculation (percentile function): Calculates the percentile value of an array (arr) at a given percentile (p). Uses linear interpolation to find the exact percentile value in a sorted array.
Manual IQR Calculation (manual_iqr function): Converts the input data into an array (data_arr) and sorts it. Computes the lower and upper quartiles (Q1 and Q3) using the specified percentiles (lower_percentile and upper_percentile). Computes the Interquartile Range (IQR) as IQR = Q3 - Q1. Returns the computed IQR.
IQRB Function Calculation (IQRB function): Converts the sensitivity percentage (sens) into decimal values (sens_l for lower percentile and sens_h for upper percentile). Calls manual_iqr with the closing prices (close) and the lower and upper percentiles. Calculates the Simple Moving Average (SMA) of the closing prices (close) over a specified period (lkb_). Computes the upper and lower bands of the IQR using the SMA and the calculated IQR (val). Returns an array [upper, lower, sma] containing the upper band, lower band, and SMA values.
After the IQR is calculated at the specified sensitivity it is added to and subtracted from a SMA of the specified period.
This provides us with bands of the IQR sensitivity we want.
Step 2: Price drops below the top band and chops slightly, without a large reversal from that break.
Step 3: Price breaks below the bottom band.
Step 4: Price re-enters the bottom band and just chops, no large reversal.
Step 5: Price breaks below the bottom band.
Step 6: Price retakes the bottom band and strongly reverses.
This tool can be uses to spot reversals and see when trends may continue as the stay inside the bands. No indicator is 100% accurate, we encourage traders to not follow them blindly and use them as tools.