Strategy Forecast EngineThe Strategy Forecast Engine is a regime-based Monte Carlo forecasting tool that estimates the future return distribution of trend-following strategies across different market environments. The model identifies the current market regime, conditions forecasts on historical returns observed during comparable regimes, and generates thousands of potential future price paths using Monte Carlo simulation. The resulting return distribution is presented through percentile projections and a structured, color-coded table that provides a comprehensive assessment of the forecast.
First, the model identifies the current market regime using the selected trend-following strategy. Users can choose between a moving-average crossover strategy, a volatility-based trailing stop strategy, or a combined strategy that incorporates both approaches. Supported moving-average types include the Exponential Moving Average (EMA), Simple Moving Average (SMA), Wilder’s Moving Average (RMA), and Weighted Moving Average (WMA). Supported volatility types include the Average True Range (ATR), Standard Deviation (SD), and Mean Absolute Deviation (MAD). By default, the model applies an asymmetric design in which conflicting signals default to bullish unless neutral regimes are enabled in the menu. Market regimes are determined as follows:
Bullish Trend Regime = (Fast MA – Slow MA) > (ATR × Trend Margin)
Bearish Trend Regime = (Fast MA – Slow MA) < –(ATR × Trend Margin)
Bullish Volatility Regime = Price > (Highest Price – (Volatility × Stop Factor))
Bearish Volatility Regime = Price < (Lowest Price + (Volatility × Stop Factor))
Bullish Combined Regime = Bullish Trend Regime and Bullish Volatility Regime
Bearish Combined Regime = Bearish Trend Regime and Bearish Volatility Regime
Once the current regime has been identified, the model collects all historical logarithmic returns that occurred during the same regime beginning from the selected start date. Only returns from the matching regime are used to generate the forecast, allowing projections to be conditioned on historically comparable market environments rather than treating all historical observations as equally relevant. If duration-adjusted forecast is enabled in the menu, the model further restricts the sample pool to returns from regimes that were at least as mature as the current regime.
The Monte Carlo simulation engine then generates thousands of possible future price paths over the selected forecast horizon. Each simulation randomly samples historical returns from the sample pool associated with the current regime and compounds them forward to generate a potential future price path. This process is repeated for the specified number of simulations to produce a broad range of possible future outcomes. The random seed controls reproducibility, ensuring that identical settings produce identical forecasts. Once all individual simulations have been completed, the resulting return distribution is summarized using percentile projections:
95% = 5% of simulations ended above this level and 95% ended below it.
75% = 25% of simulations ended above this level and 75% ended below it.
Median = 50% of simulations ended above this level and 50% ended below it.
25% = 25% of simulations ended below this level and 75% ended above it.
5% = 5% of simulations ended below this level and 95% ended above it.
The upper quartile (75%) and lower quartile (25%) define the Interquartile Range (IQR), which contains the middle 50% of all simulated outcomes and represents the central range of the projected outcome distribution. The upper and lower tail percentiles can be set to 10% (90% / 10%), 5% (95% / 5%), or 1% (99% / 1%). The default setting is 5%, which captures the middle 90% of simulated outcomes. At 10%, the range captures 80% of simulated outcomes, while at 1%, the range captures 98% of simulated outcomes. To further evaluate the risk/reward characteristics of the forecast, the model includes a built-in table with the following metrics:
Regime = Current market regime based on the selected strategy configuration.
Duration = Percentile rank of current regime duration relative to past regimes.
Forecast = Percentile rank of current duration including the forecast horizon.
Win Rate = Percentage of profitable simulations relative to total simulations.
Profit Factor = Ratio of total simulated profits to total simulated losses.
Expectancy = Average expected percentage return across all simulations.
Reward/Risk = Ratio of upper quartile return to lower quartile return.
Asymmetry = Ratio of selected upper tail return to selected lower tail return.
Skewness = Ratio of upside potential to downside risk relative to the median.
Sample Size = Number of historical returns available for the current regime.
Frequency = Percentage of historical returns belonging to the current regime.
In summary, the Strategy Forecast Engine is a comprehensive forecasting tool designed to help investors evaluate the return distribution of trend-following strategies based on the current market regime. By combining regime detection with Monte Carlo simulation, the model conditions forecasts on historical returns observed during comparable market regimes to estimate the distribution of potential outcomes and their associated risk/reward characteristics. While the model provides valuable insight into historical return patterns, investors should remain mindful that historical market behavior may not necessarily persist under future market conditions. Indicator

