OPEN-SOURCE SCRIPT

Prometheus IQR bands

PrometheusAnalytics의
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.

Calculation

Code for helper functions:


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.

Trade Examples

https://www.tradingview.com/x/x3wHp9Xm/

Step 1: Price quickly and strongly breaks below the bottom band and continues there for some bars.

Step 2: Price re-enters the bottom band and has a strong reversal.

https://www.tradingview.com/x/leNP3ox3/

Step 1: Price strongly breaks above the top band and continues higher.

Step 2: Price breaks below the top band and reverses to the downside.

Step 3: Price breaks below the bottom band after our previous reversal.

Step 4: Price regains that bottom band and reverses to the upside.

Step 5: Price continues moving higher and does not break above the top band or reverse.

https://www.tradingview.com/x/NmZzAXvv/

Step 1: Price strongly breaks above the top band and continues higher.

Step 2: Price breaks below the top band and reverses to the downside.

Step 3: Price breaks below the bottom band after our previous reversal.

Step 4: Price regains that bottom band and reverses to the upside.

Step 5: Price strongly breaks above the top band after the previous reversal.

Step 6: Price breaks below the top band and reverses down.

Step 7: Price strongly breaks above the top band and continues moving higher.

Step 8: Price breaks below the top band and reverses down.

Step 9: Price strongly breaks above the top band and continues moving higher.

Step 10: Price breaks below the top band and reverses down.

https://www.tradingview.com/x/UIIb1KyL/

Step 1: Price breaks above the top band.

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.
Chart patternsCycles
PrometheusAnalytics

오픈 소스 스크립트

진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

차트에 이 스크립트를 사용하시겠습니까?

면책사항