Thorp Kelly Risk Engine [JOAT]Thorp Kelly Risk Engine
Introduction
Thorp Kelly Risk Engine is a risk-quality study that tracks virtual outcomes, Kelly estimates, Bayesian shrinkage, drawdown pressure, survival score, and deployment state.
This open-source indicator is designed as a context tool, not a standalone trading system. It focuses on explaining the current market state with restrained visuals and confirmed-bar logic where signals are used.
Core Concepts
1. Virtual Outcome Tracker
Trend setups create virtual reward/risk outcomes measured in ATR units.
2. Kelly Estimate
Win rate and payoff ratio produce full and fractional Kelly-style estimates.
3. Bayesian Shrinkage
A prior win rate reduces overconfidence when sample size is small.
4. Survival and Desk Score
Drawdown, volatility, signal density, convexity, and uncertainty combine into risk state.
kelly = (payoff * winRate - lossRate) / payoff
Features
Virtual outcome sampling
Fractional and Bayesian Kelly estimates
Drawdown throttle and volatility brake
Ruin-adjusted Kelly
Prime, defense, and lockdown states
Input Parameters
Trend, RSI, and ATR lengths
Reward and risk ATR
Kelly fraction and max allocation
Minimum sample and drawdown brake
Display toggles and HUD position
How to Use This Script
Use TKR as risk context. Prime states suggest healthier virtual samples; defensive and lockdown states warn that model risk is elevated.
Limitations
The script uses historical OHLCV data and cannot know future prices.
Signals and states can be late during fast reversals because confirmed-bar logic is used to reduce repainting.
Model outputs should be interpreted with market context, risk controls, and independent analysis.
No visual state should be treated as a certain trade outcome.
Originality Statement
TKR is original in combining Kelly math, Bayesian shrinkage, drawdown throttling, survival scoring, and uncertainty cones.
Disclaimer
This indicator is provided for educational and informational purposes only. It is not financial advice, investment advice, or a recommendation to buy or sell any financial instrument. All calculations are derived from historical market data and may produce inaccurate readings in some market conditions. No indicator can predict future market behavior. Use proper risk management and independent judgment.
-Made with passion by jackofalltrades
Indicator

Alien The Bayesian Follower [by Oberlunar] Alien The Bayesian Follower 👁⭐
— Bayesian Gating Filter by Oberlunar
Alien The Bayesian Follower by Oberlunar is a permission layer for execution engines. At its core sits a conjugate Bayesian update that continuously revises the expected edge of each trading cell as live evidence accumulates, and automatically disables cells whose edge has decayed. Empirically, for most of the time, when a long/short gate is active, the price goes in the opposite direction or straight in the trend. Use it at 30 m, with lower TF at 15 m and trade on pullbacks.
The state space is built by crossing three fixed methodologies: a 5-class daily Regime Classifier built on Kaufman Efficiency Ratio, lag-1 autocorrelation of returns, and ATR ratio; a Dragon momentum composite aggregating EMA, RSI, MACD, and TRIX into 5 buckets; and a Pulsar flow composite aggregating OBV, CVD, and price-vs-flow divergences into 5 buckets. The full 5×5 Dragon × Pulsar grid is evaluated only inside the MIXED regime, where four specific bucket combinations carry a statistically significant edge after Bonferroni correction across all 25 cells.
The four surviving cells correspond to two long setups and two short setups. The strongest long edge sits at the intersection of strong bullish momentum and still-neutral flow — the pre-alignment phase where price has turned but order flow hasn't fully confirmed. Full alignment between momentum and flow tends to mark exhaustion. The same asymmetry holds in reverse for the short cells.
Each surviving cell carries a Normal prior representing its expected edge and the uncertainty around it. The Bayesian engine is the heart of the indicator: as the script runs, every walk-forward observation matching a cell updates that cell's prior through a conjugate Normal-Normal step, producing a posterior that shrinks prior and live evidence together via precision weighting. When live samples are few, the posterior stays close to the prior, and the cell relies on its original estimate. When live samples accumulate, the posterior tracks reality and the original prior fades.
Each cell is then assigned a status based on its posterior credible interval. **BORN** means not enough live data yet. **OK** means the credible interval excludes zero with the expected sign and the magnitude remains close to the prior. **DRIFT** means the sign is still correct, but the edge has weakened substantially. **DEAD** means the credible interval includes zero, or the sign has inverted — the cell has lost its edge and is automatically blocked from firing. This is the core defensive feature: strategies decay, and when one of the four cells decays, the Bayesian engine stops trusting it without any manual intervention.
Alerts in strict mode restrict firing to primary cells only (±2).
Permissive mode allows secondary cells (±1) as well.
The dashboard shows the live state of all four cells side by side: prior, posterior with credible interval, sample count, and status. Everything else — the cyberpunk palette, the segmented trend wedges in stay-out zones, the optional alien mascot rotating to follow the local trend — is visual feedback layered on top of the same Bayesian rule.
Enjoy,
By Oberlunar 👁⭐ Indicator

