OPEN-SOURCE SCRIPT

Gap Forecast Signals with Success Ratio(Mastersinnifty)

56
Description
This indicator forecasts potential market direction based on price gaps at market open. It identifies gap-ups and gap-downs, color-codes background conditions, and displays forecast labels for the next session. Additionally, it evaluates the historical accuracy of its forecasts using a rolling success ratio.

How It Works
  • Compares the current open price to the previous close to calculate a percentage gap.
  • Classifies the gap as bullish, bearish, or neutral based on a user-defined threshold.
  • At the end of each day, the forecast is compared to the actual price movement to assess success.
  • Displays key statistics: success ratio, sample size, and correct/total count.
  • Visual cues include background colors, forecast labels, and optional table display.
  • Alerts can be triggered on bullish or bearish gap detection.


Inputs
  • Gap Threshold (%): Minimum gap size (in percent) to classify as significant.
  • Show Forecast Labels: Enables labels at end-of-day forecasting.
  • Show Background Color: Enables colored backgrounds based on forecast type.
  • Success Ratio Lookback Period: Defines how many previous days are used to calculate forecast accuracy.


Use Case
  • Traders seeking to understand the directional impact of opening price gaps.
  • Useful in gap trading strategies to confirm bullish or bearish biases.
  • Applies to intraday or daily charts where overnight gaps occur.
  • Traders wanting to evaluate the historical performance of gap-based predictions.


Disclaimer
This script is for educational and informational purposes only. It does not constitute financial advice. Use it with proper risk management and discretion. Past performance does not guarantee future results.

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.