Daily High/Low probability zonesDaily High/Low probability zones
Overview
Daily Segment Probabilities analyses the statistical distribution of where a market forms its daily High and daily Low relative to the previous session's range. By studying the prior day's High (PDH) and Low (PDL) across a user-defined lookback window, the indicator divides the price space around that range into 12 equal segments of 25% each — from −100% to +200% — and calculates how frequently the current session's High and Low have historically landed inside each segment. The result is a probability map drawn directly on the chart for today's session, letting you see at a glance which zones have historically attracted the day's extremes.
What is shown on the chart
The PDH and PDL of the prior session are drawn as solid horizontal lines across the current day, labelled in the margin. These form the 0% and 100% anchor points of the range.
Twelve segment boundaries are then projected from PDL upward and downward using the prior day's range as the measuring unit. Each boundary is coloured by zone: teal for the inside range (0–100%), indigo for upside extensions (above 100%), and red for downside extensions (below 0%). The 0% and 100% lines themselves are omitted from the segment boundaries since the PDH/PDL lines already mark them.
At the midpoint of each band, a label shows the segment name alongside the historical probability of the day's High and Low forming within that band — for example 0–25% H:18% L:34%. A tooltip on each label gives the full count of occurrences out of total sample days.
The two highest-probability bands are highlighted with a filled overlay: a gold fill marks the segment where the day's High has most frequently formed, and an orange fill marks the segment where the day's Low has most frequently formed. These fills are also reflected in the probability table — the High% and Low% cells for the top segments are coloured to match, creating a direct visual link between the chart and the table. Labels for the top bands carry a ★H or ★L marker for quick identification.
The probability table
The table summarises the full segment distribution in a compact grid with four columns:
Seg — segment number (1–12, top to bottom of chart)
Range — the percentage band that segment covers
High% — percentage of historical days where the session High formed in this segment
Low% — percentage of historical days where the session Low formed in this segment
Below the twelve data rows is an OOB (out-of-bounds) row counting days where the High or Low fell completely outside the −100% to +200% window. The footer row shows the actual sample size (n) and the configured lookback.
The High% and Low% cells for the two top-probability segments are highlighted with the same fill colours used on the chart, so the table and the chart read as a unified system.
How the lookback and calculation work
The lookback setting (default 250 days, range 10–500) defines how many prior daily sessions are included in the historical sample.
For each day in that window the indicator:
Takes the prior session's High and Low to establish the reference range and its 0% / 100% anchors.
Measures where that session's own High and Low fell, expressed as a percentage of the prior range above the prior Low — so a High exactly at the PDH of its own prior session registers as 100%, and a Low exactly at the PDL registers as 0%.
Assigns each reading to whichever 25%-wide segment it falls into.
Counts occurrences per segment across all n valid days (days where the prior range is greater than zero are included; zero-range days are skipped).
Probabilities in the table and labels are the count for each segment divided by n, rounded to the nearest whole percent. The top-segment fills and ★ markers are determined purely by the highest raw count, not the rounded percentage, so ties resolve correctly.
A minimum of 5 valid days is required before anything is drawn.
Settings
Core Settings
Lookback (days) — number of prior sessions used to build the probability distribution. Higher values give a more statistically stable sample; lower values are more responsive to recent market character. 250 days (roughly one trading year) is a reasonable default for most instruments.
Visual Settings
PDH/PDL line colour — colour of the prior day High and Low anchor lines.
Inside range colour (0–100%) — colour applied to segment boundaries within the prior range.
Extension above colour (>100%) — colour for boundaries above the PDH.
Extension below colour (<0%) — colour for boundaries below the PDL.
Label text colour — colour of the midpoint probability labels.
Segment line style — Solid, Dotted, or Dashed for segment boundaries.
PDH/PDL line style — Solid, Dotted, or Dashed for the anchor lines.
Top High% band fill colour — fill colour for the highest-probability High segment (default gold).
Top Low% band fill colour — fill colour for the highest-probability Low segment (default orange).
Table Settings
Show probability table — toggle the table on or off.
Table position — Top Right, Bottom Right, Middle Right, Bottom Center, or Middle Left.
Table text size — Auto, Tiny, Small, Normal, Large, or Huge.
Interpreting the output
The indicator does not predict where price will go — it describes where it has historically gone. A segment showing H:35% means the day's High landed in that band on roughly one in three days over the lookback period. Used alongside other context (session opens, market structure, news), the distribution can inform expectations for the day's likely trading range and where extension targets have historically clustered.
Segments inside the prior range (0–100%) capturing a high proportion of Low readings suggest mean-reversion sessions are common for the instrument. Large probabilities in extension segments (above 100% or below 0%) reflect trending or breakout tendencies. The OOB row is worth watching on highly volatile instruments where extreme moves regularly exceed the prior range by a wide margin.
Notes
The indicator is drawn only on the last bar of the chart to avoid repainting and to keep line/label counts within TradingView's limits.
It is designed for use on intraday timeframes (1m–1h) where the daily session boundaries are visible. On a daily chart it will still compile but the lines will span only the current day's single candle.
The prior session data is fetched via request.security on the daily timeframe with lookahead_off to prevent look-ahead bias.
All percentages shown are based on historical frequency only and carry no implied forward guarantee. Indicator

