OPEN-SOURCE SCRIPT

Average High-Low Range + IBS Reversal Strategy

█ STRATEGY DESCRIPTION
The "Average High-Low Range + IBS Reversal Strategy" is a mean-reversion strategy designed to identify potential buying opportunities when the price deviates significantly from its average high-low range and the Internal Bar Strength (IBS) indicates oversold conditions. It enters a long position when specific conditions are met and exits when the price shows strength by exceeding the previous bar's high. This strategy is suitable for use on various timeframes.

█ WHAT IS THE AVERAGE HIGH-LOW RANGE?
The Average High-Low Range is calculated as the Simple Moving Average (SMA) of the difference between the high and low prices over a specified period. It helps identify periods of increased volatility and potential reversal points.

█ WHAT IS INTERNAL BAR STRENGTH (IBS)?
Internal Bar Strength (IBS) is a measure of where the closing price is relative to the high and low of the bar. It is calculated as:

A low IBS value (e.g., below 0.2) indicates that the close is near the low of the bar, suggesting oversold conditions.

█ SIGNAL GENERATION
1. LONG ENTRY
A Buy Signal is triggered when:
  • The close price has been below the buy threshold (calculated as `upper - (2.5 * hl_avg)`) for a specified number of consecutive bars (`bars_below_threshold`).
  • The IBS value is below the specified buy threshold (`ibs_buy_treshold`).
  • The signal occurs within the specified time window (between `Start Time` and `End Time`).


2. EXIT CONDITION
  • A Sell Signal is generated when the current closing price exceeds the high of the previous bar (`close > high[1]`). This indicates that the price has shown strength, potentially confirming the reversal and prompting the strategy to exit the position.


█ ADDITIONAL SETTINGS
  • Length: The lookback period for calculating the average high-low range. Default is 20.
  • Bars Below Threshold: The number of consecutive bars the price must remain below the buy threshold to trigger a Buy Signal. Default is 2.
  • IBS Buy Threshold: The IBS value below which a Buy Signal is triggered. Default is 0.2.
  • Start Time and End Time: The time window during which the strategy is allowed to execute trades.


█ PERFORMANCE OVERVIEW
  • This strategy is designed for mean-reverting markets and performs best when the price frequently deviates from its average high-low range.
  • It is sensitive to oversold conditions, as indicated by the IBS, which helps to identify potential reversals.
  • Backtesting results should be analyzed to optimize the Length, Bars Below Threshold, and IBS Buy Threshold parameters for specific instruments.
Breadth IndicatorsbuythedipChart patternsCyclesdaytradingIndicesmeanreversionQQQreversalSPDR S&P 500 ETF (SPY) Stocksswingtrading

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?

Pernyataan Penyangkalan