OPEN-SOURCE SCRIPT

Kalshi BTC 15m Prob Cone v0.7.5

3 148
Kalshi BTC 15m Probability Cone - Historical SMA
Overview
Kalshi BTC 15m Probability Cone - Historical SMA is a TradingView indicator designed for the Kalshi BTC 15-minute Up/Down market workflow.
It compares the current 60-period SMA to a fixed interval target, then scans historical SMA behavior over matching time windows. The result is a probability table and a forward probability cone showing how similar historical windows behaved into settlement.
The indicator is built for short-interval decision support. It does not predict the future, connect directly to Kalshi, or guarantee profitable trades. It uses the TradingView chart feed as its analysis source.
What It Does
At each 15-minute interval, the script:
1. Captures the previous 60-period SMA as the interval target.
2. Tracks the current 60-period SMA against that fixed target.
3. Calculates the time remaining in the active interval.
4. Scans historical SMA windows with the same remaining-time length.
5. Weights historical samples by recency, volume similarity, and optional settlement-phase similarity.
6. Estimates the probability of finishing above or below the target.
7. Draws a probability cone from the current SMA into the rest of the interval.
8. Displays feed, sample, and confidence diagnostics in a table.
The main question it answers is:
Based on similar historical SMA movement, how often did the SMA finish above or below the active 15-minute target?
Main Features
Historical Probability Table
The table gives a compact readout of the current interval.
It includes:
· Status – Whether enough historical data is available.
· Confidence – Quality level based on effective sample size.
· Feed – Whether recent chart bars appear regular or gapped.
· Time Window – Time remaining in the current 15-minute interval.
· Current Dist – Current SMA distance from the interval target.
· Prob Above – Weighted historical probability of finishing above the target.
· Prob Below – Weighted historical probability of finishing below the target.
· Max Up – Largest historical upward move in the analyzed windows.
· Max Down – Largest historical downward move in the analyzed windows.
· Recency λ – Current recency weighting setting.
· Volume σ – Current volume similarity setting.
· Raw Windows – Number of historical windows scanned.
· Eff. Samples – Effective sample size after weighting.
· Data Hours – Approximate stored historical data.
Probability Cone
The probability cone projects historical percentile ranges forward from the current SMA.
It includes:
· p10
· p25
· p50 median
· p75
· p90
· Max Up rail
· Max Down rail
The percentile bands use weighted linear interpolation. This makes the cone smoother, especially when the effective sample size is low.
The Max Up and Max Down rails are not percentiles. They are exact historical extremes from the analyzed sample set.
15-Minute Interval Target
At the start of each 15-minute interval, the script captures the previous 60-period SMA.
That value becomes the interval target. The target is drawn as a purple horizontal line and remains fixed until the next interval begins.
Interval Boundary Lines
Purple vertical lines mark each 15-minute boundary.
These make it easier to see where each Kalshi-style interval begins and ends.
Feed Integrity Check
The Feed row checks whether the chart feed spacing matches the active chart timeframe.
Examples:
· A 1-second chart expects about 1,000 ms between bars.
· A 5-second chart expects about 5,000 ms between bars.
The tolerance is 25% of the expected bar gap.
This allows the indicator to degrade cleanly on other timeframes instead of assuming every chart is always 1 second.
Inputs
Display Options
Show Historical Probability Table

Turns the probability table on or off.
Show Probability Cone

Turns the forward cone on or off.
Table Position

Moves the table to one of the chart corners.
Calculation Settings
Minimum Sample Size

Sets the minimum effective sample size required before the model is considered ready.
Update Frequency

Controls how often the main probability scan updates.
Store Data Every N Seconds

Controls how often SMA and volume samples are stored.
Max History Samples

Limits stored history.
Max Analysis Iterations

Limits how many historical windows are scanned during the main probability calculation.
Weighting Parameters
Recency Decay (Lambda)

Controls how much recent data matters.
· 0.0 means no recency bias.
· Small values apply mild recency bias.
· Larger values make recent data dominate faster.
Volume Similarity (Sigma %)

Controls how strongly the model prefers historical windows with volume similar to the current bar.
· Higher values are more neutral.
· Lower values are stricter.
· Very low values can sharply reduce effective sample size.
Settlement Phase Weighting
Settlement Phase Weighting Mode

Controls whether historical samples from a similar point inside the 15-minute interval get extra weight.
Available modes:
· Off
· Weighted
Settlement Phase Sigma

Controls how strict the settlement-phase matching is.
Lower values are stricter. Higher values are more forgiving.
Cone Settings
Cone Max Iterations