Mean Reversion Probability Zones [BigBeluga]🔵 OVERVIEW
The Mean Reversion Probability Zones indicator measures the likelihood of price reverting back toward its mean . By analyzing oscillator dynamics (RSI, MFI, or Stochastic), it calculates probability zones both above and below the oscillator. These zones are visualized as histograms, colored regions on the main chart, and a compact dashboard, helping traders spot when the market is statistically stretched and more likely to revert.
🔵 CONCEPTS
Mean Reversion : The tendency of price to return to its average after significant extensions.
Oscillator-Based Analysis : Uses RSI, MFI, or Stochastic as the base signal for detecting overextension.
Probability Model : The probability of reversion is computed using three factors:
Whether the oscillator is rising or declining.
Whether the oscillator is above or below user-defined thresholds.
The oscillator’s actual value (distance from equilibrium).
Dual-Zone Output :
Upper histogram = probability of downward mean reversion.
Lower histogram = probability of upward mean reversion.
Historical Extremes : The dashboard highlights the recent maximum probability values for both upward and downward scenarios.
🔵 FEATURES
Oscillator Choice : Switch between RSI, MFI, and Stochastic.
Customizable Zones : User-defined upper/lower thresholds with independent colors.
Probability Histograms :
Above oscillator → down reversion probability.
Below oscillator → up reversion probability.
Colored Gradient Zones on Chart : Visual overlays showing where mean reversion probabilities are strongest.
Probability Labels : Percentages displayed next to histogram values for clarity.
Dashboard : Compact table in the corner showing the recent maximum probabilities for both upward and downward mean reversion.
Overlay Compatibility : Works in both chart pane and sub-pane with oscillators.
🔵 HOW TO USE
Set Oscillator : Choose RSI, MFI, or Stochastic depending on your strategy style.
Adjust Zones : Define upper/lower bounds for when oscillator values indicate strong overbought/oversold conditions.
Interpret Histograms :
Orange (upper) histogram → higher chance of a pullback/downward mean reversion.
Green (lower) histogram → higher chance of upward reversion/bounce.
Watch Gradient Zones : On the main chart, shaded areas highlight where probability of mean reversion is elevated.
Consult Dashboard : Use the “Recent MAX” values to understand how strong recent reversion probabilities have been in either direction.
Confluence Strategy : Combine with support/resistance, order flow, or trend filters to avoid counter-trend trades.
🔵 CONCLUSION
The Mean Reversion Probability Zones provides traders with an advanced way to quantify and visualize mean reversion opportunities. By blending oscillator momentum, threshold logic, and probability calculations, it highlights when markets are statistically stretched and primed for reversal. Whether you are a contrarian trader or simply looking for exhaustion signals to fade, this tool helps bring structure and clarity to mean reversion setups. Indicator