Probabilistic Bias Engine [JOAT]Probabilistic Bias Engine
Introduction
The Probabilistic Bias Engine (PBE) is an advanced open-source directional bias indicator that combines Bayesian probability analysis, historical for-loop pattern recognition, multi-timeframe confluence detection, and ensemble learning to quantify market directional bias with statistical confidence. This indicator transforms raw price action into probabilistic bias scores (0-100%), helping traders identify high-probability directional setups through systematic analysis of historical price behavior across multiple timeframes.
Unlike simple trend indicators that use moving averages or momentum oscillators, PBE employs a sophisticated for-loop analysis system that compares current price against historical price points across customizable lookback periods, applies Bayesian probability theory to calculate directional likelihood, and aggregates signals across multiple timeframes to generate confidence-weighted bias scores. The indicator provides both current timeframe bias and multi-timeframe confluence analysis for comprehensive directional assessment.
Why This Indicator Exists
This indicator addresses the challenge of quantifying directional bias with statistical rigor. Traditional trend indicators provide binary signals (bullish/bearish) without probability quantification. PBE systematically analyzes historical price behavior to reveal:
Bayesian Probability Calculation: Converts for-loop analysis into probabilistic bias scores using Bayesian inference
Historical Pattern Recognition: Analyzes price position relative to 1-70 historical bars to identify directional patterns
Multi-Timeframe Confluence: Confirms bias across short (5m), medium (15m), and long (60m) timeframes
Ensemble For-Loop Analysis: Combines multiple lookback periods (30, 70, 150 bars) for robust bias calculation
Volatility Regime Scaling: Adjusts probability scores based on current volatility environment
Divergence Confirmation Layer: Detects RSI divergences to enhance signal quality
Confidence Heatmap: Visualizes setup quality through multi-factor confidence scoring (0-100%)
Each component provides unique intelligence. For-loop analysis shows historical price position, Bayesian calculation quantifies probability, MTF confluence shows conviction, ensemble analysis adds robustness, volatility scaling adjusts for regime, divergence layer confirms reversals, and confidence scoring synthesizes all factors.
Core Components Explained
1. For-Loop Historical Analysis
PBE's core innovation is systematic comparison of current price against historical price points:
f_forloop_analysis(float src, int start, int lookback) =>
float sum = 0.0
for i = start to lookback
sum += src > src ? 1 : -1
float normalized = sum / (lookback - start + 1)
normalized
This function iterates through historical bars, adding +1 when current price is above historical price and -1 when below. The normalized result ranges from -1.0 (price below all historical points) to +1.0 (price above all historical points).
2. Bayesian Probability Calculation
The for-loop score is converted to probability using Bayesian inference:
f_bayesian_probability(float loop_value) =>
float evidence = loop_value > 0 ? 0.7 : 0.3
float prior = 0.5
float posterior = (prior * evidence) /
(prior * evidence + (1 - prior) * (1 - evidence))
posterior
This calculates the posterior probability of bullish bias given the for-loop evidence. Positive loop values increase bullish probability, negative values increase bearish probability. The result is scaled to 0-100% for display.
image]https://www.pulsewire.com/x/CtYqgABU/
3. Multi-Timeframe Confluence Detection
PBE requests bias data from three timeframes and counts alignment:
f_get_timeframe_bias(string tf) =>
= request.security(syminfo.tickerid, tf,
)
float prob_tf = f_bayesian_probability(loop_score_tf)
int bias_tf = prob_tf > 0.5 ? 1 : -1
Confluence is calculated by counting how many timeframes agree:
Strong Aligned (4/4): All timeframes bullish or bearish - highest conviction
Aligned (3/4): Majority alignment - moderate conviction
Weak (2/4): Split alignment - low conviction
No Alignment (1/4 or 0/4): Conflicting signals - no conviction
4. Ensemble For-Loop Analysis
Multiple lookback periods are combined for robust bias calculation:
f_forloop_ensemble(float src, int start, int end1, int end2, int end3) =>
// Calculate for-loop scores for 30, 70, and 150 bar lookbacks
float norm1 = sum1 / (end1 - start + 1)
float norm2 = sum2 / (end2 - start + 1)
float norm3 = sum3 / (end3 - start + 1)
// Weighted ensemble (shorter periods get more weight)
float ensemble = (norm1 * 0.5) + (norm2 * 0.3) + (norm3 * 0.2)
ensemble
Short-term bias (30 bars) receives 50% weight, medium-term (70 bars) receives 30%, and long-term (150 bars) receives 20%. This creates a balanced view across multiple time horizons.
5. Volatility Regime Scaling
Probability scores are adjusted based on volatility environment:
float atr_val = ta.atr(14)
float natr = (atr_val / close) * 100
float vol_percentile = ta.percentrank(natr, 100)
float regime_multiplier =
vol_percentile >= 80 ? 0.85 : // High vol: reduce confidence
vol_percentile >= 60 ? 0.92 : // Elevated: slight reduction
vol_percentile >= 40 ? 1.0 : // Normal: no adjustment
vol_percentile >= 20 ? 1.05 : // Low vol: slight increase
1.1 // Very low: increase confidence
float regime_adjusted_prob = smoothed_probability * regime_multiplier
High volatility reduces probability scores (more uncertainty), while low volatility increases scores (more predictable).
6. Divergence Confirmation Layer
RSI divergences are detected to enhance signal quality:
float rsi = ta.rsi(close, 14)
// Bullish divergence: price lower low, RSI higher low
bool bull_divergence = low < last_rsi_low_price and rsi > last_rsi_low
// Bearish divergence: price higher high, RSI lower high
bool bear_divergence = high > last_rsi_high_price and rsi < last_rsi_high
Divergences add 20 points to confidence score and trigger enhanced signals when combined with probability alignment.
7. Confidence Heatmap Visualization
Multi-factor confidence scoring (0-100%) based on:
Probability Strength (0-40 points): Distance from 50% neutral (max 40 points at 100% or 0%)
MTF Alignment (0-30 points): 30 points for 4/4 alignment, 20 for 3/4, 10 for 2/4
Divergence Confirmation (0-20 points): 20 points when divergence detected
Regime Favorability (0-10 points): 10 points for Normal/Low vol, 5 for Very Low, 0 for High vol
Total confidence score determines background heatmap intensity:
80-100%: Strong signal (bright color, low transparency)
60-79%: Moderate signal (medium color, medium transparency)
40-59%: Weak signal (dim color, high transparency)
0-39%: No signal (neutral color)
Visual Elements
Probability Line: Main plot showing smoothed probability (0-100%) with dynamic coloring
Zero-Lag Line: Circles overlay showing zero-lag probability for early signals
Histogram: Gradient-colored histogram showing probability deviation from 50% neutral
Reference Lines: 70% (strong bullish), 50% (neutral), 30% (strong bearish)
Background Zones: Strong bullish (>70%), strong bearish (<30%) with transparency
Confidence Heatmap: Background intensity based on multi-factor confidence score
Signal Shapes: High conviction bull/bear setups, regime shifts, divergence confirmations
Dashboard: Real-time metrics including current probability, strength, MTF alignment, ensemble score, volatility regime, confidence, and divergence status
Input Parameters
Bayesian Parameters:
Price Source: Data source for calculations (default: hlc3)
Bayesian Period: Smoothing period for probability (default: 14)
Signal Smoothing: EMA smoothing for final probability (default: 2)
Historical Analysis:
Loop Start: Starting bar for for-loop analysis (default: 1)
Loop Lookback: Ending bar for for-loop analysis (default: 70)
Multi-Timeframe Confluence:
Enable MTF Confluence: Toggle multi-timeframe analysis (default: enabled)
Short Timeframe: Fast timeframe for confluence (default: 5m)
Medium Timeframe: Medium timeframe for confluence (default: 15m)
Long Timeframe: Slow timeframe for confluence (default: 60m)
Confluence Requirement: Minimum timeframes required (default: 2)
Visualization:
Show Probability Bands: Toggle 70%/30% reference lines
Show Bias Zones: Toggle background coloring for strong bias
Show Histogram: Toggle probability deviation histogram
How to Use This Indicator
Step 1: Monitor Probability Level
Watch the main probability line. >70% indicates strong bullish bias, <30% indicates strong bearish bias, 40-60% is neutral.
Step 2: Check MTF Confluence
Verify dashboard shows "Strong Aligned" or "Aligned" status. Higher alignment = higher conviction.
Step 3: Assess Confidence Score
Dashboard confidence >70% indicates high-quality setup. >80% is exceptional.
Step 4: Confirm with Ensemble
Ensemble probability should align with current probability. Divergence suggests conflicting time horizons.
Step 5: Consider Volatility Regime
"Normal" or "Low Vol" regimes have higher reliability. "High Vol" regimes require extra caution.
Step 6: Wait for High Conviction Signals
Best setups occur when:
- Probability >65% or <35%
- Confidence >70%
- MTF alignment 3/4 or 4/4
- Cooldown period passed (12+ bars since last signal)
Best Practices
Use probability crossovers of 50% as regime shift signals
Combine with price action - probability shows bias, price shows execution
MTF alignment is most reliable during trending markets
Confidence heatmap provides quick visual assessment of setup quality
Divergence signals add significant edge when combined with probability alignment
Ensemble probability provides longer-term context - use for position bias
Volatility regime scaling is critical - reduce size in high vol environments
Zero-lag line provides early warning of probability shifts
Histogram intensity shows conviction - larger bars = stronger bias
Indicator Limitations
For-loop analysis is computationally intensive - may slow on lower-end devices
Probability scores are based on historical patterns - unprecedented events can invalidate
MTF confluence requires sufficient data on all timeframes
Bayesian calculation assumes price behavior follows historical patterns
High volatility reduces probability reliability - regime scaling helps but doesn't eliminate
Divergence detection requires clear pivot formation - may lag in choppy markets
Confidence scoring is multi-factor but still probabilistic - not deterministic
Zero-lag calculation can produce whipsaws during consolidation
Technical Implementation
Built with Pine Script v6 using:
Custom for-loop historical analysis across 1-70 bars
Bayesian probability calculation with evidence-based inference
Multi-timeframe security requests for 5m, 15m, 60m confluence
Ensemble for-loop analysis with weighted averaging (30, 70, 150 bars)
ATR-based volatility regime classification with percentile ranking
RSI divergence detection using pivot analysis
Multi-factor confidence scoring (probability, MTF, divergence, regime)
Zero-lag EMA calculation for early signal detection
Gradient histogram with dynamic coloring based on probability
Confidence heatmap background with intensity scaling
Signal cooldown system (12 bars minimum) to prevent overtrading
The code is fully open-source and can be modified to suit individual trading styles.
Originality Statement
This indicator is original in its probabilistic bias quantification approach. While for-loop analysis and Bayesian probability are established concepts, this indicator is justified because:
It combines systematic for-loop historical analysis with Bayesian probability theory for statistical rigor
The ensemble for-loop system (30, 70, 150 bars) with weighted averaging is unique
Multi-timeframe confluence detection provides conviction measurement across 4 timeframes
Volatility regime scaling adjusts probability scores based on market environment
Divergence confirmation layer adds reversal detection to directional bias
Multi-factor confidence scoring (probability + MTF + divergence + regime) synthesizes all components
Zero-lag overlay provides early warning system for probability shifts
Confidence heatmap visualization makes setup quality immediately apparent
Each component contributes unique information: for-loop shows historical position, Bayesian quantifies probability, MTF shows conviction, ensemble adds robustness, volatility scales for regime, divergence confirms reversals, confidence synthesizes quality, and zero-lag provides early warning. The indicator's value lies in presenting these complementary perspectives simultaneously with unified probabilistic framework.
Disclaimer
This indicator is provided for educational and informational purposes only. It is not financial advice. Probability scores do not guarantee outcomes. Trading involves substantial risk of loss. Past performance does not guarantee future results. Always use proper risk management and never risk more than you can afford to lose.
-Made with passion by officialjackofalltrades Indicator