Controls how many historical windows are used for cone calculations.
Lower values improve performance. Higher values may improve stability, but they can increase chart load.
How to Read the Chart
Gray SMA Line
The gray line is the 60-period SMA.
This is the main value being compared against the interval target.
Purple Horizontal Line
The purple horizontal line is the active 15-minute target.
If the SMA is above this line, the interval is currently above target. If it is below this line, the interval is currently below target.
Purple Vertical Lines
The vertical lines mark 15-minute interval boundaries.
Probability Cone
The cone starts at the current SMA and extends toward the end of the interval.
A cone drifting upward means the weighted historical median is moving higher over the remaining window.
A cone drifting downward means the weighted historical median is moving lower over the remaining window.
A wide cone means historical outcomes were more spread out. A narrow cone means historical outcomes were more clustered.
Max Up and Max Down Rails
The dashed rails show the largest upside and downside moves found in the analyzed historical windows.
They are useful for context, but they are not hard limits. Market movement can exceed prior extremes.
How to Read the Table
Status
· Ready means the model has enough effective samples.
· Collecting data... means the model has not reached the minimum effective sample size.
Confidence
Confidence is based on effective sample size:
· Low – fewer than 100 effective samples
· Medium – 100 to 499 effective samples
· Good – 500 to 999 effective samples
· High – 1,000 or more effective samples
Feed
Feed status helps identify chart data problems:
· OK – Bar spacing looks normal.
· Recent Gaps – Recent irregular bars were detected.
· Gap – The current bar spacing is irregular.
· Initializing – Not enough bar history yet.
Prob Above / Prob Below
These are the main probability outputs.
They show the weighted historical percentage of comparable windows that finished above or below the active target.
Example:
Prob Above = 62%
This means 62% of the weighted historical windows finished above the target condition.
Current Dist
This shows the current percentage distance between the SMA and the active target.
Positive values mean the SMA is above target. Negative values mean the SMA is below target.
Raw Windows vs. Effective Samples
Raw Windows is the number of historical windows scanned.
Effective Samples is the usable sample size after weighting.
A high Raw Windows count with a low Effective Samples count means the weighting settings are aggressive.
Suggested Workflow for Kalshi BTC 15m Markets
1. Start with a Clean Baseline
Use neutral settings first:
· Recency λ: 0.0
· Volume σ: 100% or higher
· Settlement Phase Weighting: Off
This gives the clearest view of the raw historical distribution.
2. Check the Feed Row
Do not trust the table if the feed is showing active gaps.
Short-interval markets are sensitive to missing bars. Bad input data produces bad probability output. Shocking, yes, but machines still cannot turn garbage into edge. 🧯
3. Check Effective Sample Size
Prefer readings with a reasonable effective sample size.
A strong probability with weak sample quality is fragile. It may still be useful, but it should be treated cautiously.
4. Compare Table Bias to Cone Shape
The best readings are cleaner when the table and cone agree.
For example:
· Prob Above is clearly higher than Prob Below.
· The cone median slopes upward.
· The current SMA is not already stretched near the Max Up rail.
· Feed status is OK.
· Effective sample size is acceptable.
5. Avoid Treating Small Edges as Certainty
A 52% to 55% reading is not a magic button.
For a binary-style market, fees, spread, fill quality, and timing can easily erase a small statistical lean.
6. Use the Rails for Context
Max Up and Max Down show what happened in the most extreme historical windows.
They can help you avoid chasing when the current move is already stretched.
They should not be used as guaranteed ceilings or floors.
Practical Interpretation
The indicator is strongest as a context tool.
Useful situations include:
· Estimating whether the current interval is statistically tilted.
· Comparing the table probability against the cone median.
· Checking whether current movement is stretched versus historical windows.
· Identifying when weighting settings are too aggressive.
· Spotting feed problems before trusting a short-interval readout.
Weak situations include:
· Low effective sample size.
· Recent feed gaps.
· Sudden volatility regime changes.
· Major news or exchange disruptions.
· Thin or abnormal volume.
· Overly strict recency, volume, or phase weighting.
Recommended Chart Setup
For the intended workflow, use:
· BTC chart source that closely matches the market you are analyzing.
· 1-second chart when available.
· Enough loaded history to build a useful sample.
· Stable chart feed conditions.
· Conservative weighting settings at first.
· A separate check against Kalshi’s actual market and settlement rules.
The indicator uses TradingView chart data. It does not pull official Kalshi settlement values.
Limitations
This script is based entirely on historical SMA behavior.
It does not know:
· Future news
· Order-book changes
· Kalshi liquidity shifts
· Bid/ask spread behavior
· Fill quality
· Sudden volatility changes
· Exchange outages
· Macro events
· Official settlement-feed discrepancies
Important limits:
· Historical probability is not a forecast.
· The cone is not a predicted path.
· Max Up and Max Down are not hard boundaries.
· Low effective sample size can make results unstable.
· Aggressive weighting can create false confidence.
· Poor chart data can distort the output.
· A binary market can still be mispriced, illiquid, or difficult to enter and exit cleanly.
Use the indicator as decision support, not as an automated trading system.
Version Notes
v0.7.5
· Renamed the indicator for the Kalshi BTC 15-minute market workflow.
· Recommended title: Kalshi BTC 15m Probability Cone - Historical SMA.
· Recommended short title: Kalshi BTC 15m Prob Cone.
· Clarified that the indicator uses TradingView chart data and is not an official Kalshi settlement feed.
v0.7.4
· Feed integrity now derives expected bar spacing from the chart timeframe.
· Gap tolerance is now proportional at 25% of expected bar spacing.
· Non-time-based charts fall back to a 1-second expectation.
· Cone percentile bands now use linear interpolation between weighted ranks.
· Probability table calculations are unchanged by the cone interpolation update.
· Max Up and Max Down rails remain exact historical extremes.
v0.7.3
· Settlement countdown was aligned to the same epoch-based interval clock used by interval boundaries.
· Removed the older minute/second countdown dependency.
· Improved consistency between interval boundary detection and remaining-time calculations.
v0.7.2
· Replaced loose cache variables with typed cache structures.
· Reduced cache-management complexity.
· Preserved existing output behavior.
v0.7.1
· Unified the scan and weighting path.
· Shared one precomputed weight array between scan and cone calculations.
· Reduced duplicated weighting work.
v0.7.0
· Merged max-positive and max-negative extreme tracking into the main historical scan.
· Added cone rails for maximum historical upside and downside.
· Improved cone performance with a separate cone iteration cap.
Disclaimer
This script is for research, visualization, and educational use.
It does not provide financial advice. It does not guarantee profitable trades. It does not connect directly to Kalshi or certify settlement outcomes.
Historical probability can describe what happened before. It cannot guarantee what happens next.
Use proper risk controls.

Wyłączenie odpowiedzialności

Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.