cd_cisd_market_CxHi Traders,
Overview:
Many traders follow market structure to identify the market direction and seek trade opportunities in line with the trend.
However, markings derived from user-defined inputs can create different structures, depending on personal choices. For instance, choosing a pivot distance of 3 instead of 2 alters the structure, even though the chart remains the same. Ideally, the structure should remain consistent.
"Change in State Delivery" ( CISD ) is a widely accepted concept among traders and is considered a significant indicator of market direction based on the gain/loss of CISD levels.
In this indicator, CISD is selected as the primary criterion for marking market structure, eliminating the influence of user-dependent variations.
Here is a summary of the key logic and rules applied:
• When the price forms a new high/low, that level is only considered a pivot if a CISD has occurred.
• A bullish CISD is always followed by a bearish CISD, and vice versa.
• Pivot points form the internal structure.
• The internal structure is used to interpret the swing structure.
• Probabilities are derived from internal structure patterns.
________________________________________
Details:
How is CISD determined?
As is commonly known:
• When price makes a new high, the opening level of the first candle in the consecutive bullish candle sequence is marked.
• When price makes a new low, the opening of the first candle in the consecutive bearish sequence is marked.
• If there’s only one candle in the sequence, its opening level is used.
In a bullish market, losing a bearish CISD level (i.e., a close below it) or in a bearish market, gaining a bullish CISD level (i.e., a close above it) is interpreted as a potential shift in buyer-seller dominance and a possible market reversal.
________________________________________
How are internal (pivot) levels determined?
• When price closes below a bearish CISD level, the highest candle's high becomes a pivot high (PH).
• When price closes above a bullish CISD level, the lowest candle's low becomes a pivot low (PL).
• If the new PH is above the previous PH, it’s labeled as HH (Higher High); otherwise, LH (Lower High).
• If the new PL is below the previous PL, it’s labeled as LL (Lower Low); otherwise, HL (Higher Low).
________________________________________
Internal Market Structure:
• A series of HHs indicates a bullish internal structure.
• A series of LLs indicates a bearish internal structure.
________________________________________
Swing (Main) Market Structure:
Using internal pivots and previous swing levels, the main market structure is derived.
• A new swing high (SH) requires the price to move above the previous SH.
• A new swing low (SL) requires the price to move below the previous SL.
________________________________________
Probability Calculation:
Pivot levels forming the internal structure are coded as five-element sequences.
There are 64 possible combinations of such sequences made from consecutive PH and PL values.
Each pattern’s frequency from its starting candle is tracked.
To make it more understandable:
For example, after the four-sequence “HH, LL, LH,HL”, either HH or LH might follow.
The table shows the statistical likelihood of both possible outcomes for the most recent four-element sequence on the chart.
________________________________________
How reliable is it?
To assess reliability, results are calculated from the beginning using:
Success Rate (Suc. Rt) = Number of Correct Predictions / Total Predictions
This value is added to the table for reference.
It’s important to note that no statistical outcome guarantees certainty—every result offers a different interpretation. What truly matters is to avoid getting stopped out 😊.
________________________________________
Menu Options:
Show/hide preferences and color selections can be customized via the indicator menu.
________________________________________
What’s Coming in Future Versions?
Features such as FVG (Fair Value Gaps) between swing levels, volume imbalances, order blocks / mitigation blocks, Fibonacci levels, and relevant trade suggestions will be added.
________________________________________
This is a BETA version that I believe will help simplify your market reading. I’d be happy to hear your feedback and suggestions.
Cheerful Trading!
Indicator

Indicator

Indicator

Indicator