Naive Bayes Candlestick Pattern Classifier v1.1 BETAAn intermezzo on why i made this script publication..
A : Candlestick Pattern took hours to backtest, why not using Machine Learning techniques?
B : Machine Learning, no that's gonna be really heavy bro!
A : Not really, because we use Naive Bayes.
B : The simplest, yet powerful machine learning algorithm to separate (a.k.a classify) multivariate data.
----------------------------------------------------------------------------------------------------------------------
Hello, everyone!
After deep research in extracting meaningful information from the market, I ended up building this powerful machine learning indicator based on the evolution of Bayesian Statistics. This indicator not only leverages the simplicity of Naive Bayes but also extends its application to candlestick pattern analysis, making it an invaluable tool for traders who are looking to enhance their technical analysis without spending countless hours manually backtesting each pattern on each market!.
What most interesting part is actually after learning all of likely useless methods like fibonacci, supply and demand, volume profile, etc. We always ended up back to basic like support and resistance and candlestick patterns, but with a slight twist on strategy algorithm design and statistical approach. Thus, the only reason why i made this, because i exactly know that you guys will ended up in this position as time goes by.
The essence of this indicator lies in its ability to automate the recognition and statistical evaluation of various candlestick patterns. Traditionally, traders have relied on visual inspection and manual backtesting to determine the effectiveness of patterns like Bullish Engulfing, Bearish Engulfing, Harami variations, Hammer formations, and even more complex multi-candle patterns such as Three White Soldiers, Three Black Crows, Dark Cloud Cover, and Piercing Pattern. However, these conventional methods are both time-consuming and prone to subjective bias.
To address these challenges, I employed Naive Bayes—a probabilistic classifier that, despite its simplicity, offers robust performance in various domains. Naive Bayes assumes that each feature is independent of the others given the class label, which, although a strong assumption, works remarkably well in practice, especially when the dataset is large like market data and the feature space is high-dimensional. In our case, each candlestick pattern acts as a feature that can be statistically evaluated based on its historical performance. The indicator calculates a probability that a given pattern will lead to a price reversal, by comparing the pattern’s close price to the highest or lowest price achieved in a lookahead window.
One of the standout features of this script is its flexibility. Each candlestick pattern is not only coded into the system but also comes with individual toggles to enable or disable them based on your trading strategy. This means you can choose to focus on single-candle patterns like Bullish Engulfing or more complex multi-candle formations such as Three White Soldiers, without modifying the core code. The built-in customization options allow you to adjust colors and labels for each pattern, giving you the freedom to tailor the visual output to your preference. This level of customization ensures that the indicator integrates seamlessly into your existing PulseWire setup.
Moreover, the indicator isn’t just about pattern recognition—it also incorporates outcome-based learning. Every time a pattern is detected, it looks ahead a predefined number of bars to evaluate if the expected reversal actually materialized. This outcome is then stored in arrays, and over time, the script dynamically calculates the probability of success for each pattern. These probabilities are presented in a real-time updating table on your chart, which shows not only the percentage probability but also the count of historical occurrences. With this information at your fingertips, you can quickly gauge the reliability of each pattern in your chosen market and timeframe.
Another significant advantage of this approach is its speed and efficiency. While more complex machine learning models like neural networks might require heavy computational resources and longer training times, the Naive Bayes classifier in this script is lightweight, instantaneous and can be updated on the fly with each new bar. This real-time capability is essential for modern traders who need to make quick decisions in fast-paced markets.
Furthermore, by automating the process of backtesting, the indicator frees up your time to focus on other aspects of trading strategy development. Instead of manually analyzing hundreds or even thousands of candles, you can rely on the statistical power of Naive Bayes to provide you with insights on which patterns are most likely to result in profitable moves. This not only enhances your efficiency but also helps to eliminate the cognitive biases that often plague manual analysis.
In summary, this indicator represents a fusion of traditional candlestick analysis with modern machine learning techniques. It harnesses the simplicity and effectiveness of Naive Bayes to deliver a dynamic, real-time evaluation of various candlestick patterns. Whether you are a seasoned trader looking to refine your technical analysis or a beginner eager to understand market dynamics, this tool offers a powerful, customizable, and efficient solution. Welcome to a new era where advanced statistical methods meet practical trading insights—happy trading and may your patterns always be in your favor!
Note : On this current released beta version, you must manually adjust reversal percentage move based on each market. Further updates may include automated best range detection and probability. Indicator

