OPEN-SOURCE SCRIPT

[SHORT ONLY] Internal Bar Strength (IBS) Mean Reversion Strategy

221
█ STRATEGY DESCRIPTION
The "Internal Bar Strength (IBS) Strategy" is a mean-reversion strategy designed to identify trading opportunities based on the closing price's position within the daily price range. It enters a short position when the IBS indicates overbought conditions and exits when the IBS reaches oversold levels. This strategy is Short-Only and was designed to be used on the Daily timeframe for Stocks and ETFs.

█ WHAT IS INTERNAL BAR STRENGTH (IBS)?
Internal Bar Strength (IBS) measures where the closing price falls within the high-low range of a bar. It is calculated as:

- Low IBS (≤ 0.2): Indicates the close is near the bar's low, suggesting oversold conditions.
- High IBS (≥ 0.8): Indicates the close is near the bar's high, suggesting overbought conditions.


█ SIGNAL GENERATION
1. SHORT ENTRY
A Short Signal is triggered when:
  • The IBS value rises to or above the Upper Threshold (default: 0.9).
  • The Closing price is greater than the previous bars High (close>high[1]).
  • The signal occurs within the specified time window (between `Start Time` and `End Time`).


2. EXIT CONDITION
  • An exit Signal is generated when the IBS value drops to or below the Lower Threshold (default: 0.3). This prompts the strategy to exit the position.


█ ADDITIONAL SETTINGS
  • Upper Threshold: The IBS level at which the strategy enters trades. Default is 0.9.
  • Lower Threshold: The IBS level at which the strategy exits short positions. Default is 0.3.
  • Start Time and End Time: The time window during which the strategy is allowed to execute trades.


█ PERFORMANCE OVERVIEW
  • This strategy is designed for Stocks and ETFs markets and performs best when prices frequently revert to the mean.
  • The strategy can be optimized further using additional conditions such as using volume or volatility filters.
  • It is sensitive to extreme IBS values, which help identify potential reversals.
  • Backtesting results should be analyzed to optimize the Upper/Lower Thresholds for specific instruments and market conditions.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.