EMA and MACD with Trailing Stop Loss (by Coinrule)An exponential moving average ( EMA ) is a type of moving average (MA) that places a greater weight and significance on the most recent data points. The exponential moving average is also referred to as the exponentially weighted moving average. An exponentially weighted moving average reacts more significantly to recent price changes than a simple moving average simple moving average ( SMA ), which applies an equal weight to all observations in the period.
Moving average convergence divergence ( MACD ) is a trend-following momentum indicator that shows the relationship between two moving averages of a security’s price. The MACD is calculated by subtracting the 26-period exponential moving average ( EMA ) from the 12-period EMA.
The result of that calculation is the MACD line. A nine-day EMA of the MACD called the "signal line," is then plotted on top of the MACD line, which can function as a trigger for buy and sell signals. Traders may buy the security when the MACD crosses above its signal line and sell—or short—the security when the MACD crosses below the signal line. Moving average convergence divergence ( MACD ) indicators can be interpreted in several ways, but the more common methods are crossovers, divergences, and rapid rises/falls.
The Strategy enters and closes the trade when the following conditions are met:
LONG
The MACD histogram turns bearish
EMA7 is greater than EMA14
EXIT
Price increases 3% trailing
Price decreases 1% trailing
This strategy is back-tested from 1 January 2022 to simulate how the strategy would work in a bear market and provides good returns.
Pairs that produce very strong results include XRPUSDT on the 1-minute timeframe. This short timeframe means that this strategy opens and closes trades regularly
In order to further improve the strategy, the EMA can be changed from 7 and 14 to, say, EMA20 and EMA50. Furthermore, the trailing stop loss can also be changed to ideally suit the user to match their needs.
The strategy assumes each order is using 30% of the available coins to make the results more realistic and to simulate you only ran this strategy on 30% of your holdings. A trading fee of 0.1% is also taken into account and is aligned to the base fee applied on Binance.
Pesquisar nos scripts por "Trailing stop"
ATR Trailing Stop Loss [V5]A complete ATR Trailing Stop Loss in version 5.
Features Include:
Timeframe Option
Long/Short Triggers (Green/Red Triangles)
Long/Short Conditions (Bottom Colored Line)
"Golden" Long/Short Triggers (Yellow Triangles)(Hanging Man or Shooting Star Candlestick patterns breaking ATR trailing stop)
Alerts
PluePhantom's Trailing Stop Loss Multiple of ATRThis is a simple trailing stop loss line for long and short positions, made by Bluephantom using PS v2. I converted it onto v5
It is calculated as a multiple of the ATR instead of a percentage.
You are able to change the multiple and the ATR length.
It can be used as a guide to where you should consider putting in your stop loss on a trade and to where you should move your stop loss to as the days go by.
This indicator is experimental. Use at your own risk.
Rob Hoffman's 50/80/90/Price Trailing Stop LossA trailing stop loss method by Rob Hoffman.
Set your entry, TP, and SL.
Once price is 50% of its way to the TP, set your stop loss at the gray line.
Once price is 80% of its way to the TP, set your stop loss at the light gray line.
Once price is 90% of its way to the TP set your stop loss at the white line.
MA Trailing StopA Trailing Stop indicator that uses a multiple of ATR below a SMA/EMA line. Support long positions only.
Configurables:
1. Use SMA or EMA
2. MA Period
3. ATR multiplier
4. ATR look back period
The bottom of the red area indicates the stop line. The top of the red area indicates the reference MA line.
Ideal use case is you find your a red area that covers most local lows.
The stop line moves up with MA, but does not move down if MA moves down.
If moves down (re-calculates itself) only when a low penetrates the stop line.
Long Term Breakout entry + 25% Trailing stopThis script enters on a long term breakout and exits using a 25% trailing stop
Three Bar Exit Trailing Stop - Naked Forex: Price ActionThree Bar Exit Trailing Stop - Naked Forex: Exit indicator based on price action. The naked trader locks in profit by trailing the stop loss behind the lowest low of the last three candlesticks (for buy trades) or above the highest high of the last three candlesticks (For sell trades)
Simple Moving Average - ATR Trailing StopThe old adage goes "Cut losers fast and let the winners run"
With this in mind, this will plot a dynamic trailing stop by subtracting any multiplier of the Average True Range (ATR) from the SMA of your choice.
Linear Trailing StopBased on my latest script "Linear Channels"
This is a trailing stop version of the linear channels. Thanks to capissimo for helping me fix several issues with the linear extrapolation part.
In order to know how the indicator work i recommend reading the post on the Linear Channels indicator here
Hope you like it and feel free to leave your suggestions :)
Linear Regression (Backtest / Trailing Stop)A Strategy with Backtest and Trailing Stop for Long/Short
Credits: Study by RafaelZioni - Thanks buddy!
Progressive Profit Taking with Trailing StopThis is version 2 of
Special features:
Added partial profit taking as price rises. Profit taking is triggered by price crossing an EMA.
After profit taking, price has to rise by a user-specified percent before taking profits again.
Also includes condition for fully closing position after meeting specified profit target.
To incorporate into your algo, turn the plotshape functions into alertcondition.
Grover Llorens Activator [alexgrover & Lucía Llorens] Trailing stops play a key role in technical analysis and are extremely popular trend following indicators. Their main strength lie in their ability to minimize whipsaws while conserving a decent reactivity, the most popular ones include the Supertrend, Parabolic SAR and Gann Hilo activator. However, and like many indicators, most trailing stops assume an infinitely long trend, which penalize their ability to provide early exit points, this isn't the case of the parabolic SAR who take this into account and thus converge toward the price at an increasing speed the longer a trend last.
Today a similar indicator is proposed. From an original idea of alexgrover & Lucía Llorens who wanted to revisit the classic parabolic SAR indicator, the Llorens activator aim to converge toward the price the longer a trend persist, thus allowing for potential early and accurate exit points. The code make use of the idea behind the price curve channel that you can find here :
I tried to make the code as concise as possible.
The Indicator
The indicator posses 2 user settings, length and mult , length control the rate of convergence of the indicator, with higher values of length making the indicator output converge more slowly toward the price. Mult is also related with the rate of convergence, basically once the price cross the trailing stop its value will become equal to the previous trailing stop value plus/minus mult*atr depending on the previous trailing stop value, therefore higher values of mult will require more time for the trailing stop to reach the closing price, use higher values of mult if you want to avoid potential whipsaws.
Above the indicator with slow convergence time (high length) and low mult.
Points with early exit points are highlighted.
Usage For Oscillators
The difference between the closing price and an overlay indicator can provide an oscillator with characteristics depending on the indicators used for differencing, Lucía Llorens stated that we should find indicators for differencing that highlight the cycles in the price, in other terms : Price - Signal , where we want to find Signal such that we maximize the visibility of the cycles, it can be demonstrated that in the case where the closing price is an additive model : Trend + Cycles + Noise , the zero lag estimation of the Trend component can allow for the conservation of the cycle and noise component, that is : Price - Estimate(Trend) , for example the difference between the price and moving average isn't optimal because of the moving average lag, instead the use of zero lag moving averages is more suitable, however the proposed indicator allow for a surprisingly good representation of the cycles when using differencing.
The normalization of this oscillator (via the RSI) allow to make the peak amplitude of the cycles more constant. Note however that such method can return an output with a sign inverse to the one of the original cycle component.
Conclusion
We proposed an indicator which share the logic of the SAR indicator, that is using convergence toward the price in order to provide early exit points detection. We have seen that this indicator can be used to highlight cycles when used for differencing and i don't exclude publishing more indicators based on this method.
Lucía Llorens has been a great person to work with, and provided enormous feedback and support while i was coding the indicator, this is why i include her in the indicator name as well as copyright notice. I hope we can make more indicators togethers in the future.
(altho i was against using buy/sells labels xD !)
Thanks for reading !
Trailing Stop Loss ATR + AlertI share this TSL indicator with alert (I use it only for Stocks), the configuration is very simple, you must select if it is a Short or Long operation, time at which the operation was opened,% of the daily ATR for TSL. It also contains:
- Alert
- Panel Info
Trailing Stop LossThis script demonstrate how to make a Training Stop Loss to "ride the wave". In comparison to classic Stop Loss this strategy follows the price upwards (for long positions) and when price drops by a fixed percentage then you exit your position.
atr_idemaTrailing stop indicator.
Trail when the top/bottom green line appears (with that line value as stop price).
Bifurcation Zone - CAEBifurcation Zone — Cognitive Adversarial Engine (BZ-CAE)
Bifurcation Zone — CAE (BZ-CAE) is a next-generation divergence detection system enhanced by a Cognitive Adversarial Engine that evaluates both sides of every potential trade before presenting signals. Unlike traditional divergence indicators that show every price-oscillator disagreement regardless of context, BZ-CAE applies comprehensive market-state intelligence to identify only the divergences that occur in favorable conditions with genuine probability edges.
The system identifies structural bifurcation points — critical junctures where price and momentum disagree, signaling potential reversals or continuations — then validates these opportunities through five interconnected intelligence layers: Trend Conviction Scoring , Directional Momentum Alignment , Multi-Factor Exhaustion Modeling , Adversarial Validation , and Confidence Scoring . The result is a selective, context-aware signal system that filters noise and highlights high-probability setups.
This is not a "buy the arrow" indicator. It's a decision support framework that teaches you how to read market state, evaluate divergence quality, and make informed trading decisions based on quantified intelligence rather than hope.
What Sets BZ-CAE Apart: Technical Architecture
The Problem With Traditional Divergence Indicators
Most divergence indicators operate on a simple rule: if price makes a higher high and RSI makes a lower high, show a bearish signal. If price makes a lower low and RSI makes a higher low, show a bullish signal. This creates several critical problems:
Context Blindness : They show counter-trend signals in powerful trends that rarely reverse, leading to repeated losses as you fade momentum.
Signal Spam : Every minor price-oscillator disagreement generates an alert, overwhelming you with low-quality setups and creating analysis paralysis.
No Quality Ranking : All signals are treated identically. A marginal divergence in choppy conditions receives the same visual treatment as a high-conviction setup at a major exhaustion point.
Single-Sided Evaluation : They ask "Is this a good long?" without checking if the short case is overwhelmingly stronger, leading you into obvious bad trades.
Static Configuration : You manually choose RSI 14 or Stochastic 14 and hope it works, with no systematic way to validate if that's optimal for your instrument.
BZ-CAE's Solution: Cognitive Adversarial Intelligence
BZ-CAE solves these problems through an integrated five-layer intelligence architecture:
1. Trend Conviction Score (TCS) — 0 to 1 Scale
Most indicators check if ADX is above 25 to determine "trending" conditions. This binary approach misses nuance. TCS is a weighted composite metric:
Formula : 0.35 × normalize(ADX, 10, 35) + 0.35 × structural_strength + 0.30 × htf_alignment
Structural Strength : 10-bar SMA of consecutive directional bars. Captures persistence — are bulls or bears consistently winning?
HTF Alignment : Multi-timeframe EMA stacking (20/50/100/200). When all EMAs align in the same direction, you're in institutional trend territory.
Purpose : Quantifies how "locked in" the trend is. When TCS exceeds your threshold (default 0.80), the system knows to avoid counter-trend trades unless other factors override.
Interpretation :
TCS > 0.85: Very strong trend — counter-trading is extremely high risk
TCS 0.70-0.85: Strong trend — favor continuation, require exhaustion for reversals
TCS 0.50-0.70: Moderate trend — context matters, both directions viable
TCS < 0.50: Weak/choppy — reversals more viable, range-bound conditions
2. Directional Momentum Alignment (DMA) — ATR-Normalized
Formula : (EMA21 - EMA55) / ATR14
This isn't just "price above EMA" — it's a regime-aware momentum gauge. The same $100 price movement reads completely differently in high-volatility crypto versus low-volatility forex. By normalizing with ATR, DMA adapts its interpretation to current market conditions.
Purpose : Quantifies the directional "force" behind current price action. Positive = bullish push, negative = bearish push. Magnitude = strength.
Interpretation :
DMA > 0.7: Strong bullish momentum — bearish divergences risky
DMA 0.3 to 0.7: Moderate bullish bias
DMA -0.3 to 0.3: Balanced/choppy conditions
DMA -0.7 to -0.3: Moderate bearish bias
DMA < -0.7: Strong bearish momentum — bullish divergences risky
3. Multi-Factor Exhaustion Modeling — 0 to 1 Probability
Single-metric exhaustion detection (like "RSI > 80") misses complex market states. BZ-CAE aggregates five independent exhaustion signals:
Volume Spikes : Current volume versus 50-bar average
2.5x average: 0.25 weight
2.0x average: 0.15 weight
1.5x average: 0.10 weight
Divergence Present : The fact that a divergence exists contributes 0.30 weight — structural momentum disagreement is itself an exhaustion signal.
RSI Extremes : Captures oscillator climax zones
RSI > 80 or < 20: 0.25 weight
RSI > 75 or < 25: 0.15 weight
Pin Bar Detection : Identifies rejection candles (2:1 wick-to-body ratio, indicating failed breakout attempts): 0.15 weight
Extended Runs : Consecutive bars above/below EMA20 without pullback
30+ bars: 0.15 weight (market hasn't paused to consolidate)
Total exhaustion score is the sum of all applicable weights, capped at 1.0.
Purpose : Detects when strong trends become vulnerable to reversal. High exhaustion can override trend filters, allowing counter-trend trades at genuine turning points that basic indicators would miss.
Interpretation :
Exhaustion > 0.75: High probability of climax — yellow background shading alerts you visually
Exhaustion 0.50-0.75: Moderate overextension — watch for confirmation
Exhaustion < 0.50: Fresh move — trend can continue, counter-trend trades higher risk
4. Adversarial Validation — Game Theory Applied to Trading
This is BZ-CAE's signature innovation. Before approving any signal, the engine quantifies BOTH sides of the trade simultaneously:
For Bullish Divergences , it calculates:
Bull Case Score (0-1+) :
Distance below EMA20 (pullback quality): up to 0.25
Bullish EMA alignment (close > EMA20 > EMA50): 0.25
Oversold RSI (< 40): 0.25
Volume confirmation (> 1.2x average): 0.25
Bear Case Score (0-1+) :
Price below EMA50 (structural weakness): 0.30
Very oversold RSI (< 30, indicating knife-catching): 0.20
Differential = Bull Case - Bear Case
If differential < -0.10 (default threshold), the bear case is dominating — signal is BLOCKED or ANNOTATED.
For Bearish Divergences , the logic inverts (Bear Case vs Bull Case).
Purpose : Prevents trades where you're fighting obvious strength in the opposite direction. This is institutional-grade risk management — don't just evaluate your trade, evaluate the counter-trade simultaneously.
Why This Matters : You might see a bullish divergence at a local low, but if price is deeply below major support EMAs with strong bearish momentum, you're catching a falling knife. The adversarial check catches this and blocks the signal.
5. Confidence Scoring — 0 to 1 Quality Assessment
Every signal that passes initial filters receives a comprehensive quality score:
Formula :
0.30 × normalize(TCS) // Trend context
+ 0.25 × normalize(|DMA|) // Momentum magnitude
+ 0.20 × pullback_quality // Entry distance from EMA20
+ 0.15 × state_quality // ADX + alignment + structure
+ 0.10 × divergence_strength // Slope separation magnitude
+ adversarial_bonus (0-0.30) // Your side's advantage
Purpose : Ranks setup quality for filtering and position sizing decisions. You can set a minimum confidence threshold (default 0.35) to ensure only quality setups reach your chart.
Interpretation :
Confidence > 0.70: Premium setup — consider increased position size
Confidence 0.50-0.70: Good quality — standard size
Confidence 0.35-0.50: Acceptable — reduced size or skip if conservative
Confidence < 0.35: Marginal — blocked in Filtering mode, annotated in Advisory mode
CAE Operating Modes: Learning vs Enforcement
Off : Disables all CAE logic. Raw divergence pipeline only. Use for baseline comparison.
Advisory : Shows ALL signals regardless of CAE evaluation, but annotates signals that WOULD be blocked with specific warnings (e.g., "Bull: strong downtrend (TCS=0.87)" or "Adversarial bearish"). This is your learning mode — see CAE's decision logic in action without missing educational opportunities.
Filtering : Actively blocks low-quality signals. Only setups that pass all enabled gates (Trend Filter, Adversarial Validation, Confidence Gating) reach your chart. This is your live trading mode — trust the system to enforce discipline.
CAE Filter Gates: Three-Layer Protection
When CAE is enabled, signals must pass through three independent gates (each can be toggled on/off):
Gate 1: Strong Trend Filter
If TCS ≥ tcs_threshold (default 0.80)
And signal is counter-trend (bullish in downtrend or bearish in uptrend)
And exhaustion < exhaustion_required (default 0.50)
Then: BLOCK signal
Logic: Don't fade strong trends unless the move is clearly overextended
Gate 2: Adversarial Validation
Calculate both bull case and bear case scores
If opposing case dominates by more than adv_threshold (default 0.10)
Then: BLOCK signal
Logic: Avoid trades where you're fighting obvious strength in the opposite direction
Gate 3: Confidence Gating
Calculate composite confidence score (0-1)
If confidence < min_confidence (default 0.35)
Then: In Filtering mode, BLOCK signal; in Advisory mode, ANNOTATE with warning
Logic: Only take setups with minimum quality threshold
All three gates work together. A signal must pass ALL enabled gates to fire.
Visual Intelligence System
Bifurcation Zones (Supply/Demand Blocks)
When a divergence signal fires, BZ-CAE draws a semi-transparent box extending 15 bars forward from the signal pivot:
Demand Zones (Bullish) : Theme-colored box (cyan in Cyberpunk, blue in Professional, etc.) labeled "Demand" — marks where smart money likely placed buy orders as price diverged at the low.
Supply Zones (Bearish) : Theme-colored box (magenta in Cyberpunk, orange in Professional) labeled "Supply" — marks where smart money likely placed sell orders as price diverged at the high.
Theory : Divergences represent institutional disagreement with the crowd. The crowd pushed price to an extreme (new high or low), but momentum (oscillator) is waning, indicating smart money is taking the opposite side. These zones mark order placement areas that become future support/resistance.
Use Cases :
Exit targets: Take profit when price returns to opposite-side zone
Re-entry levels: If price returns to your entry zone, consider adding
Stop placement: Place stops just beyond your zone (below demand, above supply)
Auto-Cleanup : System keeps the last 20 zones to prevent chart clutter.
Adversarial Bar Coloring — Real-Time Market Debate Heatmap
Each bar is colored based on the Bull Case vs Bear Case differential:
Strong Bull Advantage (diff > 0.3): Full theme bull color (e.g., cyan)
Moderate Bull Advantage (diff > 0.1): 50% transparency bull
Neutral (diff -0.1 to 0.1): Gray/neutral theme
Moderate Bear Advantage (diff < -0.1): 50% transparency bear
Strong Bear Advantage (diff < -0.3): Full theme bear color (e.g., magenta)
This creates a real-time visual heatmap showing which side is "winning" the market debate. When bars flip from cyan to magenta (or vice versa), you're witnessing a shift in adversarial advantage — a leading indicator of potential momentum changes.
Exhaustion Shading
When exhaustion score exceeds 0.75, the chart background displays a semi-transparent yellow highlight. This immediate visual warning alerts you that the current move is at high risk of reversal, even if trend indicators remain strong.
Visual Themes — Six Aesthetic Options
Cyberpunk : Cyan/Magenta/Yellow — High contrast, neon aesthetic, excellent for dark-themed trading environments
Professional : Blue/Orange/Green — Corporate color palette, suitable for presentations and professional documentation
Ocean : Teal/Red/Cyan — Aquatic palette, calming for extended monitoring sessions
Fire : Orange/Red/Coral — Warm aggressive colors, high energy
Matrix : Green/Red/Lime — Code aesthetic, homage to classic hacker visuals
Monochrome : White/Gray — Minimal distraction, maximum focus on price action
All visual elements (signal markers, zones, bar colors, dashboard) adapt to your selected theme.
Divergence Engine — Core Detection System
What Are Divergences?
Divergences occur when price action and momentum indicators disagree, creating structural tension that often resolves in a change of direction:
Regular Divergence (Reversal Signal) :
Bearish Regular : Price makes higher high, oscillator makes lower high → Potential trend reversal down
Bullish Regular : Price makes lower low, oscillator makes higher low → Potential trend reversal up
Hidden Divergence (Continuation Signal) :
Bearish Hidden : Price makes lower high, oscillator makes higher high → Downtrend continuation
Bullish Hidden : Price makes higher low, oscillator makes lower low → Uptrend continuation
Both types can be enabled/disabled independently in settings.
Pivot Detection Methods
BZ-CAE uses symmetric pivot detection with separate lookback and lookforward periods (default 5/5):
Pivot High : Bar where high > all highs within lookback range AND high > all highs within lookforward range
Pivot Low : Bar where low < all lows within lookback range AND low < all lows within lookforward range
This ensures structural validity — the pivot must be a clear local extreme, not just a minor wiggle.
Divergence Validation Requirements
For a divergence to be confirmed, it must satisfy:
Slope Disagreement : Price slope and oscillator slope must move in opposite directions (for regular divs) or same direction with inverted highs/lows (for hidden divs)
Minimum Slope Change : |osc_slope| > min_slope_change / 100 (default 1.0) — filters weak, marginal divergences
Maximum Lookback Range : Pivots must be within max_lookback bars (default 60) — prevents ancient, irrelevant divergences
ATR-Normalized Strength : Divergence strength = min(|price_slope| × |osc_slope| × 10, 1.0) — quantifies the magnitude of disagreement in volatility context
Regular divergences receive 1.0× weight; hidden divergences receive 0.8× weight (slightly less reliable historically).
Oscillator Options — Five Professional Indicators
RSI (Relative Strength Index) : Classic overbought/oversold momentum indicator. Best for: General purpose divergence detection across all instruments.
Stochastic : Range-bound %K momentum comparing close to high-low range. Best for: Mean reversion strategies and range-bound markets.
CCI (Commodity Channel Index) : Measures deviation from statistical mean, auto-normalized to 0-100 scale. Best for: Cyclical instruments and commodities.
MFI (Money Flow Index) : Volume-weighted RSI incorporating money flow. Best for: Volume-driven markets like stocks and crypto.
Williams %R : Inverse stochastic looking back over period, auto-adjusted to 0-100. Best for: Reversal detection at extremes.
Each oscillator has adjustable length (2-200, default 14) and smoothing (1-20, default 1). You also set overbought (50-100, default 70) and oversold (0-50, default 30) thresholds.
Signal Timing Modes — Understanding Repainting
BZ-CAE offers two timing policies with complete transparency about repainting behavior:
Realtime (1-bar, peak-anchored)
How It Works :
Detects peaks 1 bar ago using pattern: high > high AND high > high
Signal prints on the NEXT bar after peak detection (bar_index)
Visual marker anchors to the actual PEAK bar (bar_index - 1, offset -1)
Signal locks in when bar CONFIRMS (closes)
Repainting Behavior :
On the FORMING bar (before close), the peak condition may change as new prices arrive
Once bar CLOSES (barstate.isconfirmed), signal is locked permanently
This is preview/early warning behavior by design
Best For :
Active monitoring and immediate alerts
Learning the system (seeing signals develop in real-time)
Responsive entry if you're watching the chart live
Confirmed (lookforward)
How It Works :
Uses Pine Script's built-in ta.pivothigh() and ta.pivotlow() functions
Requires full pivot validation period (lookback + lookforward bars)
Signal prints pivot_lookforward bars after the actual peak (default 5-bar delay)
Visual marker anchors to the actual peak bar (offset -pivot_lookforward)
No Repainting Behavior
Best For :
Backtesting and historical analysis
Conservative entries requiring full confirmation
Automated trading systems
Swing trading with larger timeframes
Tradeoff :
Delayed entry by pivot_lookforward bars (typically 5 bars)
On a 5-minute chart, this is a 25-minute delay
On a 4-hour chart, this is a 20-hour delay
Recommendation : Use Confirmed for backtesting to verify system performance honestly. Use Realtime for live monitoring only if you're actively watching the chart and understand pre-confirmation repainting behavior.
Signal Spacing System — Anti-Spam Architecture
Even after CAE filtering, raw divergences can cluster. The spacing system enforces separation:
Three Independent Filters
1. Min Bars Between ANY Signals (default 12):
Prevents rapid-fire clustering across both directions
If last signal (bull or bear) was within N bars, block new signal
Ensures breathing room between all setups
2. Min Bars Between SAME-SIDE Signals (default 24, optional enforcement):
Prevents bull-bull or bear-bear spam
Separate tracking for bullish and bearish signal timelines
Toggle enforcement on/off
3. Min ATR Distance From Last Signal (default 0, optional):
Requires price to move N × ATR from last signal location
Ensures meaningful price movement between setups
0 = disabled, 0.5-2.0 = typical range for enabled
All three filters work independently. A signal must pass ALL enabled filters to proceed.
Practical Guidance :
Scalping (1-5m) : Any 6-10, Same-side 12-20, ATR 0-0.5
Day Trading (15m-1H) : Any 12, Same-side 24, ATR 0-1.0
Swing Trading (4H-D) : Any 20-30, Same-side 40-60, ATR 1.0-2.0
Dashboard — Real-Time Control Center
The dashboard (toggleable, four corner positions, three sizes) provides comprehensive system intelligence:
Oscillator Section
Current oscillator type and value
State: OVERBOUGHT / OVERSOLD / NEUTRAL (color-coded)
Length parameter
Cognitive Engine Section
TCS (Trend Conviction Score) :
Current value with emoji state indicator
🔥 = Strong trend (>0.75)
📊 = Moderate trend (0.50-0.75)
〰️ = Weak/choppy (<0.50)
Color: Red if above threshold (trend filter active), yellow if moderate, green if weak
DMA (Directional Momentum Alignment) :
Current value with emoji direction indicator
🐂 = Bullish momentum (>0.5)
⚖️ = Balanced (-0.5 to 0.5)
🐻 = Bearish momentum (<-0.5)
Color: Green if bullish, red if bearish
Exhaustion :
Current value with emoji warning indicator
⚠️ = High exhaustion (>0.75)
🟡 = Moderate (0.50-0.75)
✓ = Low (<0.50)
Color: Red if high, yellow if moderate, green if low
Pullback :
Quality of current distance from EMA20
Values >0.6 are ideal entry zones (not too close, not too far)
Bull Case / Bear Case (if Adversarial enabled):
Current scores for both sides of the market debate
Differential with emoji indicator:
📈 = Bull advantage (>0.2)
➡️ = Balanced (-0.2 to 0.2)
📉 = Bear advantage (<-0.2)
Last Signal Metrics Section (New Feature)
When a signal fires, this section captures and displays:
Signal type (BULL or BEAR)
Bars elapsed since signal
Confidence % at time of signal
TCS value at signal time
DMA value at signal time
Purpose : Provides a historical reference for learning. You can see what the market state looked like when the last signal fired, helping you correlate outcomes with conditions.
Statistics Section
Total Signals : Lifetime count across session
Blocked Signals : Count and percentage (filter effectiveness metric)
Bull Signals : Total bullish divergences
Bear Signals : Total bearish divergences
Purpose : System health monitoring. If blocked % is very high (>60%), filters may be too strict. If very low (<10%), filters may be too loose.
Advisory Annotations
When CAE Mode = Advisory, this section displays warnings for signals that would be blocked in Filtering mode:
Examples:
"Bull spacing: wait 8 bars"
"Bear: strong uptrend (TCS=0.87)"
"Adversarial bearish"
"Low confidence 32%"
Multiple warnings can stack, separated by " | ". This teaches you CAE's decision logic transparently.
How to Use BZ-CAE — Complete Workflow
Phase 1: Initial Setup (First Session)
Apply BZ-CAE to your chart
Select your preferred Visual Theme (Cyberpunk recommended for visibility)
Set Signal Timing to "Confirmed (lookforward)" for learning
Choose your Oscillator Type (RSI recommended for general use, length 14)
Set Overbought/Oversold to 70/30 (standard)
Enable both Regular Divergence and Hidden Divergence
Set Pivot Lookback/Lookforward to 5/5 (balanced structure)
Enable CAE Intelligence
Set CAE Mode to "Advisory" (learning mode)
Enable all three CAE filters: Strong Trend Filter , Adversarial Validation , Confidence Gating
Enable Show Dashboard , position Top Right, size Normal
Enable Draw Bifurcation Zones and Adversarial Bar Coloring
Phase 2: Learning Period (Weeks 1-2)
Goal : Understand how CAE evaluates market state and filters signals.
Activities :
Watch the dashboard during signals :
Note TCS values when counter-trend signals fail — this teaches you the trend strength threshold for your instrument
Observe exhaustion patterns at actual turning points — learn when overextension truly matters
Study adversarial differential at signal times — see when opposing cases dominate
Review blocked signals (orange X-crosses):
In Advisory mode, you see everything — signals that would pass AND signals that would be blocked
Check the advisory annotations to understand why CAE would block
Track outcomes: Were the blocks correct? Did those signals fail?
Use Last Signal Metrics :
After each signal, check the dashboard capture of confidence, TCS, and DMA
Journal these values alongside trade outcomes
Identify patterns: Do confidence >0.70 signals work better? Does your instrument respect TCS >0.85?
Understand your instrument's "personality" :
Trending instruments (indices, major forex) may need TCS threshold 0.85-0.90
Choppy instruments (low-cap stocks, exotic pairs) may work best with TCS 0.70-0.75
High-volatility instruments (crypto) may need wider spacing
Low-volatility instruments may need tighter spacing
Phase 3: Calibration (Weeks 3-4)
Goal : Optimize settings for your specific instrument, timeframe, and style.
Calibration Checklist :
Min Confidence Threshold :
Review confidence distribution in your signal journal
Identify the confidence level below which signals consistently fail
Set min_confidence slightly above that level
Day trading : 0.35-0.45
Swing trading : 0.40-0.55
Scalping : 0.30-0.40
TCS Threshold :
Find the TCS level where counter-trend signals consistently get stopped out
Set tcs_threshold at or slightly below that level
Trending instruments : 0.85-0.90
Mixed instruments : 0.80-0.85
Choppy instruments : 0.75-0.80
Exhaustion Override Level :
Identify exhaustion readings that marked genuine reversals
Set exhaustion_required just below the average
Typical range : 0.45-0.55
Adversarial Threshold :
Default 0.10 works for most instruments
If you find CAE is too conservative (blocking good trades), raise to 0.15-0.20
If signals are still getting caught in opposing momentum, lower to 0.07-0.09
Spacing Parameters :
Count bars between quality signals in your journal
Set min bars ANY to ~60% of that average
Set min bars SAME-SIDE to ~120% of that average
Scalping : Any 6-10, Same 12-20
Day trading : Any 12, Same 24
Swing : Any 20-30, Same 40-60
Oscillator Selection :
Try different oscillators for 1-2 weeks each
Track win rate and average winner/loser by oscillator type
RSI : Best for general use, clear OB/OS
Stochastic : Best for range-bound, mean reversion
MFI : Best for volume-driven markets
CCI : Best for cyclical instruments
Williams %R : Best for reversal detection
Phase 4: Live Deployment
Goal : Disciplined execution with proven, calibrated system.
Settings Changes :
Switch CAE Mode from Advisory to Filtering
System now actively blocks low-quality signals
Only setups passing all gates reach your chart
Keep Signal Timing on Confirmed for conservative entries
OR switch to Realtime if you're actively monitoring and want faster entries (accept pre-confirmation repaint risk)
Use your calibrated thresholds from Phase 3
Enable high-confidence alerts: "⭐ High Confidence Bullish/Bearish" (>0.70)
Trading Discipline Rules :
Respect Blocked Signals :
If CAE blocks a trade you wanted to take, TRUST THE SYSTEM
Don't manually override — if you consistently disagree, return to Phase 2/3 calibration
The block exists because market state failed intelligence checks
Confidence-Based Position Sizing :
Confidence >0.70: Standard or increased size (e.g., 1.5-2.0% risk)
Confidence 0.50-0.70: Standard size (e.g., 1.0% risk)
Confidence 0.35-0.50: Reduced size (e.g., 0.5% risk) or skip if conservative
TCS-Based Management :
High TCS + counter-trend signal: Use tight stops, quick exits (you're fading momentum)
Low TCS + reversal signal: Use wider stops, trail aggressively (genuine reversal potential)
Exhaustion Awareness :
Exhaustion >0.75 (yellow shading): Market is overextended, reversal risk is elevated — consider early exit or tighter trailing stops even on winning trades
Exhaustion <0.30: Continuation bias — hold for larger move, wide trailing stops
Adversarial Context :
Strong differential against you (e.g., bullish signal with bear diff <-0.2): Use very tight stops, consider skipping
Strong differential with you (e.g., bullish signal with bull diff >0.2): Trail aggressively, this is your tailwind
Practical Settings by Timeframe & Style
Scalping (1-5 Minute Charts)
Objective : High frequency, tight stops, quick reversals in fast-moving markets.
Oscillator :
Type: RSI or Stochastic (fast response to quick moves)
Length: 9-11 (more responsive than standard 14)
Smoothing: 1 (no lag)
OB/OS: 65/35 (looser thresholds ensure frequent crossings in fast conditions)
Divergence :
Pivot Lookback/Lookforward: 3/3 (tight structure, catch small swings)
Max Lookback: 40-50 bars (recent structure only)
Min Slope Change: 0.8-1.0 (don't be overly strict)
CAE :
Mode: Advisory first (learn), then Filtering
Min Confidence: 0.30-0.35 (lower bar for speed, accept more signals)
TCS Threshold: 0.70-0.75 (allow more counter-trend opportunities)
Exhaustion Required: 0.45-0.50 (moderate override)
Strong Trend Filter: ON (still respect major intraday trends)
Adversarial: ON (critical for scalping protection — catches bad entries quickly)
Spacing :
Min Bars ANY: 6-10 (fast pace, many setups)
Min Bars SAME-SIDE: 12-20 (prevent clustering)
Min ATR Distance: 0 or 0.5 (loose)
Timing : Realtime (speed over precision, but understand repaint risk)
Visuals :
Signal Size: Tiny (chart clarity in busy conditions)
Show Zones: Optional (can clutter on low timeframes)
Bar Coloring: ON (helps read momentum shifts quickly)
Dashboard: Small size (corner reference, not main focus)
Key Consideration : Scalping generates noise. Even with CAE, expect lower win rate (45-55%) but aim for favorable R:R (2:1 or better). Size conservatively.
Day Trading (15-Minute to 1-Hour Charts)
Objective : Balance quality and frequency. Standard divergence trading approach.
Oscillator :
Type: RSI or MFI (proven reliability, volume confirmation with MFI)
Length: 14 (industry standard, well-studied)
Smoothing: 1-2
OB/OS: 70/30 (classic levels)
Divergence :
Pivot Lookback/Lookforward: 5/5 (balanced structure)
Max Lookback: 60 bars
Min Slope Change: 1.0 (standard strictness)
CAE :
Mode: Filtering (enforce discipline from the start after brief Advisory learning)
Min Confidence: 0.35-0.45 (quality filter without being too restrictive)
TCS Threshold: 0.80-0.85 (respect strong trends)
Exhaustion Required: 0.50 (balanced override threshold)
Strong Trend Filter: ON
Adversarial: ON
Confidence Gating: ON (all three filters active)
Spacing :
Min Bars ANY: 12 (breathing room between all setups)
Min Bars SAME-SIDE: 24 (prevent bull/bear clusters)
Min ATR Distance: 0-1.0 (optional refinement, typically 0.5-1.0)
Timing : Confirmed (1-bar delay for reliability, no repainting)
Visuals :
Signal Size: Tiny or Small
Show Zones: ON (useful reference for exits/re-entries)
Bar Coloring: ON (context awareness)
Dashboard: Normal size (full visibility)
Key Consideration : This is the "sweet spot" timeframe for BZ-CAE. Market structure is clear, CAE has sufficient data, and signal frequency is manageable. Expect 55-65% win rate with proper execution.
Swing Trading (4-Hour to Daily Charts)
Objective : Quality over quantity. High conviction only. Larger stops and targets.
Oscillator :
Type: RSI or CCI (robust on higher timeframes, smooth longer waves)
Length: 14-21 (capture larger momentum swings)
Smoothing: 1-3
OB/OS: 70/30 or 75/25 (strict extremes)
Divergence :
Pivot Lookback/Lookforward: 5/5 or 7/7 (structural purity, major swings only)
Max Lookback: 80-100 bars (broader historical context)
Min Slope Change: 1.2-1.5 (require strong, undeniable divergence)
CAE :
Mode: Filtering (strict enforcement, premium setups only)
Min Confidence: 0.40-0.55 (high bar for entry)
TCS Threshold: 0.85-0.95 (very strong trend protection — don't fade established HTF trends)
Exhaustion Required: 0.50-0.60 (higher bar for override — only extreme exhaustion justifies counter-trend)
Strong Trend Filter: ON (critical on HTF)
Adversarial: ON (avoid obvious bad trades)
Confidence Gating: ON (quality gate essential)
Spacing :
Min Bars ANY: 20-30 (substantial separation)
Min Bars SAME-SIDE: 40-60 (significant breathing room)
Min ATR Distance: 1.0-2.0 (require meaningful price movement)
Timing : Confirmed (purity over speed, zero repaint for swing accuracy)
Visuals :
Signal Size: Small or Normal (clear markers on zoomed-out view)
Show Zones: ON (important HTF levels)
Bar Coloring: ON (long-term trend awareness)
Dashboard: Normal or Large (comprehensive analysis)
Key Consideration : Swing signals are rare but powerful. Expect 2-5 signals per month per instrument. Win rate should be 60-70%+ due to stringent filtering. Position size can be larger given confidence.
Dashboard Interpretation Reference
TCS (Trend Conviction Score) States
0.00-0.50: Weak/Choppy
Emoji: 〰️
Color: Green/cyan
Meaning: No established trend. Range-bound or consolidating. Both reversal and continuation signals viable.
Action: Reversals (regular divs) are safer. Use wider profit targets (market has room to move). Consider mean reversion strategies.
0.50-0.75: Moderate Trend
Emoji: 📊
Color: Yellow/neutral
Meaning: Developing trend but not locked in. Context matters significantly.
Action: Check DMA and exhaustion. If DMA confirms trend and exhaustion is low, favor continuation (hidden divs). If exhaustion is high, reversals are viable.
0.75-0.85: Strong Trend
Emoji: 🔥
Color: Orange/warning
Meaning: Well-established trend with persistence. Counter-trend is high risk.
Action: Require exhaustion >0.50 for counter-trend entries. Favor continuation signals. Use tight stops on counter-trend attempts.
0.85-1.00: Very Strong Trend
Emoji: 🔥🔥
Color: Red/danger (if counter-trading)
Meaning: Locked-in institutional trend. Extremely high risk to fade.
Action: Avoid counter-trend unless exhaustion >0.75 (yellow shading). Focus exclusively on continuation opportunities. Momentum is king here.
DMA (Directional Momentum Alignment) Zones
-2.0 to -1.0: Strong Bearish Momentum
Emoji: 🐻🐻
Color: Dark red
Meaning: Powerful downside force. Sellers are in control.
Action: Bullish divergences are counter-momentum (high risk). Bearish divergences are with-momentum (lower risk). Size down on longs.
-0.5 to 0.5: Neutral/Balanced
Emoji: ⚖️
Color: Gray/neutral
Meaning: No strong directional bias. Choppy or consolidating.
Action: Both directions have similar probability. Focus on confidence score and adversarial differential for edge.
1.0 to 2.0: Strong Bullish Momentum
Emoji: 🐂🐂
Color: Bright green/cyan
Meaning: Powerful upside force. Buyers are in control.
Action: Bearish divergences are counter-momentum (high risk). Bullish divergences are with-momentum (lower risk). Size down on shorts.
Exhaustion States
0.00-0.50: Fresh Move
Emoji: ✓
Color: Green
Meaning: Trend is healthy, not overextended. Room to run.
Action: Counter-trend trades are premature. Favor continuation. Hold winners for larger moves. Avoid early exits.
0.50-0.75: Mature Move
Emoji: 🟡
Color: Yellow
Meaning: Move is aging. Watch for signs of climax.
Action: Tighten trailing stops on winning trades. Be ready for reversals. Don't add to positions aggressively.
0.75-0.85: High Exhaustion
Emoji: ⚠️
Color: Orange
Background: Yellow shading appears
Meaning: Move is overextended. Reversal risk elevated significantly.
Action: Counter-trend reversals are higher probability. Consider early exits on with-trend positions. Size up on reversal divergences (if CAE allows).
0.85-1.00: Critical Exhaustion
Emoji: ⚠️⚠️
Color: Red
Background: Yellow shading intensifies
Meaning: Climax conditions. Reversal imminent or underway.
Action: Aggressive reversal trades justified. Exit all with-trend positions. This is where major turns occur.
Confidence Score Tiers
0.00-0.30: Low Quality
Color: Red
Status: Blocked in Filtering mode
Action: Skip entirely. Setup lacks fundamental quality across multiple factors.
0.30-0.50: Moderate Quality
Color: Yellow/orange
Status: Marginal — passes in Filtering only if >min_confidence
Action: Reduced position size (0.5-0.75% risk). Tight stops. Conservative profit targets. Skip if you're selective.
0.50-0.70: High Quality
Color: Green/cyan
Status: Good setup across most quality factors
Action: Standard position size (1.0-1.5% risk). Normal stops and targets. This is your bread-and-butter trade.
0.70-1.00: Premium Quality
Color: Bright green/gold
Status: Exceptional setup — all factors aligned
Visual: Double confidence ring appears
Action: Consider increased position size (1.5-2.0% risk, maximum). Wider stops. Larger targets. High probability of success. These are rare — capitalize when they appear.
Adversarial Differential Interpretation
Bull Differential > 0.3 :
Visual: Strong cyan/green bar colors
Meaning: Bull case strongly dominates. Buyers have clear advantage.
Action: Bullish divergences favored (with-advantage). Bearish divergences face headwind (reduce size or skip). Momentum is bullish.
Bull Differential 0.1 to 0.3 :
Visual: Moderate cyan/green transparency
Meaning: Moderate bull advantage. Buyers have edge but not overwhelming.
Action: Both directions viable. Slight bias toward longs.
Differential -0.1 to 0.1 :
Visual: Gray/neutral bars
Meaning: Balanced debate. No clear advantage either side.
Action: Rely on other factors (confidence, TCS, exhaustion) for direction. Adversarial is neutral.
Bear Differential -0.3 to -0.1 :
Visual: Moderate red/magenta transparency
Meaning: Moderate bear advantage. Sellers have edge but not overwhelming.
Action: Both directions viable. Slight bias toward shorts.
Bear Differential < -0.3 :
Visual: Strong red/magenta bar colors
Meaning: Bear case strongly dominates. Sellers have clear advantage.
Action: Bearish divergences favored (with-advantage). Bullish divergences face headwind (reduce size or skip). Momentum is bearish.
Last Signal Metrics — Post-Trade Analysis
After a signal fires, dashboard captures:
Type : BULL or BEAR
Bars Ago : How long since signal (updates every bar)
Confidence : What was the quality score at signal time
TCS : What was trend conviction at signal time
DMA : What was momentum alignment at signal time
Use Case : Post-trade journaling and learning.
Example: "BULL signal 12 bars ago. Confidence: 68%, TCS: 0.42, DMA: -0.85"
Analysis : This was a bullish reversal (regular div) with good confidence, weak trend (TCS), but strong bearish momentum (DMA). The bet was that momentum would reverse — a counter-momentum play requiring exhaustion confirmation. Check if exhaustion was high at that time to justify the entry.
Track patterns:
Do your best trades have confidence >0.65?
Do low-TCS signals (<0.50) work better for you?
Are you more successful with-momentum (DMA aligned with signal) or counter-momentum?
Troubleshooting Guide
Problem: No Signals Appearing
Symptoms : Chart loads, dashboard shows metrics, but no divergence signals fire.
Diagnosis Checklist :
Check dashboard oscillator value : Is it crossing OB/OS levels (70/30)? If oscillator stays in 40-60 range constantly, it can't reach extremes needed for divergence detection.
Are pivots forming? : Look for local swing highs/lows on your chart. If price is in tight consolidation, pivots may not meet lookback/lookforward requirements.
Is spacing too tight? : Check "Last Signal" metrics — how many bars since last signal? If <12 and your min_bars_ANY is 12, spacing filter is blocking.
Is CAE blocking everything? : Check dashboard Statistics section — what's the blocked signal count? High blocks indicate overly strict filters.
Solutions :
Loosen OB/OS Temporarily :
Try 65/35 to verify divergence detection works
If signals appear, the issue was threshold strictness
Gradually tighten back to 67/33, then 70/30 as appropriate
Lower Min Confidence :
Try 0.25-0.30 (diagnostic level)
If signals appear, filter was too strict
Raise gradually to find sweet spot (0.35-0.45 typical)
Disable Strong Trend Filter Temporarily :
Turn off in CAE settings
If signals appear, TCS threshold was blocking everything
Re-enable and lower TCS_threshold to 0.70-0.75
Reduce Min Slope Change :
Try 0.7-0.8 (from default 1.0)
Allows weaker divergences through
Helpful on low-volatility instruments
Widen Spacing :
Set min_bars_ANY to 6-8
Set min_bars_SAME_SIDE to 12-16
Reduces time between allowed signals
Check Timing Mode :
If using Confirmed, remember there's a pivot_lookforward delay (5+ bars)
Switch to Realtime temporarily to verify system is working
Realtime has no delay but repaints
Verify Oscillator Settings :
Length 14 is standard but might not fit all instruments
Try length 9-11 for faster response
Try length 18-21 for slower, smoother response
Problem: Too Many Signals (Signal Spam)
Symptoms : Dashboard shows 50+ signals in Statistics, confidence scores mostly <0.40, signals clustering close together.
Solutions :
Raise Min Confidence :
Try 0.40-0.50 (quality filter)
Blocks bottom-tier setups
Targets top 50-60% of divergences only
Tighten OB/OS :
Use 70/30 or 75/25
Requires more extreme oscillator readings
Reduces false divergences in mid-range
Increase Min Slope Change :
Try 1.2-1.5 (from default 1.0)
Requires stronger, more obvious divergences
Filters marginal slope disagreements
Raise TCS Threshold :
Try 0.85-0.90 (from default 0.80)
Stricter trend filter blocks more counter-trend attempts
Favors only strongest trend alignment
Enable ALL CAE Gates :
Turn on Trend Filter + Adversarial + Confidence
Triple-layer protection
Blocks aggressively — expect 20-40% reduction in signals
Widen Spacing :
min_bars_ANY: 15-20 (from 12)
min_bars_SAME_SIDE: 30-40 (from 24)
Creates substantial breathing room
Switch to Confirmed Timing :
Removes realtime preview noise
Ensures full pivot validation
5-bar delay filters many false starts
Problem: Signals in Strong Trends Get Stopped Out
Symptoms : You take a bullish divergence in a downtrend (or bearish in uptrend), and it immediately fails. Dashboard showed high TCS at the time.
Analysis : This is INTENDED behavior — CAE is protecting you from low-probability counter-trend trades.
Understanding :
Check Last Signal Metrics in dashboard — what was TCS when signal fired?
If TCS was >0.85 and signal was counter-trend, CAE correctly identified it as high risk
Strong trends rarely reverse cleanly without major exhaustion
Your losses here are the system working as designed (blocking bad odds)
If You Want to Override (Not Recommended) :
Lower TCS_threshold to 0.70-0.75 (allows more counter-trend)
Lower exhaustion_required to 0.40 (easier override)
Disable Strong Trend Filter entirely (very risky)
Better Approach :
TRUST THE FILTER — it's preventing costly mistakes
Wait for exhaustion >0.75 (yellow shading) before counter-trending strong TCS
Focus on continuation signals (hidden divs) in high-TCS environments
Use Advisory mode to see what CAE is blocking and learn from outcomes
Problem: Adversarial Blocking Seems Wrong
Symptoms : You see a divergence that "looks good" visually, but CAE blocks with "Adversarial bearish/bullish" warning.
Diagnosis :
Check dashboard Bull Case and Bear Case scores at that moment
Look at Differential value
Check adversarial bar colors — was there strong coloring against your intended direction?
Understanding :
Adversarial catches "obvious" opposing momentum that's easy to miss
Example: Bullish divergence at a local low, BUT price is deeply below EMA50, bearish momentum is strong, and RSI shows knife-catching conditions
Bull Case might be 0.20 while Bear Case is 0.55
Differential = -0.35, far beyond threshold
Block is CORRECT — you'd be fighting overwhelming opposing flow
If You Disagree Consistently
Review blocked signals on chart — scroll back and check outcomes
Did those blocked signals actually work, or did they fail as adversarial predicted?
Raise adv_threshold to 0.15-0.20 (more permissive, allows closer battles)
Disable Adversarial Validation temporarily (diagnostic) to isolate its effect
Use Advisory mode to learn adversarial patterns over 50-100 signals
Remember : Adversarial is conservative BY DESIGN. It prevents "obvious" bad trades where you're fighting strong strength the other way.
Problem: Dashboard Not Showing or Incomplete
Solutions :
Toggle "Show Dashboard" to ON in settings
Try different dashboard sizes (Small/Normal/Large)
Try different positions (Top Left/Right, Bottom Left/Right) — might be off-screen
Some sections require CAE Enable = ON (Cognitive Engine section won't appear if CAE is disabled)
Statistics section requires at least 1 lifetime signal to populate
Check that visual theme is set (dashboard colors adapt to theme)
Problem: Performance Lag, Chart Freezing
Symptoms : Chart loading is slow, indicator calculations cause delays, pinch-to-zoom lags.
Diagnosis : Visual features are computationally expensive, especially adversarial bar coloring (recalculates every bar).
Solutions (In Order of Impact) :
Disable Adversarial Bar Coloring (MOST EXPENSIVE):
Turn OFF "Adversarial Bar Coloring" in settings
This is the single biggest performance drain
Immediate improvement
Reduce Vertical Lines :
Lower "Keep last N vertical lines" to 20-30
Or set to 0 to disable entirely
Moderate improvement
Disable Bifurcation Zones :
Turn OFF "Draw Bifurcation Zones"
Reduces box drawing calculations
Moderate improvement
Set Dashboard Size to Small :
Smaller dashboard = fewer cells = less rendering
Minor improvement
Use Shorter Max Lookback :
Reduce max_lookback to 40-50 (from 60+)
Fewer bars to scan for divergences
Minor improvement
Disable Exhaustion Shading :
Turn OFF "Show Market State"
Removes background coloring calculations
Minor improvement
Extreme Performance Mode :
Disable ALL visual enhancements
Keep only triangle markers
Dashboard Small or OFF
Use Minimal theme if available
Problem: Realtime Signals Repainting
Symptoms : You see a signal appear, but on next bar it disappears or moves.
Explanation :
Realtime mode detects peaks 1 bar ago: high > high AND high > high
On the FORMING bar (before close), this condition can change as new prices arrive
Example: At 10:05, high (10:04 bar) was 100, current high is 99 → peak detected
At 10:05:30, new high of 101 arrives → peak condition breaks → signal disappears
At 10:06 (bar close), final high is 101 → no peak at 10:04 anymore → signal gone permanently
This is expected behavior for realtime responsiveness. You get preview/early warning, but it's not locked until bar confirms.
Solutions :
Use Confirmed Timing :
Switch to "Confirmed (lookforward)" mode
ZERO repainting — pivot must be fully validated
5-bar delay (pivot_lookforward)
What you see in history is exactly what would have appeared live
Accept Realtime Repaint as Tradeoff :
Keep Realtime mode for speed and alerts
Understand that pre-confirmation signals may vanish
Only trade signals that CONFIRM at bar close (check barstate.isconfirmed)
Use for live monitoring, NOT for backtesting
Trade Only After Confirmation :
In Realtime mode, wait 1 full bar after signal appears before entering
If signal survives that bar close, it's locked
This adds 1-bar delay but removes repaint risk
Recommendation : Use Confirmed for backtesting and conservative trading. Use Realtime only for active monitoring with full understanding of preview behavior.
Risk Management Integration
BZ-CAE is a signal generation system, not a complete trading strategy. You must integrate proper risk management:
Position Sizing by Confidence
Confidence 0.70-1.00 (Premium) :
Risk: 1.5-2.0% of account (MAXIMUM)
Reasoning: High-quality setup across all factors
Still cap at 2% — even premium setups can fail
Confidence 0.50-0.70 (High Quality) :
Risk: 1.0-1.5% of account
Reasoning: Standard good setup
Your bread-and-butter risk level
Confidence 0.35-0.50 (Moderate Quality) :
Risk: 0.5-1.0% of account
Reasoning: Marginal setup, passes minimum threshold
Reduce size or skip if you're selective
Confidence <0.35 (Low Quality) :
Risk: 0% (blocked in Filtering mode)
Reasoning: Insufficient quality factors
System protects you by not showing these
Stop Placement Strategies
For Reversal Signals (Regular Divergences) :
Place stop beyond the divergence pivot plus buffer
Bullish : Stop below the divergence low - 1.0-1.5 × ATR
Bearish : Stop above the divergence high + 1.0-1.5 × ATR
Reasoning: If price breaks the pivot, divergence structure is invalidated
For Continuation Signals (Hidden Divergences) :
Place stop beyond recent swing in opposite direction
Bullish continuation : Stop below recent swing low (not the divergence pivot itself)
Bearish continuation : Stop above recent swing high
Reasoning: You're trading with trend, allow more breathing room
ATR-Based Stops :
1.5-2.0 × ATR is standard
Scale by timeframe:
Scalping (1-5m): 1.0-1.5 × ATR (tight)
Day trading (15m-1H): 1.5-2.0 × ATR (balanced)
Swing (4H-D): 2.0-3.0 × ATR (wide)
Never Use Fixed Dollar/Pip Stops :
Markets have different volatility
50-pip stop on EUR/USD ≠ 50-pip stop on GBP/JPY
Always normalize by ATR or pivot structure
Profit Targets and Scaling
Primary Target :
2-3 × ATR from entry (minimum 2:1 reward-risk)
Example : Entry at 100, ATR = 2, stop at 97 (1.5 × ATR) → target at 106 (3 × ATR) = 2:1 R:R
Scaling Out Strategy :
Take 50% off at 1.5 × ATR (secure partial profit)
Move stop to breakeven
Trail remaining 50% with 1.0 × ATR trailing stop
Let winners run if trend persists
Targets by Confidence :
High Confidence (>0.70) : Aggressive targets (3-4 × ATR), trail wider (1.5 × ATR)
Standard Confidence (0.50-0.70) : Normal targets (2-3 × ATR), standard trail (1.0 × ATR)
Low Confidence (0.35-0.50) : Conservative targets (1.5-2 × ATR), tight trail (0.75 × ATR)
Use Bifurcation Zones :
If opposite-side zone is visible on chart (from previous signal), use it as target
Example : Bullish signal at 100, prior supply zone at 110 → use 110 as target
Zones mark institutional resistance/support
Exhaustion-Based Exits :
If you're in a trade and exhaustion >0.75 develops (yellow shading), consider early exit
Market is overextended — reversal risk is high
Take profit even if target not reached
Trade Management by TCS
High TCS + Counter-Trend Trade (Risky) :
Use very tight stops (1.0-1.5 × ATR)
Conservative targets (1.5-2 × ATR)
Quick exit if trade doesn't work immediately
You're fading momentum — respect it
Low TCS + Reversal Trade (Safer) :
Use wider stops (2.0-2.5 × ATR)
Aggressive targets (3-4 × ATR)
Trail with patience
Genuine reversal potential in weak trend
High TCS + Continuation Trade (Safest) :
Standard stops (1.5-2.0 × ATR)
Very aggressive targets (4-5 × ATR)
Trail wide (1.5-2.0 × ATR)
You're with institutional momentum — let it run
Educational Value — Learning Machine Intelligence
BZ-CAE is designed as a learning platform, not just a tool:
Advisory Mode as Teacher
Most indicators are binary: signal or no signal. You don't learn WHY certain setups are better.
BZ-CAE's Advisory mode shows you EVERY potential divergence, then annotates the ones that would be blocked in Filtering mode with specific reasons:
"Bull: strong downtrend (TCS=0.87)" teaches you that TCS >0.85 makes counter-trend very risky
"Adversarial bearish" teaches you that the opposing case was dominating
"Low confidence 32%" teaches you that the setup lacked quality across multiple factors
"Bull spacing: wait 8 bars" teaches you that signals need breathing room
After 50-100 signals in Advisory mode, you internalize the CAE's decision logic. You start seeing these factors yourself BEFORE the indicator does.
Dashboard Transparency
Most "intelligent" indicators are black boxes — you don't know how they make decisions.
BZ-CAE shows you ALL metrics in real-time:
TCS tells you trend strength
DMA tells you momentum alignment
Exhaustion tells you overextension
Adversarial shows both sides of the debate
Confidence shows composite quality
You learn to interpret market state holistically, a skill applicable to ANY trading system beyond this indicator.
Divergence Quality Education
Not all divergences are equal. BZ-CAE teaches you which conditions produce high-probability setups:
Quality divergence : Regular bullish div at a low, TCS <0.50 (weak trend), exhaustion >0.75 (overextended), positive adversarial differential, confidence >0.70
Low-quality divergence : Regular bearish div at a high, TCS >0.85 (strong uptrend), exhaustion <0.30 (not overextended), negative adversarial differential, confidence <0.40
After using the system, you can evaluate divergences manually with similar intelligence.
Risk Management Discipline
Confidence-based position sizing teaches you to adjust risk based on setup quality, not emotions:
Beginners often size all trades identically
Or worse, size UP on marginal setups to "make up" for losses
BZ-CAE forces systematic sizing: premium setups get larger size, marginal setups get smaller size
This creates a probabilistic approach where your edge compounds over time.
What This Indicator Is NOT
Complete transparency about limitations and positioning:
Not a Prediction System
BZ-CAE does not predict future prices. It identifies structural divergences (price-momentum disagreements) and assesses current market state (trend, exhaustion, adversarial conditions). It tells you WHEN conditions favor a potential reversal or continuation, not WHAT WILL HAPPEN.
Markets are probabilistic. Even premium-confidence setups fail ~30-40% of the time. The system improves your probability distribution over many trades — it doesn't eliminate risk.
Not Fully Automated
This is a decision support tool, not a trading robot. You must:
Execute trades manually based on signals
Manage positions (stops, targets, trailing)
Apply discretionary judgment (news events, liquidity, context)
Integrate with your broader strategy and risk rules
The confidence scores guide position sizing, but YOU determine final risk allocation based on your account size, risk tolerance, and portfolio context.
Not Beginner-Friendly
BZ-CAE requires understanding of:
Divergence trading concepts (regular vs hidden, reversal vs continuation)
Market state interpretation (trend vs range, momentum, exhaustion)
Basic technical analysis (pivots, support/resistance, EMAs)
Risk management fundamentals (position sizing, stops, R:R)
This is designed for intermediate to advanced traders willing to invest time learning the system. If you want "buy the arrow" simplicity, this isn't the tool.
Not a Holy Grail
There is no perfect indicator. BZ-CAE filters noise and improves signal quality significantly, but:
Losing trades are inevitable (even at 70% win rate, 30% still fail)
Market conditions change rapidly (yesterday's strong trend becomes today's chop)
Black swan events occur (fundamentals override technicals)
Execution matters (slippage, fees, emotional discipline)
The system provides an EDGE, not a guarantee. Your job is to execute that edge consistently with proper risk management over hundreds of trades.
Not Financial Advice
BZ-CAE is an educational and analytical tool. All trading decisions are your responsibility. Past performance (backtested or live) does not guarantee future results. Only risk capital you can afford to lose. Consult a licensed financial advisor for investment advice specific to your situation.
Ideal Market Conditions
Best Performance Characteristics
Liquid Instruments :
Major forex pairs (EUR/USD, GBP/USD, USD/JPY)
Large-cap stocks and index ETFs (SPY, QQQ, AAPL, MSFT)
High-volume crypto (BTC, ETH)
Major commodities (Gold, Oil, Natural Gas)
Reasoning: Clean price structure, clear pivots, meaningful oscillator behavior
Trending with Consolidations :
Markets that trend for 20-40 bars, then consolidate 10-20 bars, repeat
Creates divergences at consolidation boundaries (reversals) and within trends (continuations)
Both regular and hidden divs find opportunities
5-Minute to Daily Timeframes :
Below 5m: too much noise, false pivots, CAE metrics unstable
Above daily: too few signals, edge diminishes (fundamentals dominate)
Sweet spot: 15m to 4H for most traders
Consistent Volume and Participation :
Regular trading sessions (not holidays or thin markets)
Predictable volatility patterns
Avoid instruments with sudden gaps or circuit breakers
Challenging Conditions
Extremely Low Liquidity :
Penny stocks, exotic forex pairs, low-volume crypto
Erratic pivots, unreliable oscillator readings
CAE metrics can't assess market state properly
Very Low Timeframes (1-Minute or Below) :
Dominated by market microstructure noise
Divergences are everywhere but meaningless
CAE filtering helps but still unreliable
Extended Sideways Consolidation :
100+ bars of tight range with no clear pivots
Oscillator hugs midpoint (45-55 range)
No divergences to detect
Fundamentally-Driven Gap Markets :
Earnings releases, economic data, geopolitical events
Price gaps over stops and targets
Technical structure breaks down
Recommendation: Disable trading around known events
Calculation Methodology — Technical Depth
For users who want to understand the math:
Oscillator Computation
Each oscillator type calculates differently, but all normalize to 0-100:
RSI : ta.rsi(close, length) — Standard Relative Strength Index
Stochastic : ta.stoch(high, low, close, length) — %K calculation
CCI : (ta.cci(hlc3, length) + 100) / 2 — Normalized from -100/+100 to 0-100
MFI : ta.mfi(hlc3, length) — Volume-weighted RSI equivalent
Williams %R : ta.wpr(length) + 100 — Inverted stochastic adjusted to 0-100
Smoothing: If smoothing > 1, apply ta.sma(oscillator, smoothing)
Divergence Detection Algorithm
Identify Pivots :
Price high pivot: ta.pivothigh(high, lookback, lookforward)
Price low pivot: ta.pivotlow(low, lookback, lookforward)
Oscillator high pivot: ta.pivothigh(osc, lookback, lookforward)
Oscillator low pivot: ta.pivotlow(osc, lookback, lookforward)
Store Recent Pivots :
Maintain arrays of last 10 pivots with bar indices
When new pivot confirmed, unshift to array, pop oldest if >10
Scan for Slope Disagreements :
Loop through last 5 pivots
For each pair (current pivot, historical pivot):
Check if within max_lookback bars
Calculate slopes: (current - historical) / bars_between
Regular bearish: price_slope > 0, osc_slope < 0, |osc_slope| > min_threshold
Regular bullish: price_slope < 0, osc_slope > 0, |osc_slope| > min_threshold
Hidden bearish: price_slope < 0, osc_slope > 0, osc_slope > min_threshold
Hidden bullish: price_slope > 0, osc_slope < 0, |osc_slope| > min_threshold
Important Disclaimers and Terms
Performance Disclosure
Past performance, whether backtested or live-traded, does not guarantee future results. Markets change. What works today may not work tomorrow. Hypothetical or simulated performance results have inherent limitations and do not represent actual trading.
Risk of Loss
Trading involves substantial risk of loss. Only trade with risk capital you can afford to lose entirely. The high degree of leverage often available in trading can work against you as well as for you. Leveraged trading may result in losses exceeding your initial deposit.
Not Financial Advice
BZ-CAE is an educational and analytical tool for technical analysis. It is not financial advice, investment advice, or a recommendation to buy or sell any security or instrument. All trading decisions are your sole responsibility. Consult a licensed financial advisor for advice specific to your circumstances.
Technical Indicator Limitations
BZ-CAE is a technical analysis tool based on price and volume data. It does not account for:
Fundamental analysis (earnings, economic data, financial health)
Market sentiment and positioning
Geopolitical events and news
Liquidity conditions and market microstructure changes
Regulatory changes or exchange rules
Integrate with broader analysis and strategy. Do not rely solely on technical indicators for trading decisions.
Repainting Acknowledgment
As disclosed throughout this documentation:
Realtime mode may repaint on forming bars before confirmation (by design for preview functionality)
Confirmed mode has zero repainting (fully validated pivots only)
Choose timing mode appropriate for your use case. Understand the tradeoffs.
Testing Recommendation
ALWAYS test on demo/paper accounts before committing real capital. Validate the indicator's behavior on your specific instruments and timeframes. Learn the system thoroughly in Advisory mode before using Filtering mode.
Learning Resources :
In-indicator tooltips (hover over setting names for detailed explanations)
This comprehensive publishing statement (save for reference)
User guide in script comments (top of code)
Final Word — Philosophy of BZ-CAE
BZ-CAE is not designed to replace your judgment — it's designed to enhance it.
The indicator identifies structural inflection points (bifurcations) where price and momentum disagree. The Cognitive Engine evaluates market state to determine if this disagreement is meaningful or noise. The Adversarial model debates both sides of the trade to catch obvious bad setups. The Confidence system ranks quality so you can choose your risk appetite.
But YOU still execute. YOU still manage risk. YOU still learn from outcomes.
This is intelligence amplification, not intelligence replacement.
Use Advisory mode to learn how expert traders evaluate market state. Use Filtering mode to enforce discipline when emotions run high. Use the dashboard to develop a systematic approach to reading markets. Use confidence scores to size positions probabilistically.
The system provides an edge. Your job is to execute that edge with discipline, patience, and proper risk management over hundreds of trades.
Markets are probabilistic. No system wins every trade. But a systematic edge + disciplined execution + proper risk management compounds over time. That's the path to consistent profitability. BZ-CAE gives you the edge. The discipline and risk management are on you.
Taking you to school. — Dskyz, Trade with insight. Trade with anticipation.
Turtle System 1 (20/10) + N-Stop + MTF Table V7.2🐢 Description: Turtle System 1 (20/10) IndicatorThis indicator implements the original trading signals of the Turtle Trading System 1 based on the classic Donchian Channels. It incorporates a historically correct, volatility-based Trailing Stop (N-Stop) and a Multi-Timeframe (MTF) status dashboard. The script is written in Pine Script v6, optimized for performance and reliability.📊 Core Logic and ParametersThe system is a pure trend-following model, utilizing the more widely known, conservative parameters of the Turtle System 1:FunctionParameterValueDescriptionEntry$\text{Donchian Breakout}$$\mathbf{20}$Buy/Sell upon breaking the 20-day High/Low.Exit (Turtle)$\text{Donchian Breakout}$$\mathbf{10}$Close the position upon breaking the 10-day Low/High.Volatility$\mathbf{N}$ (ATR Period)$\mathbf{20}$Calculation of market volatility using the Average True Range (ATR).Stop-LossMultiplier$\mathbf{2.0} BER:SETS the initial and Trailing Stop at $\mathbf{2N}$.🛠️ Key Technical Features1. Original Turtle Trailing Stop (Section 4)The stop-loss mechanism is implemented with the historically accurate Turtle Trailing Logic. The stop is not aggressively tied to the current candle's low/high, which often causes premature exits. Instead, the stop only trails in the direction of the trend, maximizing the previous stop price against the new calculated $\text{Close} \pm 2N$:$$\text{New Trailing Stop} = \text{max}(\text{Previous Stop}, \text{Close} \pm (2 \times N))$$2. Reliable Multi-Timeframe (MTF) Status (Section 6)The indicator features a robust MTF status table.Purpose: It calculates and persistently stores the Turtle System 1 status (LONG=1, SHORT=-1, FLAT=0) for various timeframes (1H, 4H, 8H, 1D, and 1W).Method: It uses global var int variables combined with request.security(), ensuring the status is accurately maintained and updated across different bars and timeframes, providing a reliable higher-timeframe context.3. VisualizationsChannels: The 20-period (Entry) and 10-period (Exit) Donchian Channels are plotted.Stop Line: The dynamic $\mathbf{2N}$ Trailing Stop is visible as a distinct line.Signals: plotshape markers indicate Entry and Exit.MTF Table: A clean, color-coded status summary is displayed in the upper right corner.
Turtle System 2 (55/20) + N-Stop + MTF Table V7.2🐢 Description: Turtle System 2 (55/20) IndicatorThis indicator implements the trading signals of the Turtle Trading System 2 based on the classic Donchian Channels, supplemented by a historically correct, volatility-based Trailing Stop (N-Stop) and a Multi-Timeframe (MTF) status overview. The script was developed in Pine Script v6 and is optimized for performance and robustness.📊 Core Logic and ParametersThe indicator is based on the rule-based trend-following system developed by Richard Dennis and William Eckhardt, utilizing the more aggressive Entry/Exit parameters of System 2:FunctionParameterValueDescriptionEntry$\text{Donchian Breakout}$$\mathbf{55}$Buy/Sell upon breaking the 55-day High/Low.Exit (Turtle)$\text{Donchian Breakout}$$\mathbf{20}$Close the position upon breaking the 20-day Low/High.Volatility$\mathbf{N}$ (ATR Period)$\mathbf{20}$Calculation of market volatility using the Average True Range (ATR).Stop-LossMultiplier$\mathbf{2.0} BER:SETS the initial and Trailing Stop at $\mathbf{2N}$.🛠️ Technical Implementation1. Correct Trailing Stop (Section 4)In contrast to many flawed implementations, the Trailing Stop is implemented here according to the Original Turtle Logic. The stop price (current_stop_price) is not aggressively tied to the current low or high. Instead, at the close of each bar, it is only trailed in the direction of the trade (math.max for long positions) based on the formula:$$\text{New Trailing Stop} = \text{max}(\text{Previous Stop}, \text{Close} \pm (2 \times N))$$This ensures the stop is only adjusted upon sustained positive movement and is not prematurely triggered by short-term, deep price shadows.2. Reliable Multi-Timeframe (MTF) Logic (Section 6)The MTF section utilizes global var int variables (mtf_status_1h, mtf_status_D, etc.) in conjunction with the request.security() function.Purpose: Calculates and persistently stores the current Turtle System 2 status (LONG=1, SHORT=-1, FLAT=0) for the timeframes 1H, 4H, 8H, 1D, and 1W.Advantage: By persistently storing the status using the var variables, the critical error of single-update status is eliminated. The states shown in the table are reliable and accurately reflect the Turtle System's position status on the respective timeframes.3. Visual ComponentsDonchian Channels: The entry (55-period) and exit (20-period) channels are drawn with color highlighting.N-Stop Line: The dynamically calculated Trailing Stop ($\mathbf{2N}$) is displayed as a magenta line.Visual Signals: plotshape markers indicate Entry and Exit points.MTF Table: A compact status summary with color coding (Green/Red/Gray) for the higher timeframes is displayed in the upper right corner.
Williams Fractals Tiny IconsA version of Williams Fractals but the script has been altered to make the icons smaller. Use these for trailing stop loss, adding to positions, or entering a position late.
Great Expectations [LucF]Great Expectations helps traders answer the question: What is possible? It is a powerful question, yet exploration of the unknown always entails risk. A more complete set of questions better suited to traders could be:
What opportunity exists from any given point on a chart?
What portion of this opportunity can be realistically captured?
What risk will be incurred in trying to do so, and how long will it take?
Great Expectations is the result of an exploration of these questions. It is a trade simulator that generates visual and quantitative information to help strategy modelers visually identify and analyse areas of optimal expectation on charts, whether they are designing automated or discretionary strategies.
WARNING: Great Expectations is NOT an indicator that helps determine the current state of a market. It works by looking at points in the past from which the future is already known. It uses one definition of repainting extensively (i.e. it goes back in the past to print information that could not have been know at the time). Repainting understood that way is in fact almost all the indicator does! —albeit for what I hope is a noble cause. The indicator is of no use whatsoever in analyzing markets in real-time. If you do not understand what it does, please stay away!
This is an indicator—not a strategy that uses TradingView’s backtesting engine. It works by simulating trades, not unlike a backtest, but with the crucial difference that it assumes a trade (either long or short) is entered on all bars in the historic sample. It walks forward from each bar and determines possible outcomes, gathering individual trade statistics that in turn generate precious global statistics from all outcomes tested on the chart.
Great Expectations provides numbers summarizing trade results on all simulations run from the chart. Those numbers cannot be compared to backtest-produced numbers since all non-filtered bars are examined, even if an entry was taken on the bar immediately preceding the current one, which never happens in a backtest. This peculiarity does NOT invalidate Great Expectations calculations; it just entails that results be considered under a different light. Provided they are evaluated within the indicator’s context, they can be useful—sometimes even more than backtesting results, e.g. in evaluating the impact of parameter-fitting or variations in entry, exit or filtering strats.
Traders and strategy modelers are creatures of hope often suffering from blurred vision; my hope is that Great Expectations will help them appraise the validity of their setup and strat intuitions in a realistic fashion, preventing confirmation bias from obstructing perspective—and great expectations from turning into financial great deceptions.
USE CASES
You’ve identified what looks like a promising setup on other indicators. You load Great Expectations on the chart and evaluate if its high-expectation areas match locations where your setup’s conditions occur. Unless today is your lucky day, chances are the indicator will help you realize your setup is not as promising as you had hoped.
You want to get a rough estimate of the optimal trade duration for a chart and you don’t mind using the entry and exit strategies provided with the indicator. You use the trade length readouts of the indicator.
You’re experimenting with a new stop strategy and want to know how long it will keep you in trades, on average. You integrate your stop strategy in the indicator’s code and look at the average trade length it produces and the TST ratio to evaluate its performance.
You have put together your own entry and exit criteria and are looking for a filter that will help you improve backtesting results. You visually ascertain the suitability of your filter by looking at its results on the charts with great Expectations, to see if your filter is choosing its areas correctly.
You have a strategy that shows backtested trades on your chart. Great Expectations can help you evaluate how well your strategy is benefitting from high-opportunity areas while avoiding poor expectation spots.
You want more complete statistics on your set of strategies than what backtesting will provide. You use Great Expectations, knowing that it tests all bars in the sample that correspond to your criteria, as opposed to backtesting results which are limited to a subset of all possible entries.
You want to fool your friends into thinking you’ve designed the holy grail of indicators, something that identifies optimal opportunities on any chart; you show them the P&L cloud.
FEATURES
For one trade
At any given point on the chart, assuming a trade is entered there, Great Expectations shows you information specific to that trade simulation both on the chart and in the Data Window.
The chart can display:
the P & L Cloud which shows whether the trade ended profitably or not, and by how much,
the Opportunity & Risk Cloud which the maximum opportunity and risk the simulation encountered. When superimposed over the P & L cloud, you will see what I call the managed opportunity and risk, i.e the portion of maximum opportunity that was captured and the portion of the maximum risk that was incurred,
the target and if it was reached,
a background that uses a gradient to show different levels of trade length, P&L or how frequently the target was reached during simulation.
The Data Window displays more than 40 values on individual trades and global results. For any given trade you will know:
Entry/Exit levels, including slippage impact,
It’s outcome and duration,
P/L achieved,
The fraction of the maximum opportunity/risk managed by the trade.
For all trades
After going through all the possible trades on the chart, the indicator will provide you with a rare view of all outcomes expressed with the P&L cloud, which allows us to instantly see the most/least profitable areas of a chart using trade data as support, while also showing its relationship with the opportunity/risk encountered during the simulation. The difference between the two clouds is the managed opportunity and risk.
The Data Window will present you with numbers which we will go through later. Some of them are: average stop size, P/L, win rate, % opportunity managed, trade lengths for different types of trade outcomes and the TST (Target:Stop Travel) ratio.
Let’s see Great Expectations in action… and remember to open your Data Window!
INPUTS
Trade direction : You must first choose if you wish to look at long or short trades. Because of the way the indicator works and the amount of visual information on the chart, it is only practical to look at one type of trades at a time. The default is Longs.
Maximum trade Length (MaxL) : This is the maximum walk forward distance the simulator will go in analyzing outcomes from any given point in the past. It also determines the size of the dead zone among the chart’s last bars. A red background line identifies the beginning of the dead zone for which not enough bars have elapsed to analyze outcomes for the maximum trade length defined. If an ATR-based entry stop is used, that length is added to the wait time before beginning simulations, so that the first entry starts with a clean ATR value. On a sample of around 16000 bars, my tests show that the indicator runs into server errors at lengths of around 290, i.e. having completed ~4,6M simulation loop iterations. That is way too high a length anyways; 100 will usually be amply enough to ring out all the possibilities out of a simulation, and on shorter time frames, 30 can be enough. While making it unduly small will prevent simulations of expressing the market’s potential, the less you use, the faster the indicator will run. The default is 40.
Unrealized P&L base at End of Trade (EOT) : When a simulation ends and the trade is still open, we calculate unrealized P&L from an exit order executed from either the last in-trade stop on the previous bar, or the close of the last bar. You can readily see the impact of this selection on the chart, with the P&L cloud. The default is on the close.
Display : The check box besides the title does nothing.
Show target : Shows a green line displaying the trade’s target expressed as a multiple of X, i.e. the amplitude of the entry stop. I call this value “X” and use it as a unit to express profit and loss on a trade (some call it “R”). The line is highlighted for trades where the close reached the target during the trade, whether the trade ended in profit or loss. This is also where you specify the multiple of X you wish to use in calculating targets. The multiple is used even if targets are not displayed.
Show P&L Cloud : The cloud allows traders to see right away the profitable areas of the chart. The only line printed with the cloud is the “end of trade line” (EOT). The EOT line is the only way one can see the level where a trade ended on the chart (in the Data Window you can see it as the “Exit Fill” value). The EOT level for the trade determines if the trade ended in a profit or a loss. Its value represents one of the following:
- fill from order executed at close of bar where stop is breached during trade (which produces “Realized P/L”),
- simulation of a fill pseudo-fill at the user-defined EOT level (last close or stop level) if the trade runs its course through MaxL bars without getting stopped (producing Unrealized P/L).
The EOT line and the cloud fill print in green when the trade’s outcome is profitable and in red when it is not. If the trade was closed after breaching the stop, the line appears brighter.
Show Opportunity&Risk Cloud : Displays the maximum opportunity/risk that was present during the trade, i.e. the maximum and minimum prices reached.
Background Color Scheme : Allows you to choose between 3 different color schemes for the background gradients, to accommodate different types of chart background/candles. Select “None” if you don’t want a background.
Background source : Determines what value will be used to generate the different intensities of the gradient. You can choose trade length (brighter is shorter), Trade P&L (brighter is higher) or the number of times the target was reached during simulation (brighter is higher). The default is Trade Length.
Entry strat : The check box besides the title does nothing. The default strat is All bars, meaning a trade will be simulated from all bars not excluded by the filters where a MaxL bars future exists. For fun, I’ve included a pseudo-random entry strat (an indirect way of changing the seed is to vary the starting date of the simulation).
Show Filter State : Displays areas where the combination of filters you have selected are allowing entries. Filtering occurs as per your selection(s), whether the state is displayed or not. The effect of multiple selections is additive. The filters are:
1. Bar direction: Longs will only be entered if close>open and vice versa.
2. Rising Volume: Applies to both long and shorts.
3. Rising/falling MA of the length you choose over the number of bars you choose.
4. Custom indicator: You can feed your own filtering signal through this from another indicator. It must produce a signal of 1 to allow long entries and 0 to allow shorts.
Show Entry Stops :
1. Multiple of user-defined length ATR.
2. Fixed percentage.
3. Fixed value.
All entry stops are calculated using the entry fill price as a reference. The fill price is calculated from the current bar’s open, to which slippage is added if configured. This simulates the case where the strategy issued the entry signal on the previous bar for it to be executed at the next bar’s open.
The entry stop remains active until the in-trade stop becomes the more aggressive of the two stops. From then on, the entry stop will be ignored, unless a bar close breaches the in-trade stop, in which case the stop will be reset with a new entry stop and the process repeats.
Show In-trade stops : Displays in bright red the selected in-trade stop (be sure to read the note in this section about them).
1. ATR multiple: added/subtracted from the average of the two previous bars minimum/maximum of open/close.
2. A trailing stop with a deviation expressed as a multiple of entry stop (X).
3. A fixed percentage trailing stop.
Trailing stops deviations are measured from the highest/lowest high/low reached during the trade.
Note: There is a twist with the in-trade stops. It’s that for any given bar, its in-trade stop can hold multiple values, as each successive pass of the advancing simulation loops goes over it from a different entry points. What is printed is the stop from the loop that ended on that bar, which may have nothing to do with other instances of the trade’s in-trade stop for the same bar when visited from other starting points in previous simulations. There is just no practical way to print all stop values that were used for any given bar. While the printed entry stops are the actual ones used on each bar, the in-trade stops shown are merely the last instance used among many.
Include Slippage : if checked, slippage will be added/subtracted from order price to yield the fill price. Slippage is in percentage. If you choose to include slippage in the simulations, remember to adjust it by considering the liquidity of the markets and the time frame you’ll be analyzing.
Include Fees : if checked, fees will be subtracted/added to both realized an unrealized trade profits/losses. Fees are in percentage. The default fees work well for crypto markets but will need adjusting for others—especially in Forex. Remember to modify them accordingly as they can have a major impact on results. Both fees and slippage are included to remind us of their importance, even if the global numbers produced by the indicator are not representative of a real trading scenario composed of sequential trades.
Date Range filtering : the usual. Just note that the checkbox has to be selected for date filtering to activate.
DATA WINDOW
Most of the information produced by this indicator is made available in the Data Window, which you bring up by using the icon below the Watchlist and Alerts buttons at the right of the TV UI. Here’s what’s there.
Some of the information presented in the Data Window is standard trade data; other values are not so standard; e. g. the notions of managed opportunity and risk and Target:Stop Travel ratio. The interplay between all the values provided by Great Expectations is inherently complex, even for a static set of entry/filter/exit strats. During the constant updating which the habitual process of progressive refinement in building strategies that is the lot of strategy modelers entails, another level of complexity is no doubt added to the analysis of this indicator’s values. While I don’t want to sound like Wolfram presenting A New Kind of Science , I do believe that if you are a serious strategy modeler and spend the time required to get used to using all the information this indicator makes available, you may find it useful.
Trade Information
Entry Order : This is the open of the bar where simulation starts. We suppose that an entry signal was generated at the previous bar.
Entry Fill (including slip.) : The actual entry price, including slippage. This is the base price from which other values will be calculated.
Exit Order : When a stop is breached, an exit order is executed from the close of the bar that breached the stop. While there is no “In-trade stop” value included in the Data Window (other than the End of trade Stop previously discussed), this “Exit Order” value is how we can know the level where the trade was stopped during the simulation. The “Trade Length” value will then show the bar where the stop was breached.
Exit Fill (including slip.) : When the exit order is simulated, slippage is added to the order level to create the fill.
Chart: Target : This is the target calculated at the beginning of the simulation. This value also appear on the chart in teal. It is controlled by the multiple of X defined under the “Show Target” checkbox in the Inputs.
Chart: Entry Stop : This value also appears on the chart (the red dots under points where a trade was simulated). Its value is controlled by the Entry Strat chosen in the Inputs.
X (% Fill, including Fees) and X (currency) : This is the stop’s amplitude (Entry Fill – Entry Stop) + Fees. It represents the risk incurred upon entry and will be used to express P&L. We will show R expressed in both a percentage of the Entry Fill level (this value), and currency (the next value). This value represents the risk in the risk:reward ratio and is considered to be a unit of 1 so that RR can be expressed as a single value (i.e. “2” actually meaning “1:2”).
Trade Length : If trade was stopped, it’s the number of bars elapsed until then. The trade is then considered “Closed”. If the trade ends without being stopped (there is no profit-taking strat implemented, so the stop is the only exit strat), then the trade is “Open”, the length is MaxL and it will show in orange. Otherwise the value will print in green/red to reflect if the trade is winning/losing.
P&L (X) : The P&L of the trade, expressed as a multiple of X, which takes into account fees paid at entry and exit. Given our default target setting at 2 units of “X”, a trade that closes at its target will have produced a P&L of +2.0, i.e. twice the value of X (not counting fees paid at exit ). A trade that gets stopped late 50% further that the entry stop’s level will produce a P&L of -1.5X.
P&L (currency, including Fees) : same value as above, but expressed in currency.
Target first reached at bar : If price closed above the target during the trade (even if it occurs after the trade was stopped), this will show when. This value will be used in calculating our TST ratio.
Times Stop/Target reached in sim. : Includes all occurrences during the complete simulation loop.
Opportunity (X) : The highest/lowest price reached during a simulation, i.e. the maximum opportunity encountered, whether the trade was previously stopped or not, expressed as a multiple of X.
Risk (X) : The lowest/highest price reached during a simulation, i.e. the maximum risk encountered, whether the trade was previously stopped or not, expressed as a multiple of X.
Risk:Opportunity : The greater this ratio, the greater Opportunity is, compared to Risk.
Managed Opportunity (%) : The portion of Opportunity that was captured by the highest/low stop position, even if it occurred after a previous stop closed the trade.
Managed Risk (%) : The portion of risk that was protected by the lowest/highest stop position, even if it occurred after a previous stop closed the trade. When this value is greater than 100%, it means the trade’s stop is protecting more than the maximum risk, which is frequent. You will, however, never see close to those values for the Managed Opportunity value, since the stop would have to be higher than the Maximum opportunity. It is much easier to alleviate the risk than it is to lock in profits.
Managed Risk:Opportunity : The ratio of the two preceding values.
Managed Opp. vs. Risk : The Managed Opportunity minus the Managed Risk. When it is negative, which is most often is, it means your strat is protecting a greater portion of the risk than it captures opportunity.
Global Numbers
Win Rate(%) : Percentage of winning trades over all entries. Open trades are considered winning if their last stop/close (as per user selection) locks in profits.
Avg X%, Avg X (currency) : Averages of previously described values:.
Avg Profitability/Trade (APPT) : This measures expectation using: Average Profitability Per Trade = (Probability of Win × Average Win) − (Probability of Loss × Average Loss) . It quantifies the average expectation/trade, which RR alone can’t do, as the probabilities of each outcome (win/lose) must also be used to calculate expectancy. The APPT combine the RR with the win rate to yield the true expectancy of a strategy. In my usual way of expressing risk with X, APPT is the equivalent of the average P&L per trade expressed in X. An APPT of -1.5 means that we lose on average 1.5X/trade.
Equity (X), Equity (currency) : The cumulative result of all trade outcomes, expressed as a multiple of X. Multiplied by the Average X in currency, this yields the Equity in currency.
Risk:Opportunity, Managed Risk:Opportunity, Managed Opp. vs. Risk : The global values of the ones previously described.
Avg Trade Length (TL) : One of the most important values derived by going through all the simulations. Again, it is composed of either the length of stopped trades, or MaxL when the trade isn’t stopped (open). This value can help systems modelers shape the characteristics of the components they use to build their strategies.
Avg Closed Win TL and Avg Closed Lose TL : The average lengths of winning/losing trades that were stopped.
Target reached? Avg bars to Stop and Target reached? Avg bars to Target : For the trades where the target was reached at some point in the simulation, the number of bars to the first point where the stop was breached and where the target was reached, respectively. These two values are used to calculate the next value.
TST (Target:Stop Travel Ratio) : This tracks the ratio between the two preceding values (Bars to first stop/Bars to first target), but only for trades where the target was reached somewhere in the loop. A ratio of 2 means targets are reached twice as fast as stops.
The next values of this section are counts or percentages and are self-explanatory.
Chart Plots
Contains chart plots of values already describes.
NOTES
Optimization/Overfitting: There is a fine line between optimizing and overfitting. Tools like this indicator can lead unsuspecting modelers down a path of overfitting that often turns strategies into over-specialized beasts that do not perform elegantly when confronted to the real-world. Proven testing strategies like walk forward analysis will go a long way in helping modelers alleviate this risk.
Input tuning: Because the results generated by the indicator will vary with the parameters used in the active entry, filtering and exit strats, it’s important to realize that although it may be fun at first, just slapping the default settings on a chart and time frame will not yield optimal nor reliable results. While using ATR as often as possible (as I do in this indicator) is a good way to make strat parametrization adaptable, it is not a foolproof solution.
There is no data for the last MaxL bars of the chart, since not enough trade future has elapsed to run a simulation from MaxL bars back.
Modifying the code: I have tried to structure the code modularly, even if that entails a larger code base, so that you can adapt it to your needs. I’ve included a few token components in each of the placeholders designed for entry strategies, filters, entry stops and in-trade stops. This will hopefully make it easier to add your own. In the same spirit, I have also commented liberally.
You will find in the code many instances of standard trade management tasks that can be lifted to code TV strategies where, as I do in mine, you manage everything yourself and don’t rely on built-in Pine strategy functions to act on your trades.
Enjoy!
THANKS
To @scarf who showed me how plotchar() could be used to plot values without ruining scale.
To @glaz for the suggestion to include a Chandelier stop strat; I will.
To @simpelyfe for the idea of using an indicator input for the filters (if some day TV lets us use more than one, it will be useful in other modules of the indicator).
To @RicardoSantos for the random generator used in the random entry strat.
To all scripters publishing open source on TradingView; their code is the best way to learn.
To my trading buddies Irving and Bruno; who showed me way back how pro traders get it done.
Luxy Momentum, Trend, Bias and Breakout Indicators V7
TABLE OF CONTENTS
This is Version 7 (V7) - the latest and most optimized release. If you are using any older versions (V6, V5, V4, V3, etc.), it is highly recommended to replace them with V7.
Why This Indicator is Different
Who Should Use This
Core Components Overview
The UT Bot Trading System
Understanding the Market Bias Table
Candlestick Pattern Recognition
Visual Tools and Features
How to Use the Indicator
Performance and Optimization
FAQ
---
### CREDITS & ATTRIBUTION
This indicator implements proven trading concepts using entirely original code developed specifically for this project.
### CONCEPTUAL FOUNDATIONS
• UT Bot ATR Trailing System
- Original concept by @QuantNomad: (search "UT-Bot-Strategy"
- Our version is a complete reimplementation with significant enhancements:
- Volume-weighted momentum adjustment
- Composite stop loss from multiple S/R layers
- Multi-filter confirmation system (swing, %, 2-bar, ZLSMA)
- Full integration with multi-timeframe bias table
- Visual audit trail with freeze-on-touch
- NOTE: No code was copied - this is a complete reimplementation with enhancements.
• Standard Technical Indicators (Public Domain Formulas):
- Supertrend: ATR-based trend calculation with custom gradient fills
- MACD: Gerald Appel's formula with separation filters
- RSI: J. Welles Wilder's formula with pullback zone logic
- ADX/DMI: Custom trend strength formula inspired by Wilder's directional movement concept, reimplemented with volume weighting and efficiency metrics
- ZLSMA: Zero-lag formula enhanced with Hull MA and momentum prediction
### Custom Implementations
- Trend Strength: Inspired by Wilder's ADX concept but using volume-weighted pressure calculation and efficiency metrics (not traditional +DI/-DI smoothing)
- All code implementations are original
### ORIGINAL FEATURES (70%+ of codebase)
- Multi-Timeframe Bias Table with live updates
- Risk Management System (R-multiple TPs, freeze-on-touch)
- Opening Range Breakout tracker with session management
- Composite Stop Loss calculator using 6+ S/R layers
- Performance optimization system (caching, conditional calcs)
- VIX Fear Index integration
- Previous Day High/Low auto-detection
- Candlestick pattern recognition with interactive tooltips
- Smart label and visual management
- All UI/UX design and table architecture
### DEVELOPMENT PROCESS
**AI Assistance:** This indicator was developed over 2+ months with AI assistance (ChatGPT/Claude) used for:
- Writing Pine Script code based on design specifications
- Optimizing performance and fixing bugs
- Ensuring Pine Script v6 compliance
- Generating documentation
**Author's Role:** All trading concepts, system design, feature selection, integration logic, and strategic decisions are original work by the author. The AI was a coding tool, not the system designer.
**Transparency:** We believe in full disclosure - this project demonstrates how AI can be used as a powerful development tool while maintaining creative and strategic ownership.
---
1. WHY THIS INDICATOR IS DIFFERENT
Most traders use multiple separate indicators on their charts, leading to cluttered screens, conflicting signals, and analysis paralysis. The Suite solves this by integrating proven technical tools into a single, cohesive system.
Key Advantages:
All-in-One Design: Instead of loading 5-10 separate indicators, you get everything in one optimized script. This reduces chart clutter and improves TradingView performance.
Multi-Timeframe Bias Table: Unlike standard indicators that only show the current timeframe, the Bias Table aggregates trend signals across multiple timeframes simultaneously. See at a glance whether 1m, 5m, 15m, 1h are aligned bullish or bearish - no more switching between charts.
Smart Confirmations: The indicator doesn't just give signals - it shows you WHY. Every entry has multiple layers of confirmation (MA cross, MACD momentum, ADX strength, RSI pullback, volume, etc.) that you can toggle on/off.
Dynamic Stop Loss System: Instead of static ATR stops, the SL is calculated from multiple support/resistance layers: UT trailing line, Supertrend, VWAP, swing structure, and MA levels. This creates more intelligent, price-action-aware stops.
R-Multiple Take Profits: Built-in TP system calculates targets based on your initial risk (1R, 1.5R, 2R, 3R). Lines freeze when touched with visual checkmarks, giving you a clean audit trail of partial exits.
Educational Tooltips Everywhere: Every single input has detailed tooltips explaining what it does, typical values, and how it impacts trading. You're not guessing - you're learning as you configure.
Performance Optimized: Smart caching, conditional calculations, and modular design mean the indicator runs fast despite having 15+ features. Turn off what you don't use for even better performance.
No Repainting: All signals respect bar close. Alerts fire correctly. What you see in history is what you would have gotten in real-time.
What Makes It Unique:
Integrated UT Bot + Bias Table: No other indicator combines UT Bot's ATR trailing system with a live multi-timeframe dashboard. You get precision entries with macro trend context.
Candlestick Pattern Recognition with Interactive Tooltips: Patterns aren't just marked - hover over any emoji for a full explanation of what the pattern means and how to trade it.
Opening Range Breakout Tracker: Built-in ORB system for intraday traders with customizable session times and real-time status updates in the Bias Table.
Previous Day High/Low Auto-Detection: Automatically plots PDH/PDL on intraday charts with theme-aware colors. Updates daily without manual input.
Dynamic Row Labels in Bias Table: The table shows your actual settings (e.g., "EMA 10 > SMA 20") not generic labels. You know exactly what's being evaluated.
Modular Filter System: Instead of forcing a fixed methodology, the indicator lets you build your own strategy. Start with just UT Bot, add filters one at a time, test what works for your style.
---
2. WHO WHOULD USE THIS
Designed For:
Intermediate to Advanced Traders: You understand basic technical analysis (MAs, RSI, MACD) and want to combine multiple confirmations efficiently. This isn't a "one-click profit" system - it's a professional toolkit.
Multi-Timeframe Traders: If you trade one asset but check multiple timeframes for confirmation (e.g., enter on 5m after checking 15m and 1h alignment), the Bias Table will save you hours every week.
Trend Followers: The indicator excels at identifying and following trends using UT Bot, Supertrend, and MA systems. If you trade breakouts and pullbacks in trending markets, this is built for you.
Intraday and Swing Traders: Works equally well on 5m-1h charts (day trading) and 4h-D charts (swing trading). Scalpers can use it too with appropriate settings adjustments.
Discretionary Traders: This isn't a black-box system. You see all the components, understand the logic, and make final decisions. Perfect for traders who want tools, not automation.
Works Across All Markets:
Stocks (US, international)
Cryptocurrency (24/7 markets supported)
Forex pairs
Indices (SPY, QQQ, etc.)
Commodities
NOT Ideal For :
Complete Beginners: If you don't know what a moving average or RSI is, start with basics first. This indicator assumes foundational knowledge.
Algo Traders Seeking Black Box: This is discretionary. Signals require context and confirmation. Not suitable for blind automated execution.
Mean-Reversion Only Traders: The indicator is trend-following at its core. While VWAP bands support mean-reversion, the primary methodology is trend continuation.
---
3. CORE COMPONENTS OVERVIEW
The indicator combines these proven systems:
Trend Analysis:
Moving Averages: Four customizable MAs (Fast, Medium, Medium-Long, Long) with six types to choose from (EMA, SMA, WMA, VWMA, RMA, HMA). Mix and match for your style.
Supertrend: ATR-based trend indicator with unique gradient fill showing trend strength. One-sided ribbon visualization makes it easier to see momentum building or fading.
ZLSMA : Zero-lag linear-regression smoothed moving average. Reduces lag compared to traditional MAs while maintaining smooth curves.
Momentum & Filters:
MACD: Standard MACD with separation filter to avoid weak crossovers.
RSI: Pullback zone detection - only enter longs when RSI is in your defined "buy zone" and shorts in "sell zone".
ADX/DMI: Trend strength measurement with directional filter. Ensures you only trade when there's actual momentum.
Volume Filter: Relative volume confirmation - require above-average volume for entries.
Donchian Breakout: Optional channel breakout requirement.
Signal Systems:
UT Bot: The primary signal generator. ATR trailing stop that adapts to volatility and gives clear entry/exit points.
Base Signals: MA cross system with all the above filters applied. More conservative than UT Bot alone.
Market Bias Table: Multi-timeframe dashboard showing trend alignment across 7 timeframes plus macro bias (3-day, weekly, monthly, quarterly, VIX).
Candlestick Patterns: Six major reversal patterns auto-detected with interactive tooltips.
ORB Tracker: Opening range high/low with breakout status (intraday only).
PDH/PDL: Previous day levels plotted automatically on intraday charts.
VWAP + Bands : Session-anchored VWAP with up to three standard deviation band pairs.
---
4. THE UT BOT TRADING SYSTEM
The UT Bot is the heart of the indicator's signal generation. It's an advanced ATR trailing stop that adapts to market volatility.
Why UT Bot is Superior to Fixed Stops:
Traditional ATR stops use a fixed multiplier (e.g., "stop = entry - 2×ATR"). UT Bot is smarter:
It TRAILS the stop as price moves in your favor
It WIDENS during high volatility to avoid premature stops
It TIGHTENS during consolidation to lock in profits
It FLIPS when price breaks the trailing line, signaling reversals
Visual Elements You'll See:
Orange Trailing Line: The actual UT stop level that adapts bar-by-bar
Buy/Sell Labels: Aqua triangle (long) or orange triangle (short) when the line flips
ENTRY Line: Horizontal line at your entry price (optional, can be turned off)
Suggested Stop Loss: A composite SL calculated from multiple support/resistance layers:
- UT trailing line
- Supertrend level
- VWAP
- Swing structure (recent lows/highs)
- Long-term MA (200)
- ATR-based floor
Take Profit Lines: TP1, TP1.5, TP2, TP3 based on R-multiples. When price touches a TP, it's marked with a checkmark and the line freezes for audit trail purposes.
Status Messages: "SL Touched ❌" or "SL Frozen" when the trade leg completes.
How UT Bot Differs from Other ATR Systems:
Multiple Filters Available: You can require 2-bar confirmation, minimum % price change, swing structure alignment, or ZLSMA directional filter. Most UT implementations have none of these.
Smart SL Calculation: Instead of just using the UT line as your stop, the indicator suggests a better SL based on actual support/resistance. This prevents getting stopped out by wicks while keeping risk controlled.
Visual Audit Trail: All SL/TP lines freeze when touched with clear markers. You can review your trades weeks later and see exactly where entries, stops, and targets were.
Performance Options: "Draw UT visuals only on bar close" lets you reduce rendering load without affecting logic or alerts - critical for slower machines or 1m charts.
Trading Logic:
UT Bot flips direction (Buy or Sell signal appears)
Check Bias Table for multi-timeframe confirmation
Optional: Wait for Base signal or candlestick pattern
Enter at signal bar close or next bar open
Place stop at "Suggested Stop Loss" line
Scale out at TP levels (TP1, TP2, TP3)
Exit remaining position on opposite UT signal or stop hit
---
5. UNDERSTANDING THE MARKET BIAS TABLE
This is the indicator's unique multi-timeframe intelligence layer. Instead of looking at one chart at a time, the table aggregates signals across seven timeframes plus macro trend bias.
Why Multi-Timeframe Analysis Matters:
Professional traders check higher and lower timeframes for context:
Is the 1h uptrend aligning with my 5m entry?
Are all short-term timeframes bullish or just one?
Is the daily trend supportive or fighting me?
Doing this manually means opening multiple charts, checking each indicator, and making mental notes. The Bias Table does it automatically in one glance.
Table Structure:
Header Row:
On intraday charts: 1m, 5m, 15m, 30m, 1h, 2h, 4h (toggle which ones you want)
On daily+ charts: D, W, M (automatic)
Green dot next to title = live updating
Headline Rows - Macro Bias:
These show broad market direction over longer periods:
3 Day Bias: Trend over last 3 trading sessions (uses 1h data)
Weekly Bias: Trend over last 5 trading sessions (uses 4h data)
Monthly Bias: Trend over last 30 daily bars
Quarterly Bias: Trend over last 13 weekly bars
VIX Fear Index: Market regime based on VIX level - bullish when low, bearish when high
Opening Range Breakout: Status of price vs. session open range (intraday only)
These rows show text: "BULLISH", "BEARISH", or "NEUTRAL"
Indicator Rows - Technical Signals:
These evaluate your configured indicators across all active timeframes:
Fast MA > Medium MA (shows your actual MA settings, e.g., "EMA 10 > SMA 20")
Price > Long MA (e.g., "Price > SMA 200")
Price > VWAP
MACD > Signal
Supertrend (up/down/neutral)
ZLSMA Rising
RSI In Zone
ADX ≥ Minimum
These rows show emojis: GREEB (bullish), RED (bearish), GRAY/YELLOW (neutral/NA)
AVG Column:
Shows percentage of active timeframes that are bullish for that row. This is the KEY metric:
AVG > 70% = strong multi-timeframe bullish alignment
AVG 40-60% = mixed/choppy, no clear trend
AVG < 30% = strong multi-timeframe bearish alignment
How to Use the Table:
For a long trade:
Check AVG column - want to see > 60% ideally
Check headline bias rows - want to see BULLISH, not BEARISH
Check VIX row - bullish market regime preferred
Check ORB row (intraday) - want ABOVE for longs
Scan indicator rows - more green = better confirmation
For a short trade:
Check AVG column - want to see < 40% ideally
Check headline bias rows - want to see BEARISH, not BULLISH
Check VIX row - bearish market regime preferred
Check ORB row (intraday) - want BELOW for shorts
Scan indicator rows - more red = better confirmation
When AVG is 40-60%:
Market is choppy, mixed signals. Either stay out or reduce position size significantly. These are low-probability environments.
Unique Features:
Dynamic Labels: Row names show your actual settings (e.g., "EMA 10 > SMA 20" not generic "Fast > Slow"). You know exactly what's being evaluated.
Customizable Rows: Turn off rows you don't care about. Only show what matters to your strategy.
Customizable Timeframes: On intraday charts, disable 1m or 4h if you don't trade them. Reduces calculation load by 20-40%.
Automatic HTF Handling: On Daily/Weekly/Monthly charts, the table automatically switches to D/W/M columns. No configuration needed.
Performance Smart: "Hide BIAS table on 1D or above" option completely skips all table calculations on higher timeframes if you only trade intraday.
---
6. CANDLESTICK PATTERN RECOGNITION
The indicator automatically detects six major reversal patterns and marks them with emojis at the relevant bars.
Why These Six Patterns:
These are the most statistically significant reversal patterns according to trading literature:
High win rate when appearing at support/resistance
Clear visual structure (not subjective)
Work across all timeframes and assets
Studied extensively by institutions
The Patterns:
Bullish Patterns (appear at bottoms):
Bullish Engulfing: Green candle completely engulfs prior red candle's body. Strong reversal signal.
Hammer: Small body with long lower wick (at least 2× body size). Shows rejection of lower prices by buyers.
Morning Star: Three-candle pattern (large red → small indecision → large green). Very strong bottom reversal.
Bearish Patterns (appear at tops):
Bearish Engulfing: Red candle completely engulfs prior green candle's body. Strong reversal signal.
Shooting Star: Small body with long upper wick (at least 2× body size). Shows rejection of higher prices by sellers.
Evening Star: Three-candle pattern (large green → small indecision → large red). Very strong top reversal.
Interactive Tooltips:
Unlike most pattern indicators that just draw shapes, this one is educational:
Hover your mouse over any pattern emoji
A tooltip appears explaining: what the pattern is, what it means, when it's most reliable, and how to trade it
No need to memorize - learn as you trade
Noise Filter:
"Min candle body % to filter noise" setting prevents false signals:
Patterns require minimum body size relative to price
Filters out tiny candles that don't represent real buying/selling pressure
Adjust based on asset volatility (higher % for crypto, lower for low-volatility stocks)
How to Trade Patterns:
Patterns are NOT standalone entry signals. Use them as:
Confirmation: UT Bot gives signal + pattern appears = stronger entry
Reversal Warning: In a trade, opposite pattern appears = consider tightening stop or taking profit
Support/Resistance Validation: Pattern at key level (PDH, VWAP, MA 200) = level is being respected
Best combined with:
UT Bot or Base signal in same direction
Bias Table alignment (AVG > 60% or < 40%)
Appearance at obvious support/resistance
---
7. VISUAL TOOLS AND FEATURES
VWAP (Volume Weighted Average Price):
Session-anchored VWAP with standard deviation bands. Shows institutional "fair value" for the trading session.
Anchor Options: Session, Day, Week, Month, Quarter, Year. Choose based on your trading timeframe.
Bands: Up to three pairs (X1, X2, X3) showing statistical deviation. Price at outer bands often reverses.
Auto-Hide on HTF: VWAP hides on Daily/Weekly/Monthly charts automatically unless you enable anchored mode.
Use VWAP as:
Directional bias (above = bullish, below = bearish)
Mean reversion levels (outer bands)
Support/resistance (the VWAP line itself)
Previous Day High/Low:
Automatically plots yesterday's high and low on intraday charts:
Updates at start of each new trading day
Theme-aware colors (dark text for light charts, light text for dark charts)
Hidden automatically on Daily/Weekly/Monthly charts
These levels are critical for intraday traders - institutions watch them closely as support/resistance.
Opening Range Breakout (ORB):
Tracks the high/low of the first 5, 15, 30, or 60 minutes of the trading session:
Customizable session times (preset for NYSE, LSE, TSE, or custom)
Shows current breakout status in Bias Table row (ABOVE, BELOW, INSIDE, BUILDING)
Intraday only - auto-disabled on Daily+ charts
ORB is a classic day trading strategy - breakout above opening range often leads to continuation.
Extra Labels:
Change from Open %: Shows how far price has moved from session open (intraday) or daily open (HTF). Green if positive, red if negative.
ADX Badge: Small label at bottom of last bar showing current ADX value. Green when above your minimum threshold, red when below.
RSI Badge: Small label at top of last bar showing current RSI value with zone status (buy zone, sell zone, or neutral).
These labels provide quick at-a-glance confirmation without needing separate indicator windows.
---
8. HOW TO USE THE INDICATOR
Step 1: Add to Chart
Load the indicator on your chosen asset and timeframe
First time: Everything is enabled by default - the chart will look busy
Don't panic - you'll turn off what you don't need
Step 2: Start Simple
Turn OFF everything except:
UT Bot labels (keep these ON)
Bias Table (keep this ON)
Moving Averages (Fast and Medium only)
Suggested Stop Loss and Take Profits
Hide everything else initially. Get comfortable with the basic UT Bot + Bias Table workflow first.
Step 3: Learn the Core Workflow
UT Bot gives a Buy or Sell signal
Check Bias Table AVG column - do you have multi-timeframe alignment?
If yes, enter the trade
Place stop at Suggested Stop Loss line
Scale out at TP levels
Exit on opposite UT signal
Trade this simple system for a week. Get a feel for signal frequency and win rate with your settings.
Step 4: Add Filters Gradually
If you're getting too many losing signals (whipsaws in choppy markets), add filters one at a time:
Try: "Require 2-Bar Trend Confirmation" - wait for 2 bars to confirm direction
Try: ADX filter with minimum threshold - only trade when trend strength is sufficient
Try: RSI pullback filter - only enter on pullbacks, not chasing
Try: Volume filter - require above-average volume
Add one filter, test for a week, evaluate. Repeat.
Step 5: Enable Advanced Features (Optional)
Once you're profitable with the core system, add:
Supertrend for additional trend confirmation
Candlestick patterns for reversal warnings
VWAP for institutional anchor reference
ORB for intraday breakout context
ZLSMA for low-lag trend following
Step 6: Optimize Settings
Every setting has a detailed tooltip explaining what it does and typical values. Hover over any input to read:
What the parameter controls
How it impacts trading
Suggested ranges for scalping, day trading, and swing trading
Start with defaults, then adjust based on your results and style.
Step 7: Set Up Alerts
Right-click chart → Add Alert → Condition: "Luxy Momentum v6" → Choose:
"UT Bot — Buy" for long entries
"UT Bot — Sell" for short entries
"Base Long/Short" for filtered MA cross signals
Optionally enable "Send real-time alert() on UT flip" in settings for immediate notifications.
Common Workflow Variations:
Conservative Trader:
UT signal + Base signal + Candlestick pattern + Bias AVG > 70%
Enter only at major support/resistance
Wider UT sensitivity, multiple filters
Aggressive Trader:
UT signal + Bias AVG > 60%
Enter immediately, no waiting
Tighter UT sensitivity, minimal filters
Swing Trader:
Focus on Daily/Weekly Bias alignment
Ignore intraday noise
Use ORB and PDH/PDL less (or not at all)
Wider stops, patient approach
---
9. PERFORMANCE AND OPTIMIZATION
The indicator is optimized for speed, but with 15+ features running simultaneously, chart load time can add up. Here's how to keep it fast:
Biggest Performance Gains:
Disable Unused Timeframes: In "Time Frames" settings, turn OFF any timeframe you don't actively trade. Each disabled TF saves 10-15% calculation time. If you only day trade 5m, 15m, 1h, disable 1m, 2h, 4h.
Hide Bias Table on Daily+: If you only trade intraday, enable "Hide BIAS table on 1D or above". This skips ALL table calculations on higher timeframes.
Draw UT Visuals Only on Bar Close: Reduces intrabar rendering of SL/TP/Entry lines. Has ZERO impact on logic or alerts - purely visual optimization.
Additional Optimizations:
Turn off VWAP bands if you don't use them
Disable candlestick patterns if you don't trade them
Turn off Supertrend fill if you find it distracting (keep the line)
Reduce "Limit to 10 bars" for SL/TP lines to minimize line objects
Performance Features Built-In:
Smart Caching: Higher timeframe data (3-day bias, weekly bias, etc.) updates once per day, not every bar
Conditional Calculations: Volume filter only calculates when enabled. Swing filter only runs when enabled. Nothing computes if turned off.
Modular Design: Every component is independent. Turn off what you don't need without breaking other features.
Typical Load Times:
5m chart, all features ON, 7 timeframes: ~2-3 seconds
5m chart, core features only, 3 timeframes: ~1 second
1m chart, all features: ~4-5 seconds (many bars to calculate)
If loading takes longer, you likely have too many indicators on the chart total (not just this one).
---
10. FAQ
Q: How is this different from standard UT Bot indicators?
A: Standard UT Bot (originally by @QuantNomad) is just the ATR trailing line and flip signals. This implementation adds:
- Volume weighting and momentum adjustment to the trailing calculation
- Multiple confirmation filters (swing, %, 2-bar, ZLSMA)
- Smart composite stop loss system from multiple S/R layers
- R-multiple take profit system with freeze-on-touch
- Integration with multi-timeframe Bias Table
- Visual audit trail with checkmarks
Q: Can I use this for automated trading?
A: The indicator is designed for discretionary trading. While it has clear signals and alerts, it's not a mechanical system. Context and judgment are required.
Q: Does it repaint?
A: No. All signals respect bar close. UT Bot logic runs intrabar but signals only trigger on confirmed bars. Alerts fire correctly with no lookahead.
Q: Do I need to use all the features?
A: Absolutely not. The indicator is modular. Many profitable traders use just UT Bot + Bias Table + Moving Averages. Start simple, add complexity only if needed.
Q: How do I know which settings to use?
A: Every single input has a detailed tooltip. Hover over any setting to see:
What it does
How it affects trading
Typical values for scalping, day trading, swing trading
Start with defaults, adjust gradually based on results.
Q: Can I use this on crypto 24/7 markets?
A: Yes. ORB will not work (no defined session), but everything else functions normally. Use "Day" anchor for VWAP instead of "Session".
Q: The Bias Table is blank or not showing.
A: Check:
"Show Table" is ON
Table position isn't overlapping another indicator's table (change position)
At least one row is enabled
"Hide BIAS table on 1D or above" is OFF (if on Daily+ chart)
Q: Why are candlestick patterns not appearing?
A: Patterns are relatively rare by design - they only appear at genuine reversal points. Check:
Pattern toggles are ON
"Min candle body %" isn't too high (try 0.05-0.10)
You're looking at a chart with actual reversals (not strong trending market)
Q: UT Bot is too sensitive/not sensitive enough.
A: Adjust "Sensitivity (Key×ATR)". Lower number = tighter stop, more signals. Higher number = wider stop, fewer signals. Read the tooltip for guidance.
Q: Can I get alerts for the Bias Table?
A: The Bias Table is a dashboard for visual analysis, not a signal generator. Set alerts on UT Bot or Base signals, then manually check Bias Table for confirmation.
Q: Does this work on stocks with low volume?
A: Yes, but turn OFF the volume filter. Low volume stocks will never meet relative volume requirements.
Q: How often should I check the Bias Table?
A: Before every entry. It takes 2 seconds to glance at the AVG column and headline rows. This one check can save you from fighting the trend.
Q: What if UT signal and Base signal disagree?
A: UT Bot is more aggressive (ATR trailing). Base signals are more conservative (MA cross + filters). If they disagree, either:
Wait for both to align (safest)
Take the UT signal but with smaller size (aggressive)
Skip the trade (conservative)
There's no "right" answer - depends on your risk tolerance.
---
FINAL NOTES
The indicator gives you an edge. How you use that edge determines results.
For questions, feedback, or support, comment on the indicator page or message the author.
Happy Trading!
CoffeeShopCrypto Supertrend Liquidity EngineMost SuperTrend indicators use fixed ATR multipliers that ignore context—forcing traders to constantly tweak settings that rarely adapt well across timeframes or assets.
This Supertrend is a nodd to and a more completion of the work
done by Olivier Seban ( @olivierseban )
This version replaces guesswork with an adaptive factor based on prior session volatility, dynamically adjusting stops to match current conditions. It also introduces liquidity-aware zones, real-time strength histograms, and a visual control panel—making your stoploss smarter, more responsive, and aligned with how the market actually moves.
📏 The Multiplier Problem & Adaptive Factor Solution
Traditional SuperTrend indicators rely on fixed ATR multipliers—often arbitrary numbers like 1.5, 2, or 3. The issue? No logical basis ties these values to actual market conditions. What works on a 5-minute Nasdaq chart fails on a daily EUR/USD chart. Traders spend hours tweaking multipliers per asset, timeframe, or volatility phase—and still end up with stoplosses that are either too tight or too loose. Worse, the market doesn’t care about your setting—it behaves according to underlying volatility, not your parameter.
This version fixes that by automating the multiplier selection entirely. It uses a 4-zone model based on the current ATR relative to the previous session’s ATR, dynamically adjusting the SuperTrend factor to match current volatility. It eliminates guesswork, adapts to the asset and timeframe, and ensures you’re always using a context-aware stoploss—one that evolves with the market instead of fighting it.
ATR EXAMPLE
Let’s say prior session ATR = 2.00
Now suppose current ATR = 0.32
This places us in Zone 1 (Very Low Volatility)
It doesn’t imply "overbought" or "oversold" — it tells you the market is moving very little, which often means:
Lower risk | Smaller stops | Smaller opportunities (and losses)
🔁 Liquidity Zones vs. Arbitrary Pullbacks
The standard SuperTrend stop loss line often looks like price “barely misses it” before continuing its trend. Traders call this "stop hunting," but what’s really happening is liquidity collection—price pulls back into a zone rich in orders before continuing. The problem? The old SuperTrend doesn’t show this zone. It only draws the outer limit, leaving no visual cue for where entries or continuation moves might realistically originate.
This script introduces 2 levels in the Liquidity Zone. One for Support and one for Stophunts, which draw dynamically between the current price and the SuperTrend line. These levels reflect where the market is most likely to revisit before resuming the trend. By visualizing the area just above the Supertrend stop loss, you can anticipate pullbacks, spot ideal re-entries, and avoid premature exits. This bridges the gap between mechanical stoploss logic and real-world liquidity behavior.
⏳ Prior Session ATR vs. Live ATR
Using real-time ATR to determine movement potential is like driving by looking in your rearview mirror. It’s reactive, not predictive. Traders often base decisions on live ATR, unaware that today’s range is still unfolding —creating volatility mismatches between what’s calculated and what actually matters. Since ATR reflects range, calculating it mid-session gives an incomplete and misleading picture of true volatility.
Instead, this system uses the ATR from the previous session , anchoring your volatility assumptions in a fully-formed price structure . It tells you how far price moved in the last full market phase—be it London, New York, or Tokyo—giving you a more reliable gauge of expected range today. This is a smarter way to estimate how far price could move rather than how far it has moved.
The Smoothing function will take the ATR, Support, Resistance, Stophunt Levels, and the Moving Avearage and smooth them by the calculation you choose.
It will also plot a moving average on your chart against closing prices by the smoothing function you choose.
🧭 Scalping vs. Trending Modes
The market moves in at least 4 phases. Trending, Ranging, Consolidation, Distribution.
Every trader has a different style —some scalp low-volatility moves during off-hours, while others ride macro trends across days. The problem with classic SuperTrend? It treats every market condition the same. A fixed system can’t possibly provide proper stoploss spacing for both a fast scalp and a long-term swing. Traders are forced to rebuild their system every time the market changes character or the session shifts.
This version solves that with a simple toggle:
Scalping or Trend Mode . With one switch, it inverts the logic of the adaptive factor to either tighten or loosen your trailing stops. During low-liquidity hours or consolidation phases, Scalping Mode offers snug stoplosses. During expansion or clear directional bias.
Trend Mode lets the trade breathe. This is flexibility built directly into the logic—not something you have to recalibrate manually.
📉 Histogram Oscillator for Move Strength
In legacy indicators, there’s no built-in way to gauge when the move is losing power . Traders rely on price action or momentum indicators to guess if a trend is fading. But this adds clutter, lag, and often contradiction. The classic SuperTrend doesn’t offer insight into how strong or weak the current trend leg is—only whether price has crossed a line.
This version includes a Trending Liquidity Histogram —a histogram that shows whether the liquidity in the SuperTrend zone is expanding or compressing. When the bars weaken or cross toward zero, it signals liquidity exhaustion . This early warning gives you time to prep for reversals or anticipate pullbacks. It even adapts visually depending on your trading mode, showing color-coded signals for scalping vs. trending behavior. It's both a strength gauge and a trade timing tool—built into your stoploss logic.
Histogram in Scalping Mode
Histogram in Trending Mode
📊 Visual Table for Real-Time Clarity
A major issue with custom indicators is opacity —you don’t always know what settings or values are currently being used. Even worse, if your dynamic logic changes mid-trade, you may not notice unless you go digging into the code or logs. This can create confusion, especially for discretionary traders.
This SuperTrend solves it with a clean visual summary table right on your chart. It shows your current ATR value, adaptive multiplier, trailing stop level, and whether a new zone size is active. That means no surprises and no second-guessing—everything important is visible and updated in real-time.






