Indicator

Bayesian Bias OscillatorWhat is a Bayes Estimator?
Bayesian estimation, or Bayesian inference, is a statistical method for estimating unknown parameters of a probability distribution based on observed data and prior knowledge about those parameters. At first , you will need a prior probability distribution, which is a prior belief about the distribution of the parameter that you are interested in estimating. This distribution represents your initial beliefs or knowledge about the parameter value before observing any data. Second , you need a likelihood function, which represents the probability of observing the data given different values of the parameter. This function quantifies how well different parameter values explain the observed data. Then , you will need a posterior probability distribution by combining the prior distribution and the likelihood function to obtain the posterior distribution of the parameter. The posterior distribution represents the updated belief about the parameter value after observing the data.
Bayesian Bias Oscillator
This tool calculates the Bayes bias of returns, which are directional probabilities that provide insight on the "trend" of the market or the directional bias of returns. It comes with two outputs: the default one, which is the Z-Score of the Bayes Bias, and the regular raw probability, which can be switched on in the settings of the indicator.
The Z-Score output value doesn't tell you the probability, but it does tell you how much of a standard deviation the value is from the mean. It uses both probabilities, the probability of a positive return and the probability of a negative return, which is just (1 - probability of a positive return).
The probability output value shows you the raw probability of a positive return vs. the probability of a negative return. The probability is the value of each line plotted (blue is the probability of a positive return, and purple is the probability of a negative return).
Indicator
