OPEN-SOURCE SCRIPT

End-of-Session Probability

This indicator estimates the probability that the market will finish the session above a specified target price. It blends a statistical probability model with directional bias and optional morning momentum weighting to help traders gauge end-of-day market expectations.

Key Features:
• Statistical Probability Model:
Uses a normal distribution (with a custom normal CDF approximation) scaled by the square-root-of-time rule. The indicator dynamically adjusts the standard deviation for the remaining session time to compute a z‑score and ultimately the probability that the session close exceeds the target.
• Directional Bias via Daily HullMA (Exponential):
A daily Hull Moving Average (calculated using an exponential method) is used as a big-picture trend indicator. The model allows you to select your bias method—either by comparing the current price to the daily HullMA (Price method) or by using the HullMA’s slope (Slope method). A drift multiplier scales this bias, which then shifts the mean used in the probability calculations.
• Optional Morning Momentum Weight:
For traders who believe that early session moves provide useful clues about the day’s momentum, you can enable an optional weighting. The indicator captures the percentage change from the morning open (within a user-defined time window) and adjusts the expected move accordingly. A multiplier lets you control the strength of this adjustment.
• Visual Outputs:
The indicator plots quantile lines (approximately the 25%, 50%, and 75% levels) for the expected price distribution at session end. An abbreviated on-chart label displays key information:
• Target: The target price (current price plus a user-defined offset)
• Prob Above: The probability (in percentage) that the session close will exceed the target price
• Time: The time remaining in the session (in minutes)

How to Use:
1. Set Your Parameters:
• Expected Session Move: Input your estimated standard deviation for the full-session move in price units.
• Daily Hull MA Settings: Adjust the period for the daily HullMA and choose the bias method (Price or Slope). Modify the drift multiplier to tune the strength of the directional bias.
• Target Offset: Specify an offset from the current price to set your target level.
• Morning Momentum (Optional): Enable the morning momentum weight if you want the indicator to adjust the expected move based on early session price changes. Define the morning session window and set the momentum multiplier.
2. Interpret the Output:
• Quantile Lines: These represent the range of possible end-of-session prices based on your model.
• Abbreviated Label: Provides a quick snapshot of the target price, probability of finishing above that target, and time remaining in the session.
3. Trading Application:

Use the probability output as a guide to assess if the market is likely to continue in the current direction or reverse by session close. The indicator can help you decide on trade entries, exits, or adjustments based on your overall strategy and risk management approach.

This tool is designed to offer a dynamic, statistically driven snapshot of the market’s expected end-of-day behavior, combining both longer-term trend bias and short-term momentum cues.

כתב ויתור