Probability Trend IndicatorUnderstanding the Indicator:
The indicator calculates the probabilities of upward and downward trends based on the percentage change in price over a specified lookback period.
It displays these probabilities in a table and plots a histogram to represent the difference between the probabilities.
The colors of the histogram bars indicate the trend direction and whether the trend is increasing or decreasing.
Setting the Lookback Period:
The indicator allows you to specify the lookback period, which determines the number of bars to consider for calculating the probabilities.
By default, the lookback period is set to 50 bars. However, you can adjust it based on your trading preferences and the timeframe you're analyzing.
Analyzing the Probabilities:
The indicator calculates the probabilities of upward and downward trends and displays them in a table on the chart.
The probabilities are presented as percentages, representing the likelihood of each type of trend occurring.
You can use these probabilities to gain insights into the potential market direction and assess the strength of the prevailing trend.
Interpreting the Histogram:
The histogram is plotted based on the difference between the probabilities of upward and downward trends, known as the oscillator value.
The histogram bars are colored to provide visual cues about the trend direction and whether the trend is gaining or losing strength.
Green bars indicate upward trends, and red bars indicate downward trends.
Lighter shades of green or red suggest increasing trends, while darker shades suggest decreasing trends.
Making Trading Decisions:
The indicator serves as a tool for assessing the probabilities of trends and can be used alongside other technical analysis methods.
You can consider the probabilities, the histogram pattern, and the overall market context to make informed trading decisions.
It's important to remember that no indicator or tool can guarantee future market movements, so prudent risk management and additional analysis are essential. Indicator

Strategy

Indicator

Indicator

Bayesian BBSMA OscillatorSometime ago (very long ago), one of my tinkering project was to do a spam or ham classification type app to filter news I'd wanna read. So I built myself a Naive Bayes Classifier to feed me my relevant articles. It worked great, I can cut through the noise.
The hassle was I needed to manually train it to understand what I wanna read. I trained it using 50 articles and to my surprise, it's enough.
Complexity Theory
I've been reading a book called The Road to Ruin by Jim Rickards. He described how he got to his conclusion of how the stock market works by using Complexity Theory. Bill Williams would agree. Jim tells us that by using just enough data, we calculate the probability of an event to occur. We can't say for sure when but we know it's coming. This was my light bulb moment.
While Jim talks much about Bayesian Inference in which a probability of an event can always be updated as more evidence comes to light, I had my eyes set on binary probabilities of when prices are going up and down.
Assumptions
These are my assumptions:
Prices breaking up a Bollinger basis line will have fuel to go up even higher
Prices will go down when prices have broken up a Bollinger upper band
Scalping is the main method so we should use a lower period Moving Average (MA)
When prices are above MA, it's likelier a correction to the downside is imminent
When prices are below MA, it's likelier a correction to the upside is imminent
Optimize parameters for 1 hour timeframe which will give us time to react while still having more opportunities to trade
Building Blocks
Jim Rickards started with limited data (events) while in technical trading, data are plentiful. I decided to classify 2 events which are:
Next candles would be breaking up
Next candles would be breaking down
Key facts:
We won't know for sure when prices are going to break
We won't know for sure how much the prices movements are going to be
Formulas
Breaking up:
Pr(Up|Indicator) = Pr(Indicator|Up) * Pr(Up) / Pr(Indicator|Up) * Pr(Up) + Pr(Indicator|Down) * Pr(Down)
Breaking down:
Pr(Down|Indicator) = Pr(Indicator|Down) * Pr(Down) / Pr(Indicator|Down) * Pr(Down) + Pr(Indicator|Up) * Pr(Up)
Reading The Oscillator
Green is the probability of prices breaking up
Red is the probability of prices breaking down
When either green or red is flatlining ceiling, immediately on the next candle when the probability decreases go short or long based on which direction you're observing - Strong Signal
When either green or red is flatlining ceiling, take no action while it's ceiled
Usually when either green or red is flatlining bottom, the next candle when the probability increases, immediately take a short long position based on the direction you're observing - Weak Signal
When either green or red is flatlining bottom, take no action while it's bottomed
Alerts
Use Once per Bar option when generating alerts. Indicator

Indicator
