PPO Bull/Bear Divergence to High/Low StrategyA simple strategy that uses the PPO divergences to open trades and the highs/lows to close them. Credit to Pekipek for this PPO Divergence indicator (I changed the visuals a bit)
STRATEGY
Purple circle - bullish divergence - enter LONG
Orange circle - bearish divergence - enter SHORT
Green dot - high point - exit LONG
Red dot - low point - exit SHORT
That's it. Not very profitable, but I like Pekipek's indicator a lot so figured I'd see what a strategy was like. Would love to see any variations.
在腳本中搜尋"bear"
Super Envolvente (Bullish y Bearish)Identificador de Super-envolventes (SE), se encarga de darle un color verde a la SE alzista (Bullish) verde y rojo a la bajista (Bearish).
[NM]Improved Linear Regression Bull and Bear Power v02Hi guys, I'm back with a little improvement on the Bull and Bear Signal I published just last week thanks to some feedback I received from a couple of users, which is of course highly appreciated.
Here are the changes that have been implemented compared to v01 :
(version 1 is the top indicator, version 2 is the bottom one) in the chart above
Formula adapted to calculate the signal if no data is available for either bull or bear
Added the possibility to smoothen the signal using Arnaud Legroux Moving Average (the benefit of this is that it does not add any lag to the signal)
Zero line was added
If you have any further ideas on how to improve the indicator or if you are happy with it and want to share your settings or rules of engagement, please feel free to share them below.
Oh, and don't forget to click that like button ! :)
Candlestick Patterns Identified (updated 3/11/15)I decided to republish this one without the trend filter and with all the major symbols active. This will allow for all the patterns to show up.
Due to 15 different candlestick formations in this one script, it will be difficult to turn off the last few due to screen size. You can turn off individual patterns on the settings screen.
I have everything spelled out except the hammer and inverted hammer. They are "H" and "IH" respectively on the charts. They show up so often that they cluttered the charts.
The default script has: Doji, Evening Star, Morning Star, Shooting Star, Hammer, Inverted Hammer, Bearish Harami, Bullish Harami, Bearish Engulfing, Bullish Engulfing, Piercing Line, Bullish Belt, Bullish Kicker, Bearish Kicker, Hanging man, and Dark Cloud Cover. You can turn off what you don't like. The Piercing Line, Bullish Belt, and the Kickers will usually show up better in the daily charts.
I recommend watching videos with Stephen Bigalow to get a feel for how to trade these. You will want to add an 8 EMA to your chart with his setups. Enjoy.
If you want the old version: Take a look at the related ideas below.
Candlesticks Patterns IdentifiedI was using another script that colored the bars to show the different candle patterns. Thanks to HPotter (www.tradingview.com). Unfortunately, I can't think that fast when looking across a screen of charts with different color bars. Fortunately, Tradingview came up with symbols and names on 2/26/15. I decided to take my favorite symbols and attach them to a name. This makes it easier to see what is going on and where your entry would be if it confirms. Works beautifully for me. Decided to share. I also added the ability to alter what shows up based upon a look back. A bullish engulfing at the top of a trend, or a bearish harami at the bottom of the trend, is nearly useless and clutters the chart. I have the default set for the open of the current bar to be higher or lower than the open from 5 bars back. You can adjust in the settings to what you like. This trend setting is on all the patterns except doji. If you want to see all the candle patterns, set it to "1".
The doji can be adjusted as well. I left some other patterns at the bottom of the script, but they are turned off. They became too much of a clutter for me. I prefer DovCaspi's pattern finder for hammers and stars: I use his due to the clean appearance.
The default script has: Doji, Bearish Harami, Bullish Harami, Bearish Engulfing, Bullish Engulfing, Piercing Line, Bullish Belt, Bullish Kicker, and Bearish Kicker. You can turn off what you don't like. The Piercing Line, Bullish Belt, and the Kickers will usually show up better in the daily charts.
If you would like the updated version, see the Related Ideas below:
Custom Indicator Clearly Shows If Bulls or Bears are in Control!The Two Versions of this Indicator I learned from Two Famous and Highly Successful Traders. This Indicator shows With No Lag Clear Up and Down Trends in Market by Documenting Clearly If Bulls or Bears are in Control. The Version In SubChart 1 Shows Consecutive Closes if the Current Close is Greater than of Less than the Midpoint of the Previous Bar (Why Midpoint Explained in Detail in 1st Post). The Version in SubChart 2 Shows Consecutive Closes that are Greater than or Less Than the Previous Close (Will Discuss Specific Uses in 1st Post). Works on Stocks, Forex, Futures, on All Timeframes.
Keltner Channel v2 - Auto highlighting of Bull/Bear trendsPlease do not use the previous version (), I was using wrong colors for Bull/Bear there.
All options configurable.
Reversals are marked using crosses. as well as highlighted using green/red color (depending on bull/bear). Enjoy!
Keltner Channel with auto highlighting of Bear/Bull reversals*** New version @ ****
All options configurable.
Reversals are marked using crosses. as well as highlighted using green/red color (depending on bull/bear). Enjoy!
Bearish signal using Point of Control (POC) with PAC by guruThis indicator code helps traders identify potential sell opportunities using several important technical indicators:
Point of Control (POC) – This is the price level where the most volume was traded over the past several days.
Previous Day's Low – This shows the lowest price reached during the previous day.
PAC (Price Action Channel) EMA – These are two moving averages (one based on the low price and one based on the close price) that help determine if the price is trending within a certain range.
Volume SMA – This is a 3-day simple moving average (SMA) of volume, which helps filter out signals based on market activity.
What the Script Does:
Point of Control (POC):
The script looks at the last 50 days (configurable) and calculates which price level had the highest trading volume.
It then plots a red line on the chart at the POC level. This is important because it helps identify areas where there was strong market interest in the past.
Volume Moving Average:
The script calculates a 3-day SMA of volume, but it excludes the current day to avoid premature signals based on today’s trading.
The volume SMA is used to ensure there’s enough market activity (with a threshold set to 25 units) before triggering a sell signal.
Price Action Channel (PAC) EMA:
The PAC consists of two exponential moving averages (EMAs):
The PAC Low EMA: This is based on the low prices over the last 34 periods (configurable).
The PAC Close EMA: This is based on the closing prices over the last 34 periods.
These EMAs help determine if the price is trending above or below certain price levels.
Sell Signal Logic: The script checks three conditions before displaying a "Sell" signal:
Price Below POC and Previous Day’s Low:
The close price must be below both the Point of Control (POC) and the previous day's low.
Volume SMA Above 25:
The 3-day volume SMA must be greater than 25. This ensures the signal only triggers when there’s enough trading volume in the market.
Today’s Low is Above PAC EMAs:
Today's low price must be above both the PAC low EMA and the PAC close EMA. This prevents sell signals when prices are already significantly below the PAC, indicating possible exhaustion in the downtrend.
If all three conditions are met, the script will display a red "Sell" label on the chart, signaling a potential selling opportunity.
No Sell Signal if Price Reverses:
If the price crosses back above the POC or the previous day's low, the script will remove the sell signal and reset for a new opportunity.
Summary of Conditions:
For the script to display a "Sell" label:
The close price must be below the Point of Control (POC) and the previous day’s low.
The 3-day volume SMA (excluding today) must be greater than 25 units.
The low price of the current day must be above both the PAC low EMA and the PAC close EMA.
If these conditions are met, a red sell label appears on the chart as a potential signal for a short (sell) trade.
Market Sentiment Trend Gauge [LevelUp]Market Sentiment Trend Gauge simplifies technical analysis by mathematically combining momentum, trend direction, volatility position, and comparison against a market benchmark, into a single trend score from -100 to +100. Displayed in a separate pane below your chart, it resolves conflicting signals from RSI, moving averages, Bollinger Bands, and market correlations, providing clear insights into trend direction, strength, and relative performance.
THE PROBLEM MARKET SENTIMENT TREND GAUGE (MSTG) SOLVES
Traditional indicators often produce conflicting signals, such as RSI showing overbought while prices rise or moving averages indicating an uptrend despite market underperformance. MSTG creates a weighted composite score to answer: "What's the overall bias for this asset?"
KEY COMPONENTS AND WEIGHTINGS
The trend score combines
▪ Momentum (25%): Normalized 14-period RSI, capped at ±100.
▪ Trend Direction (35%): 10/21-period EMA relationships,
▪ Volatility Position (20%): Price position, 20-period Bollinger Bands, capped at ±100.
▪ Market Comparison (20%): Daily performance vs. SPY benchmark, capped at ±100.
Final score = Weighted sum, smoothed with 5-period EMA.
INTERPRETING THE MSTG CHART
Trend Score Ranges and Colors
▪ Bright Green (>+30): Strong bullish; ideal for long entries.
▪ Light Green (+10 to +30): Weak bullish; cautiously favorable.
▪ Gray (-10 to +10): Neutral; avoid directional trades.
▪ Light Red (-10 to -30): Weak bearish; exercise caution.
▪ Bright Red (<-30): Strong bearish; high-risk for longs, consider shorts.
Reference Lines
▪ Zero Line (Gray): Separates bullish/bearish; crossovers signal trend changes.
▪ ±30 Lines (Dotted, Green/Red): Thresholds for strong trends.
▪ ±60 Lines (Dashed, Green/Red): Extreme strength zones (not overbought/oversold); manage risk (tighten stops, partial profits) but trends may persist.
Background Colors
▪ Green Tint (>+20): Bullish environment; favorable for longs.
▪ Red Tint (<-20): Bearish environment; caution for longs.
▪ Light Gray Tint (-20 to +20): Neutral/range-bound; wait for signals.
Extreme Readings vs. Traditional Signals
MSTG ±60 indicates maximum alignment of all factors, not reversals (unlike RSI >70/<30). Use for risk management, not automatic exits. Strong trends can sustain extremes; breakdowns occur below +30 or above -30.
INFORMATION TABLE INTERPRETATION
Trend Score Symbols
▲▲ >+30 strong bullish
▲ +10 to +30
● -10 to +10 neutral
▼ -30 to -10
▼▼ <-30 strong bearish
Colors: Green (positive), White (neutral), Red (negative).
Momentum Score
+40 to +100 strong bullish
0 to +40 moderate bullish
-40 to 0 moderate bearish
-100 to -40 strong bearish
Market vs. Stock
▪ Green: Stock outperforming market
▪ Red: Stock underperforming market
Example Interpretations:
-0.45% / +1.23% (Green): Market down, stock up = Strong relative strength
+2.10% / +1.50% (Red): Both rising, but stock lagging = Relative weakness
-1.20% / -0.80% (Green): Both falling, but stock declining less = Defensive strength
UNDERSTANDING EXTREME READINGS VS TRADITIONAL OVERBOUGHT/OVERSOLD
⚠️ Critical distinctions
Traditional Overbought/Oversold Signals:
▪ Single indicator (like RSI >70 or <30) showing momentum excess
▪ Often suggests immediate reversal or pullback expected
▪ Based on "price moved too far, too fast" concept
MSTG Extreme Readings (±60):
▪ Composite alignment of 4 different factors (momentum, trend, volatility, relative strength)
▪ Indicates maximum strength in current direction
▪ NOT a reversal signal - means "all systems extremely bullish/bearish"
Key Differences:
▪ RSI >70: "Price got ahead of itself, expect pullback"
▪ MSTG >+60: "Everything is extremely bullish right now"
▪ Strong trends can maintain extreme MSTG readings during major moves
▪ Breakdowns happen when MSTG falls below +30, not at +60
Proper Usage of Extreme Readings:
▪ Risk Management: Tighten stops, take partial profits
▪ Position Sizing: Reduce new position sizes at extremes
▪ Trend Continuation: Watch for sustained extreme readings in strong markets
▪ Exit Signals: Look for breakdown below +30, not reversal from +60
TRADING WITH MSTG
Quick Assessment
1. Check trend symbol for direction.
2. Confirm momentum strength.
3. Note relative performance color.
Examples:
▲▲ 55.2 (Green), Momentum +28.4, Outperforming: Strong buy setup.
▼ -18.6 (Red), Momentum -43.2, Underperforming: Defensive positioning.
Entry Conditions
▪ Long: stock outperforming market
- Score >+30 (bright green)
- Sustained green background
- ▲▲ symbol,
▪ Short: stock underperforming market
- Score <-30 (bright red)
- Sustained red background
- ▼▼ symbol
Avoid Trading When:
▪ Gray zone (-10 to +10).
▪ Rapid color changes or frequent zero-line crosses (choppy market).
▪ Gray background (range-bound).
Risk Management:
▪ Stop Loss: Exit on zero-line crossover against position.
▪ Take Profit: Partial at ±60 for risk control.
▪ Position Sizing: Larger when signals align; smaller in extremes or mixed conditions.
KEY ADVANTAGES
▪ Unified View: Weighted composite reduces noise and conflicts.
▪ Visual Clarity: 5-color system with gradients for rapid recognition.
▪ Market Context: Relative strength vs. SPY identifies leaders/laggards.
▪ Flexibility: Works across timeframes (1-min to weekly); customizable table.
▪ Noise Reduction: EMA smoothing minimizes false signals.
EXAMPLES
Strong Bull: Trend Score 71.9, Momentum Score 76.9
Neutral: Trend Score 0.1, Momentum Score -9.2
Strong Bear: Trend Score -51.7, Momentum Score -51.5
PERFORMANCE AND LIMITATIONS
Strengths: Trend identification, noise reduction, relative performance versus market.
Limitations: Lags at turning points, less effective in extreme volatility or non-trending markets.
Recommendations: View on multiple timeframes, combine with price action and fundamentals.
Swing Structure & Sideways Box Pro (Final Fix 2.0)Of course. Here is a detailed explanation of the Pine Script code you provided.
This script is a technical analysis indicator for TradingView designed to automatically identify and visualize market structure. Its main functions are to detect swing highs and lows, identify potential support and resistance levels based on double tops/bottoms, and draw a box around sideways or consolidating price action.
📜 Code Breakdown
Inputs
The script starts with two user-configurable inputs:
Bars for Summary Table: This sets the number of recent bars to analyze for the on-screen summary table. The default is 20 bars.
Swing Level Threshold (%): This is a tolerance setting used to identify double tops and bottoms. It determines how close two swing points need to be in price to be considered the same level. For example, a default of 0.5% means two swing highs must be within 0.5% of their average price to be marked as a resistance level.
🕯️ Candle Coloring
This is a simple momentum indicator that colors the chart's candles based on their relationship to the previous candle:
Green (Bullish): The current candle closes above the previous candle's high.
Red (Bearish): The current candle closes below the previous candle's low.
Yellow (Neutral): The current candle closes within the high-low range of the previous candle (an inside bar).
📈 Swing, Line, & Box Logic
This is the core of the indicator, where market structure is identified.
How Swings are Confirmed
The script's logic for identifying swing points is crucial. A swing is not confirmed as soon as it happens; it requires a "confirmation" candle.
Swing High Confirmation: The script is looking for a high point (direction = 1). A high is only confirmed after a bearish (red) candle appears. This signals a potential reversal or shift in momentum away from that peak.
Swing Low Confirmation: The script is looking for a low point (direction = -1). A low is only confirmed after a bullish (green) candle appears, signaling a potential move up from that trough.
Once a swing is confirmed, the script draws a structure line connecting the last pivot to the newly confirmed one.
Support & Resistance (Double Tops/Bottoms)
The script constantly analyzes the history of confirmed swing points to find support and resistance levels.
Resistance: When a new swing high is confirmed, the script looks back at the previous swing high. If the two highs are close in price (within the Swing Level Threshold), it considers them a double top and draws a horizontal red resistance line extending into the future.
Support: Similarly, when a new swing low is confirmed, it's compared to the previous low. If they are close in price, it's marked as a double bottom, and a horizontal blue support line is drawn.
Sideways Box Management
The script uses the identified support and resistance lines to detect and visualize ranging markets.
Creation: A sideways box is drawn only when there is both an active support line and an active resistance line on the chart.
Extension & Expansion: The box extends to the right with each new candle. If a new, higher resistance or lower support level is formed while the box is active, the box expands its top or bottom boundary to accommodate the new price range.
Breakout: The sideways condition ends when a breakout occurs. This happens if a candle closes decisively above the box's resistance or below its support. When a breakout happens, the box is finalized, the active S/R lines are deleted, and the script is ready to identify a new potential range.
📊 Summary Table
A small table is displayed in the top-right corner of the chart. It provides a quick statistical summary of market momentum over the number of bars you defined in the inputs. It shows:
The total count of bullish and bearish bars.
The percentage of "strength" for bulls vs. bears, calculated based on the size of the candle bodies.
🚨 Alerts
The script includes simple alerts that can be configured in TradingView:
An alert can be triggered whenever a bullish (green) candle appears.
An alert can be triggered whenever a bearish (red) candle appears.
RVol+ Enhanced Relative Volume Indicator📊 RVol+ Enhanced Relative Volume Indicator
Overview
RVol+ (Relative Volume Plus) is an advanced time-based relative volume indicator designed specifically for swing traders and breakout detection. Unlike simple volume comparisons, RVol+ analyzes volume at the same time of day across multiple sessions, providing statistically significant insights into institutional activity and breakout potential.
🎯 Key Features
Core Volume Analysis
Time-Based RVol Calculation - Compares current cumulative volume to the average volume at this exact time over the past N days
Statistical Z-Score - Measures volume in standard deviations from the mean for true anomaly detection
Volume Percentile - Shows where current volume ranks historically (0-100%)
Sustained Volume Filter - 3-bar moving average prevents false signals from single-bar spikes
Breakout Detection
🚀 Confirmed Breakouts - Identifies price breakouts validated by high volume (RVol > 1.5x)
⚠️ False Breakout Warnings - Alerts when price breaks key levels on low volume (high failure risk)
Multi-Timeframe Context - Weekly volume overlay prevents chasing daily noise
Advanced Metrics
OBV Divergence Detection - Spots bullish/bearish accumulation/distribution patterns
Volume Profile Integration - Identifies institutional positioning
Money Flow Analysis - Tracks smart money vs retail activity
Extreme Volume Alerts - 🔥 Labels mark unusual spikes beyond the display cap
Visual Intelligence
Smart Color Coding:
🟢 Bright Teal = High activity (RVol ≥ 1.5x)
🟡 Medium Teal = Caution zone (RVol ≥ 1.2x)
⚪ Light Teal = Normal activity
🟠 Orange = Breakout confirmed
🔴 Red = False breakout risk
Comprehensive Stats Table:
Current Volume (formatted as M/K/B)
RVol ratio
Z-Score with significance
Volume percentile
Historical average and standard deviation
Sustained volume confirmation
📈 How to Use
For Swing Trading (1D - 3W Holds)
Perfect Setup:
✓ RVol > 1.5x (bright teal)
✓ Z-Score > 2.0 (⚡ alert)
✓ Percentile > 90%
✓ Sustained = ✓
✓ 🚀 Breakout label appears
Avoid:
✗ Red "Low Vol" warning during breakouts
✗ RVol < 1.0 at key levels
✗ Sustained volume not confirmed
Signal Interpretation
⚡ Z>2 Labels - Statistically significant volume (95th+ percentile) - highest probability moves
↗️ OBV+ Labels - Bullish accumulation (OBV rising while price consolidates)
↘️ OBV- Labels - Bearish distribution (OBV falling while price rises)
🔵 Blue Background - Weekly volume elevated (confirms daily strength)
⚙️ Customization
Basic Settings
N Day Average - Number of historical days for comparison (default: 5)
RVol Thresholds - Customize highlight levels (default: 1.2x, 1.5x)
Visual Display Cap - Prevent extreme spikes from compressing view (default: 4.0x)
Advanced Metrics (Toggle On/Off)
Z-Score analysis
Weekly RVol context
OBV divergence detection
Volume percentile ranking
Breakout signal generation
Table Customization
Position - 9 placement options to avoid chart overlap
Size - Tiny to Huge
Colors - Full customization of positive/negative/neutral values
Transparency - Adjustable background
Debug Mode
Enable Pine Logs for calculation transparency
Adjustable log frequency
Real-time calculation breakdown
🔬 Technical Details
Algorithm:
Binary search for historical lookups (O(log n) performance)
Time-zone aware session detection
DST-safe timestamp calculations
Exponentially weighted standard deviation
Anti-repainting architecture
Performance:
Optimized for max_bars_back = 5000
Efficient array management
Built-in function optimization
Memory-conscious data structures
📊 What Makes RVol+ Different?
vs. Standard Volume:
Context-aware (time-of-day matters)
Statistical significance testing
False breakout filtering
vs. Basic RVol:
Z-Score normalization (2-3 sigma detection)
Multi-timeframe confirmation
OBV divergence integration
Sustained volume filtering
Smart visual scaling
vs. Professional Tools:
Free and open-source
Fully customizable
No black-box algorithms
Educational debug logs
💡 Best Practices
Wait for Confirmation - Don't enter on first bar; wait for sustained volume ✓
Combine with Price Action - RVol validates, price structure determines entry
Weekly Context Matters - Blue background = institutional interest
Z-Score is King - Focus on ⚡ alerts for highest probability
Avoid Low Volume Breakouts - Red ⚠️ labels = high failure risk
🎓 Trading Psychology
Volume precedes price. When RVol+ shows:
High RVol + Rising OBV = Accumulation before breakout
High RVol at Resistance = Test of conviction
Low RVol on Breakout = Retail-driven (fade candidate)
Z-Score > 3 = Potential "whale" positioning
📝 Credits
Based on the time-based RVol concept from /u/HurlTeaInTheSea, enhanced with:
Statistical analysis (z-scores, percentiles)
Multi-timeframe integration
OBV divergence detection
Professional-grade visualization
Swing trading optimization
🔧 Version History
v2.0 - Enhanced Edition
Added Z-Score analysis
Multi-timeframe volume context
OBV divergence detection
Breakout confirmation system
Smart color coding
Customizable stats table
Debug logging mode
Performance optimizations
📚 Learn More
For optimal use with swing trading:
Combine with support/resistance levels
Watch for volume clusters in consolidation
Use weekly timeframe for trend confirmation
Monitor OBV divergence for early warnings
⚠️ Disclaimer
This indicator is for educational purposes. Volume analysis is one component of trading decisions. Always use proper risk management, consider multiple timeframes, and validate signals with price structure. Past performance does not guarantee future results.
🚀 Getting Started
Add indicator to chart
Adjust "N Day Average" to your preference (5-10 days typical)
Position stats table to avoid overlap
Enable features you want to monitor
Watch for 🚀 breakout confirmations!
Happy Trading! 📈
Cumulative Volume Delta with HMACumulative Volume Delta (CVD) with HMA — Trade the “Real” Push Behind Price
What it does:
This indicator plots Cumulative Volume Delta (CVD) and a Hull Moving Average (HMA) of that CVD to reveal whether buyers or sellers are actually in control behind the candles. Price can fake; delta rarely does. Use the HMA to smooth noisy flows, define bias, and time entries on pullbacks/retests.
How it works
CVD: On each bar, we estimate buying vs. selling pressure and accumulate it over time.
Positive delta → net aggressive buy pressure
Negative delta → net aggressive sell pressure
HMA on CVD: The Hull MA (HMA) is a fast, responsive smoother that reduces lag while keeping turns clean.
CVD > HMA → buy-side impulse dominating
CVD < HMA → sell-side impulse dominating
Slope of HMA helps filter chop and define trend regime
Note: Depending on your TradingView data, “delta” is inferred (e.g., from price change × volume or up/down closes). It’s not the same as broker-side bid/ask tape, but it’s a robust proxy for intraday decision-making.
Why it’s useful
Confirm or fade moves: A breakout with rising CVD above HMA has higher odds than a breakout on flat/negative CVD.
Spot divergences: Price makes a new high but CVD/HMA doesn’t → momentum exhaustion risk.
Time pullbacks: In an uptrend, look for CVD pullback to (or slightly below) HMA, then a reclaim to rejoin the move.
Filter signals: Combine with your price action/VWAP: take longs only when CVD above HMA & HMA sloping up (vice-versa for shorts).
Plots & visuals
CVD Line: The raw cumulative delta.
CVD HMA: Smoothed bias line (color flips on slope or cross, depending on your settings).
Zero Line (optional): Helps visualize shifts from net selling to net buying since the chosen reset point.
Color Logic (optional): Bars/area color when CVD is above/below HMA for quick at-a-glance bias.
Key inputs (typical)
CVD Method:
Close Change × Volume (default)
Up/Down Volume by Close vs. Previous Close
Reset Mode: Session / Daily / Weekly / Never / Anchor Date
HMA Length: (e.g., 34)
Signal Smoothing (optional): Extra smoothing on CVD before HMA
Zero-Line Toggle
Coloring Toggles: Fill/line/bar colors on cross or slope
Alerts: Crosses & slope flips (see below)
How to trade it (playbook)
Trend confirmation
Bias long when CVD > HMA and HMA slopes up; bias short on the opposite.
Add at retests of HMA that hold (especially near VWAP or prior day levels).
Breakout quality check
Breakouts with rising CVD are more reliable. If price breaks but CVD lags/rolls, be cautious or fade the move back to range.
Divergence (discretionary)
Bearish: Price higher high, CVD/HMA lower high → watch for failure/reversion.
Bullish: Price lower low, CVD/HMA higher low → watch for squeeze/reclaim setups.
Risk management
Use the HMA as a trailing line: exit when CVD loses the HMA after a mature move, or when HMA slope flips against you.
Predicted Funding RatesOverview
The Predicted Funding Rates indicator calculates real-time funding rate estimates for perpetual futures contracts on Binance. It uses triangular weighting algorithms on multiple different timeframes to ensure an accurate prediction.
Funding rates are periodic payments between long and short position holders in perpetual futures markets
If positive, longs pay shorts (usually bullish)
If negative, shorts pay longs (usually bearish)
This is a prediction. Actual funding rates depend on the instantaneous premium index, derived from bid/ask impacts of futures. So whilst it may imitate it similarly, it won't be completely accurate.
This only applies currently to Binance funding rates, as HyperLiquid premium data isn't available. Other Exchanges may be added if their premium data is uploaded.
Methods
Method 1: Collects premium 1-minunute data using triangular weighing over 8 hours. This granular method fills in predicted funding for 4h and less recent data
Method 2: Multi-time frame approach. Daily uses 1 hour data in the calculation, 4h + timeframes use 15M data. This dynamic method fills in higher timeframes and parts where there's unavailable premium data on the 1min.
How it works
1) Premium data is collected across multiple timeframes (depending on the timeframe)
2) Triangular weighing is applied to emphasize recent data points linearly
Tri_Weighing = (data *1 + data *2 + data *3 + data *4) / (1+2+3+4)
3) Finally, the funding rate is calculated
FundingRate = Premium + clamp(interest rate - Premium, -0.05, 0.05)
where the interest rate is 0.01% as per Binance
Triangular weighting is calculated on collected premium data, where recent data receives progressively higher weight (1, 2, 3, 4...). This linear weighting scheme provides responsiveness to recent market conditions while maintaining stability, similar to an exponential moving average but with predictable, linear characteristics
A visual representation:
Data points: ──────────────>
Weights: 1 2 3 4 5
Importance: ▂ ▃ ▅ ▆ █
How to use it
For futures traders:
If funding is trending up, the market can be interpreted as being in a bull market
If trending down, the market can be interpreted as being in a bear market
Even used simply, it allows you to gauge roughly how well the market is performing per funding. It can basically be gauged as a sentiment indicator too
For funding rate traders:
If funding is up, it can indicate a long on implied APR values
If funding is down, it can indicate a short on implied APR values
It also includes an underlying APR, which is the annualized funding rate. For Binance, it is current funding * (24/8) * 365
For Position Traders: Monitor predicted funding rates before entering large positions. Extremely high positive rates (>0.05% for 8-hour periods) suggest overleveraged longs and potential reversal risk. Conversely, extreme negative rates indicate shorts dominance
Table:
Funding rate: Gives the predicted funding rate as a percentage
Current premium: Displays the current premium (difference between perpetual futures price and the underlying spot) as a percentage
Funding period: You can choose between 1 hour funding (HyperLiquid usually) and 8 hour funding (Binance)
APR: Underlying annualized funding rate
What makes it original
Whilst some predicted funding scripts exist, some aren't as accurate or have gaps in data. And seeing as funding values are generally missing from TV tickers, this gives traders accessibility to the script when they would have to use other platforms
Notes
Currently only compatible with symbols that have Binance USDT premium indices
Optimal accuracy is found on timeframes that are 4H or less. On higher timeframes, the accuracy drops off
Actual funding rates may differ
Inputs
Funding Period: Choose between "8 Hour" (standard Binance cycle) or "1 Hour" (divides the 8-hour rate by 8 for granular comparison)
Plot Type: Display as "Funding Rate" (percentage per interval) or "APR" (annualized rate calculated as 8-hour rate × 3 × 365)
Table: Toggle the information table showing current funding rate, premium, funding period, and APR in the top-right corner
Positive Colour: Sets the colour for positive funding rates where longs pay shorts (default: #00ffbb turquoise)
Negative Colour: Sets the colour for negative funding rates where shorts pay longs (default: red)
Table Background: Controls the background colour and transparency of the information table (default: transparent dark blue)
Table Text Colour: Sets the colour for all text labels in the information table (default: white)
Table Text Size: Controls font size with options from Tiny to Huge, with Small as the default balance of readability and space
Relative Performance Indicator - TrendSpider StyleRelative Performance Indicator - TrendSpider Style
📈 Overview
This Relative Performance (RP) indicator measures how your stock is performing compared to a benchmark index, displayed as a percentile ranking from 0-100. Based on TrendSpider's methodology, it answers the critical question: "Is this stock a leader or a laggard?"
Unlike simple ratio charts, this indicator uses percentile ranking to normalize relative performance, making it easy to identify when a stock is showing exceptional strength (>80) or concerning weakness (<20) compared to its historical relationship with the benchmark.
✨ Key Features
Three Calculation Modes:
Quarterly: 3-month relative performance for swing trading
Yearly: Weighted 4-quarter performance for position trading
TechRank: Composite of 6 technical indicators for multi-factor analysis
Clean Visual Design:
Green fills above 80 (strong outperformance)
Red fills below 20 (significant underperformance)
Dotted median line at 50 for quick reference
Current value label for instant reading
Flexible Benchmarks:
Compare against major indices (SPY, QQQ, IWM)
Sector ETFs for within-sector analysis
Custom symbols for specialized comparisons
Built-in Alerts:
Strong performance zone entry (>80)
Weak performance zone entry (<20)
Median crossovers (50 level)
📊 How To Use
Buy Signals:
RP crosses above 80: Stock entering leadership status
RP holding above 60: Maintaining relative strength
RP rising while price consolidating: Accumulation phase
Sell/Avoid Signals:
RP drops below 50: Losing relative strength
RP below 20: Significant underperformance
RP falling while price rising: Bearish divergence
Sector Rotation:
Compare multiple assets to find strongest sectors
Rotate into high RP assets (>70)
Exit low RP positions (<30)
🎯 Reading The Values
80-100: Exceptional outperformance - Strong buy/hold
60-80: Moderate outperformance - Hold positions
40-60: Market perform - No edge
20-40: Underperformance - Caution/reduce
0-20: Severe underperformance - Avoid/exit
⚙️ Calculation Method
Calculates percentage performance of both your stock and the benchmark
Finds the performance differential
Ranks this differential against historical values using percentile analysis
Normalizes to 0-100 scale for easy interpretation
This percentile approach adapts to different market conditions and volatility regimes, providing consistent signals whether in trending or choppy markets.
💡 Pro Tips
For Growth Stocks: Use quarterly mode with QQQ as benchmark
For Value Stocks: Use yearly mode with SPY as benchmark
For Small Caps: Compare against IWM, not SPY
For Sector Analysis: Use sector ETFs (XLK, XLF, XLE, etc.)
Combine with Price Action: High RP + price breakout = powerful signal
⚠️ Important Notes
RP is relative, not absolute - stocks can fall with high RP if the market falls harder
Choose appropriate benchmarks for meaningful comparisons
Best used in conjunction with price action and volume analysis
Historical lookback period affects sensitivity (adjustable in settings)
🔧 Customization
Fully customizable visual settings, thresholds, calculation periods, and smoothing options. Adjust the normalization lookback period (default 252 days) to fine-tune sensitivity to your trading timeframe.
📌 Credit
Inspired by TrendSpider's Relative Performance implementation, adapted for TradingView with enhanced customization options and Pine Script v6 optimization.
Tags to include: relativeperformance, relativestrength, percentile, ranking, sectorrotation, benchmark, outperformance, trendspider, marketbreadth, strengthindicator
Category: Momentum Indicators / Trend Analysis
Feel free to modify this description to match your style or add any specific points you want to emphasize!
Engulfing Glitch (15m. 3-bar. Wicks incl.)// ─────────────────────────────────────────────────────────────
// Engulfing Glitch (15m)
// Detects bullish/bearish engulfing patterns with wicks after
// 3 opposite candles on the 15m timeframe.
// Colors the full candle (body + wick + border).
// Generates alerts at bar close and optional ~5m pre-close alerts.
// Strategy reference: "Money Glitch"
// ─────────────────────────────────────────────────────────────
//@version=6
indicator(title="Engulfing Glitch (15m)", shorttitle="Glitch 15m", overlay=true)
Engulfing Glitch (15m; including Wicks; 3-bar Context)Detects bullish/bearish engulfing patterns with wicks after 3 opposite candles.
Colors the full candle and triggers alerts at close or 5 minutes before bar close.
Daily Weekly Monthly Yearly previous and Opens ( ehab )Daily / Weekly / Monthly / Yearly — Opens & Previous Opens
Lightweight indicator that plots the current open and the previous period’s open for the four key cycles: Daily, Weekly, Monthly, and Yearly. It’s built for quick bias reads, gap context, and clean retest zones.
Features
Toggle each timeframe independently (D/W/M/Y).
Clean lines with customizable color and width.
Optional labels for level name and price.
Works on any symbol and timeframe.
No repaint (levels are fixed once the period opens).
How to use
Trading above today’s open skews bullish; below skews bearish.
Watch price reaction at previous period opens as support/resistance.
Add confluence with your S/R, VWAP, or pivots for higher-quality setups.
Note: This is a reference-level tool, not an entry/exit signal. Keep only the levels you need to avoid chart clutter.
Market Zone Analyzer[BullByte]Understanding the Market Zone Analyzer
---
1. Purpose of the Indicator
The Market Zone Analyzer is a Pine Script™ (version 6) indicator designed to streamline market analysis on TradingView. Rather than scanning multiple separate tools, it unifies four core dimensions—trend strength, momentum, price action, and market activity—into a single, consolidated view. By doing so, it helps traders:
• Save time by avoiding manual cross-referencing of disparate signals.
• Reduce decision-making errors that can arise from juggling multiple indicators.
• Gain a clear, reliable read on whether the market is in a bullish, bearish, or sideways phase, so they can more confidently decide to enter, exit, or hold a position.
---
2. Why a Trader Should Use It
• Unified View: Combines all essential market dimensions into one easy-to-read score and dashboard, eliminating the need to piece together signals manually.
• Adaptability: Automatically adjusts its internal weighting for trend, momentum, and price action based on current volatility. Whether markets are choppy or calm, the indicator remains relevant.
• Ease of Interpretation: Outputs a simple “BULLISH,” “BEARISH,” or “SIDEWAYS” label, supplemented by an intuitive on-chart dashboard and an oscillator plot that visually highlights market direction.
• Reliability Features: Built-in smoothing of the net score and hysteresis logic (requiring consecutive confirmations before flips) minimize false signals during noisy or range-bound phases.
---
3. Why These Specific Indicators?
This script relies on a curated set of well-established technical tools, each chosen for its particular strength in measuring one of the four core dimensions:
1. Trend Strength:
• ADX/DMI (Average Directional Index / Directional Movement Index): Measures how strong a trend is, and whether the +DI line is above the –DI line (bullish) or vice versa (bearish).
• Moving Average Slope (Fast MA vs. Slow MA): Compares a shorter-period SMA to a longer-period SMA; if the fast MA sits above the slow MA, it confirms an uptrend, and vice versa for a downtrend.
• Ichimoku Cloud Differential (Senkou A vs. Senkou B): Provides a forward-looking view of trend direction; Senkou A above Senkou B signals bullishness, and the opposite signals bearishness.
2. Momentum:
• Relative Strength Index (RSI): Identifies overbought (above its dynamically calculated upper bound) or oversold (below its lower bound) conditions; changes in RSI often precede price reversals.
• Stochastic %K: Highlights shifts in short-term momentum by comparing closing price to the recent high/low range; values above its upper band signal bullish momentum, below its lower band signal bearish momentum.
• MACD Histogram: Measures the difference between the MACD line and its signal line; a positive histogram indicates upward momentum, a negative histogram indicates downward momentum.
3. Price Action:
• Highest High / Lowest Low (HH/LL) Range: Over a defined lookback period, this captures breakout or breakdown levels. A closing price near the recent highs (with a positive MA slope) yields a bullish score, and near the lows (with a negative MA slope) yields a bearish score.
• Heikin-Ashi Doji Detection: Uses Heikin-Ashi candles to identify indecision or continuation patterns. A small Heikin-Ashi body (doji) relative to recent volatility is scored as neutral; a larger body in the direction of the MA slope is scored bullish or bearish.
• Candle Range Measurement: Compares each candle’s high-low range against its own dynamic band (average range ± standard deviation). Large candles aligning with the prevailing trend score bullish or bearish accordingly; unusually small candles can indicate exhaustion or consolidation.
4. Market Activity:
• Bollinger Bands Width (BBW): Measures the distance between BB upper and lower bands; wide bands indicate high volatility, narrow bands indicate low volatility.
• Average True Range (ATR): Quantifies average price movement (volatility). A sudden spike in ATR suggests a volatile environment, while a contraction suggests calm.
• Keltner Channels Width (KCW): Similar to BBW but uses ATR around an EMA. Provides a second layer of volatility context, confirming or contrasting BBW readings.
• Volume (with Moving Average): Compares current volume to its moving average ± standard deviation. High volume validates strong moves; low volume signals potential lack of conviction.
By combining these tools, the indicator captures trend direction, momentum strength, price-action nuances, and overall market energy, yielding a more balanced and comprehensive assessment than any single tool alone.
---
4. What Makes This Indicator Stand Out
• Multi-Dimensional Analysis: Rather than relying on a lone oscillator or moving average crossover, it simultaneously evaluates trend, momentum, price action, and activity.
• Dynamic Weighting: The relative importance of trend, momentum, and price action adjusts automatically based on real-time volatility (Market Activity State). For example, in highly volatile conditions, trend and momentum signals carry more weight; in calm markets, price action signals are prioritized.
• Stability Mechanisms:
• Smoothing: The net score is passed through a short moving average, filtering out noise, especially on lower timeframes.
• Hysteresis: Both Market Activity State and the final bullish/bearish/sideways zone require two consecutive confirmations before flipping, reducing whipsaw.
• Visual Interpretation: A fully customizable on-chart dashboard displays each sub-indicator’s value, regime, score, and comment, all color-coded. The oscillator plot changes color to reflect the current market zone (green for bullish, red for bearish, gray for sideways) and shows horizontal threshold lines at +2, 0, and –2.
---
5. Recommended Timeframes
• Short-Term (5 min, 15 min): Day traders and scalpers can benefit from rapid signals, but should enable smoothing (and possibly disable hysteresis) to reduce false whipsaws.
• Medium-Term (1 h, 4 h): Swing traders find a balance between responsiveness and reliability. Less smoothing is required here, and the default parameters (e.g., ADX length = 14, RSI length = 14) perform well.
• Long-Term (Daily, Weekly): Position traders tracking major trends can disable smoothing for immediate raw readings, since higher-timeframe noise is minimal. Adjust lookback lengths (e.g., increase adxLength, rsiLength) if desired for slower signals.
Tip: If you keep smoothing off, stick to timeframes of 1 h or higher to avoid excessive signal “chatter.”
---
6. How Scoring Works
A. Individual Indicator Scores
Each sub-indicator is assigned one of three discrete scores:
• +1 if it indicates a bullish condition (e.g., RSI above its dynamically calculated upper bound).
• 0 if it is neutral (e.g., RSI between upper and lower bounds).
• –1 if it indicates a bearish condition (e.g., RSI below its dynamically calculated lower bound).
Examples of individual score assignments:
• ADX/DMI:
• +1 if ADX ≥ adxThreshold and +DI > –DI (strong bullish trend)
• –1 if ADX ≥ adxThreshold and –DI > +DI (strong bearish trend)
• 0 if ADX < adxThreshold (trend strength below threshold)
• RSI:
• +1 if RSI > RSI_upperBound
• –1 if RSI < RSI_lowerBound
• 0 otherwise
• ATR (as part of Market Activity):
• +1 if ATR > (ATR_MA + stdev(ATR))
• –1 if ATR < (ATR_MA – stdev(ATR))
• 0 otherwise
Each of the four main categories shares this same +1/0/–1 logic across their sub-components.
B. Category Scores
Once each sub-indicator reports +1, 0, or –1, these are summed within their categories as follows:
• Trend Score = (ADX score) + (MA slope score) + (Ichimoku differential score)
• Momentum Score = (RSI score) + (Stochastic %K score) + (MACD histogram score)
• Price Action Score = (Highest-High/Lowest-Low score) + (Heikin-Ashi doji score) + (Candle range score)
• Market Activity Raw Score = (BBW score) + (ATR score) + (KC width score) + (Volume score)
Each category’s summed value can range between –3 and +3 (for Trend, Momentum, and Price Action), and between –4 and +4 for Market Activity raw.
C. Market Activity State and Dynamic Weight Adjustments
Rather than contributing directly to the netScore like the other three categories, Market Activity determines how much weight to assign to Trend, Momentum, and Price Action:
1. Compute Market Activity Raw Score by summing BBW, ATR, KCW, and Volume individual scores (each +1/0/–1).
2. Bucket into High, Medium, or Low Activity:
• High if raw Score ≥ 2 (volatile market).
• Low if raw Score ≤ –2 (calm market).
• Medium otherwise.
3. Apply Hysteresis (if enabled): The state only flips after two consecutive bars register the same high/low/medium label.
4. Set Category Weights:
• High Activity: Trend = 50 %, Momentum = 35 %, Price Action = 15 %.
• Low Activity: Trend = 25 %, Momentum = 20 %, Price Action = 55 %.
• Medium Activity: Use the trader’s base weight inputs (e.g., Trend = 40 %, Momentum = 30 %, Price Action = 30 % by default).
D. Calculating the Net Score
5. Normalize Base Weights (so that the sum of Trend + Momentum + Price Action always equals 100 %).
6. Determine Current Weights based on the Market Activity State (High/Medium/Low).
7. Compute Each Category’s Contribution: Multiply (categoryScore) × (currentWeight).
8. Sum Contributions to get the raw netScore (a floating-point value that can exceed ±3 when scores are strong).
9. Smooth the netScore over two bars (if smoothing is enabled) to reduce noise.
10. Apply Hysteresis to the Final Zone:
• If the smoothed netScore ≥ +2, the bar is classified as “Bullish.”
• If the smoothed netScore ≤ –2, the bar is classified as “Bearish.”
• Otherwise, it is “Sideways.”
• To prevent rapid flips, the script requires two consecutive bars in the new zone before officially changing the displayed zone (if hysteresis is on).
E. Thresholds for Zone Classification
• BULLISH: netScore ≥ +2
• BEARISH: netScore ≤ –2
• SIDEWAYS: –2 < netScore < +2
---
7. Role of Volatility (Market Activity State) in Scoring
Volatility acts as a dynamic switch that shifts which category carries the most influence:
1. High Activity (Volatile):
• Detected when at least two sub-scores out of BBW, ATR, KCW, and Volume equal +1.
• The script sets Trend weight = 50 % and Momentum weight = 35 %. Price Action weight is minimized at 15 %.
• Rationale: In volatile markets, strong trending moves and momentum surges dominate, so those signals are more reliable than nuanced candle patterns.
2. Low Activity (Calm):
• Detected when at least two sub-scores out of BBW, ATR, KCW, and Volume equal –1.
• The script sets Price Action weight = 55 %, Trend = 25 %, and Momentum = 20 %.
• Rationale: In quiet, sideways markets, subtle price-action signals (breakouts, doji patterns, small-range candles) are often the best early indicators of a new move.
3. Medium Activity (Balanced):
• Raw Score between –1 and +1 from the four volatility metrics.
• Uses whatever base weights the trader has specified (e.g., Trend = 40 %, Momentum = 30 %, Price Action = 30 %).
Because volatility can fluctuate rapidly, the script employs hysteresis on Market Activity State: a new High or Low state must occur on two consecutive bars before weights actually shift. This avoids constant back-and-forth weight changes and provides more stability.
---
8. Scoring Example (Hypothetical Scenario)
• Symbol: Bitcoin on a 1-hour chart.
• Market Activity: Raw volatility sub-scores show BBW (+1), ATR (+1), KCW (0), Volume (+1) → Total raw Score = +3 → High Activity.
• Weights Selected: Trend = 50 %, Momentum = 35 %, Price Action = 15 %.
• Trend Signals:
• ADX strong and +DI > –DI → +1
• Fast MA above Slow MA → +1
• Ichimoku Senkou A > Senkou B → +1
→ Trend Score = +3
• Momentum Signals:
• RSI above upper bound → +1
• MACD histogram positive → +1
• Stochastic %K within neutral zone → 0
→ Momentum Score = +2
• Price Action Signals:
• Highest High/Lowest Low check yields 0 (close not near extremes)
• Heikin-Ashi doji reading is neutral → 0
• Candle range slightly above upper bound but trend is strong, so → +1
→ Price Action Score = +1
• Compute Net Score (before smoothing):
• Trend contribution = 3 × 0.50 = 1.50
• Momentum contribution = 2 × 0.35 = 0.70
• Price Action contribution = 1 × 0.15 = 0.15
• Raw netScore = 1.50 + 0.70 + 0.15 = 2.35
• Since 2.35 ≥ +2 and hysteresis is met, the final zone is “Bullish.”
Although the netScore lands at 2.35 (Bullish), smoothing might bring it slightly below 2.00 on the first bar (e.g., 1.90), in which case the script would wait for a second consecutive reading above +2 before officially classifying the zone as Bullish (if hysteresis is enabled).
---
9. Correlation Between Categories
The four categories—Trend Strength, Momentum, Price Action, and Market Activity—often reinforce or offset one another. The script takes advantage of these natural correlations:
• Bullish Alignment: If ADX is strong and pointed upward, fast MA is above slow MA, and Ichimoku is positive, that usually coincides with RSI climbing above its upper bound and the MACD histogram turning positive. In such cases, both Trend and Momentum categories generate +1 or +2. Because the Market Activity State is likely High (given the accompanying volatility), Trend and Momentum weights are at their peak, so the netScore quickly crosses into Bullish territory.
• Sideways/Consolidation: During a low-volatility, sideways phase, ADX may fall below its threshold, MAs may flatten, and RSI might hover in the neutral band. However, subtle price-action signals (like a small breakout candle or a Heikin-Ashi candle with a slight bias) can still produce a +1 in the Price Action category. If Market Activity is Low, Price Action’s weight (55 %) can carry enough influence—even if Trend and Momentum are neutral—to push the netScore out of “Sideways” into a mild bullish or bearish bias.
• Opposing Signals: When Trend is bullish but Momentum turns negative (for example, price continues up but RSI rolls over), the two scores can partially cancel. Market Activity may remain Medium, in which case the netScore lingers near zero (Sideways). The trader can then wait for either a clearer momentum shift or a fresh price-action breakout before committing.
By dynamically recognizing these correlations and adjusting weights, the indicator ensures that:
• When Trend and Momentum align (and volatility supports it), the netScore leaps strongly into Bullish or Bearish.
• When Trend is neutral but Price Action shows an early move in a low-volatility environment, Price Action’s extra weight in the Low Activity State can still produce actionable signals.
---
10. Market Activity State & Its Role (Detailed)
The Market Activity State is not a direct category score—it is an overarching context setter for how heavily to trust Trend, Momentum, or Price Action. Here’s how it is derived and applied:
1. Calculate Four Volatility Sub-Scores:
• BBW: Compare the current band width to its own moving average ± standard deviation. If BBW > (BBW_MA + stdev), assign +1 (high volatility); if BBW < (BBW_MA × 0.5), assign –1 (low volatility); else 0.
• ATR: Compare ATR to its moving average ± standard deviation. A spike above the upper threshold is +1; a contraction below the lower threshold is –1; otherwise 0.
• KCW: Same logic as ATR but around the KCW mean.
• Volume: Compare current volume to its volume MA ± standard deviation. Above the upper threshold is +1; below the lower threshold is –1; else 0.
2. Sum Sub-Scores → Raw Market Activity Score: Range between –4 and +4.
3. Assign Market Activity State:
• High Activity: Raw Score ≥ +2 (at least two volatility metrics are strongly spiking).
• Low Activity: Raw Score ≤ –2 (at least two metrics signal unusually low volatility or thin volume).
• Medium Activity: Raw Score is between –1 and +1 inclusive.
4. Hysteresis for Stability:
• If hysteresis is enabled, a new state only takes hold after two consecutive bars confirm the same High, Medium, or Low label.
• This prevents the Market Activity State from bouncing around when volatility is on the fence.
5. Set Category Weights Based on Activity State:
• High Activity: Trend = 50 %, Momentum = 35 %, Price Action = 15 %.
• Low Activity: Trend = 25 %, Momentum = 20 %, Price Action = 55 %.
• Medium Activity: Use trader’s base weights (e.g., Trend = 40 %, Momentum = 30 %, Price Action = 30 %).
6. Impact on netScore: Because category scores (–3 to +3) multiply by these weights, High Activity amplifies the effect of strong Trend and Momentum scores; Low Activity amplifies the effect of Price Action.
7. Market Context Tooltip: The dashboard includes a tooltip summarizing the current state—e.g., “High activity, trend and momentum prioritized,” “Low activity, price action prioritized,” or “Balanced market, all categories considered.”
---
11. Category Weights: Base vs. Dynamic
Traders begin by specifying base weights for Trend Strength, Momentum, and Price Action that sum to 100 %. These apply only when volatility is in the Medium band. Once volatility shifts:
• High Volatility Overrides:
• Trend jumps from its base (e.g., 40 %) to 50 %.
• Momentum jumps from its base (e.g., 30 %) to 35 %.
• Price Action is reduced to 15 %.
Example: If base weights were Trend = 40 %, Momentum = 30 %, Price Action = 30 %, then in High Activity they become 50/35/15. A Trend score of +3 now contributes 3 × 0.50 = +1.50 to netScore; a Momentum +2 contributes 2 × 0.35 = +0.70. In total, Trend + Momentum can easily push netScore above the +2 threshold on its own.
• Low Volatility Overrides:
• Price Action leaps from its base (30 %) to 55 %.
• Trend falls to 25 %, Momentum falls to 20 %.
Why? When markets are quiet, subtle candle breakouts, doji patterns, and small-range expansions tend to foreshadow the next swing more effectively than raw trend readings. A Price Action score of +3 in this state contributes 3 × 0.55 = +1.65, which can carry the netScore toward +2—even if Trend and Momentum are neutral or only mildly positive.
Because these weight shifts happen only after two consecutive bars confirm a High or Low state (if hysteresis is on), the indicator avoids constantly flipping its emphasis during borderline volatility phases.
---
12. Dominant Category Explained
Within the dashboard, a label such as “Trend Dominant,” “Momentum Dominant,” or “Price Action Dominant” appears when one category’s absolute weighted contribution to netScore is the largest. Concretely:
• Compute each category’s weighted contribution = (raw category score) × (current weight).
• Compare the absolute values of those three contributions.
• The category with the highest absolute value is flagged as Dominant for that bar.
Why It Matters:
• Momentum Dominant: Indicates that the combined force of RSI, Stochastic, and MACD (after weighting) is pushing netScore farther than either Trend or Price Action. In practice, it means that short-term sentiment and speed of change are the primary drivers right now, so traders should watch for continued momentum signals before committing to a trade.
• Trend Dominant: Means ADX, MA slope, and Ichimoku (once weighted) outweigh the other categories. This suggests a strong directional move is in place; trend-following entries or confirming pullbacks are likely to succeed.
• Price Action Dominant: Occurs when breakout/breakdown patterns, Heikin-Ashi candle readings, and range expansions (after weighting) are the most influential. This often happens in calmer markets, where subtle shifts in candle structure can foreshadow bigger moves.
By explicitly calling out which category is carrying the most weight at any moment, the dashboard gives traders immediate insight into why the netScore is tilting toward bullish, bearish, or sideways.
---
13. Oscillator Plot: How to Read It
The “Net Score” oscillator sits below the dashboard and visually displays the smoothed netScore as a line graph. Key features:
1. Value Range: In normal conditions it oscillates roughly between –3 and +3, but extreme confluences can push it outside that range.
2. Horizontal Threshold Lines:
• +2 Line (Bullish threshold)
• 0 Line (Neutral midline)
• –2 Line (Bearish threshold)
3. Zone Coloring:
• Green Background (Bullish Zone): When netScore ≥ +2.
• Red Background (Bearish Zone): When netScore ≤ –2.
• Gray Background (Sideways Zone): When –2 < netScore < +2.
4. Dynamic Line Color:
• The plotted netScore line itself is colored green in a Bullish Zone, red in a Bearish Zone, or gray in a Sideways Zone, creating an immediate visual cue.
Interpretation Tips:
• Crossing Above +2: Signals a strong enough combined trend/momentum/price-action reading to classify as Bullish. Many traders wait for a clear crossing plus a confirmation candle before entering a long position.
• Crossing Below –2: Indicates a strong Bearish signal. Traders may consider short or exit strategies.
• Rising Slope, Even Below +2: If netScore climbs steadily from neutral toward +2, it demonstrates building bullish momentum.
• Divergence: If price makes a higher high but the oscillator fails to reach a new high, it can warn of weakening momentum and a potential reversal.
---
14. Comments and Their Necessity
Every sub-indicator (ADX, MA slope, Ichimoku, RSI, Stochastic, MACD, HH/LL, Heikin-Ashi, Candle Range, BBW, ATR, KCW, Volume) generates a short comment that appears in the detailed dashboard. Examples:
• “Strong bullish trend” or “Strong bearish trend” for ADX/DMI
• “Fast MA above slow MA” or “Fast MA below slow MA” for MA slope
• “RSI above dynamic threshold” or “RSI below dynamic threshold” for RSI
• “MACD histogram positive” or “MACD histogram negative” for MACD Hist
• “Price near highs” or “Price near lows” for HH/LL checks
• “Bullish Heikin Ashi” or “Bearish Heikin Ashi” for HA Doji scoring
• “Large range, trend confirmed” or “Small range, trend contradicted” for Candle Range
Additionally, the top-row comment for each category is:
• Trend: “Highly Bullish,” “Highly Bearish,” or “Neutral Trend.”
• Momentum: “Strong Momentum,” “Weak Momentum,” or “Neutral Momentum.”
• Price Action: “Bullish Action,” “Bearish Action,” or “Neutral Action.”
• Market Activity: “Volatile Market,” “Calm Market,” or “Stable Market.”
Reasons for These Comments:
• Transparency: Shows exactly how each sub-indicator contributed to its category score.
• Education: Helps traders learn why a category is labeled bullish, bearish, or neutral, building intuition over time.
• Customization: If, for example, the RSI comment says “RSI neutral” despite an impending trend shift, a trader might choose to adjust RSI length or thresholds.
In the detailed dashboard, hovering over each comment cell also reveals a tooltip with additional context (e.g., “Fast MA above slow MA” or “Senkou A above Senkou B”), helping traders understand the precise rule behind that +1, 0, or –1 assignment.
---
15. Real-Life Example (Consolidated)
• Instrument & Timeframe: Bitcoin (BTCUSD), 1-hour chart.
• Current Market Activity: BBW and ATR both spike (+1 each), KCW is moderately high (+1), but volume is only neutral (0) → Raw Market Activity Score = +2 → State = High Activity (after two bars, if hysteresis is on).
• Category Weights Applied: Trend = 50 %, Momentum = 35 %, Price Action = 15 %.
• Trend Sub-Scores:
1. ADX = 25 (above threshold 20) with +DI > –DI → +1.
2. Fast MA (20-period) sits above Slow MA (50-period) → +1.
3. Ichimoku: Senkou A > Senkou B → +1.
→ Trend Score = +3.
• Momentum Sub-Scores:
4. RSI = 75 (above its moving average +1 stdev) → +1.
5. MACD histogram = +0.15 → +1.
6. Stochastic %K = 50 (mid-range) → 0.
→ Momentum Score = +2.
• Price Action Sub-Scores:
7. Price is not within 1 % of the 20-period high/low and slope = positive → 0.
8. Heikin-Ashi body is slightly larger than stdev over last 5 bars with haClose > haOpen → +1.
9. Candle range is just above its dynamic upper bound but trend is already captured, so → +1.
→ Price Action Score = +2.
• Calculate netScore (before smoothing):
• Trend contribution = 3 × 0.50 = 1.50
• Momentum contribution = 2 × 0.35 = 0.70
• Price Action contribution = 2 × 0.15 = 0.30
• Raw netScore = 1.50 + 0.70 + 0.30 = 2.50 → Immediately classified as Bullish.
• Oscillator & Dashboard Output:
• The oscillator line crosses above +2 and turns green.
• Dashboard displays:
• Trend Regime “BULLISH,” Trend Score = 3, Comment = “Highly Bullish.”
• Momentum Regime “BULLISH,” Momentum Score = 2, Comment = “Strong Momentum.”
• Price Action Regime “BULLISH,” Price Action Score = 2, Comment = “Bullish Action.”
• Market Activity State “High,” Comment = “Volatile Market.”
• Weights: Trend 50 %, Momentum 35 %, Price Action 15 %.
• Dominant Category: Trend (because 1.50 > 0.70 > 0.30).
• Overall Score: 2.50, posCount = (three +1s in Trend) + (two +1s in Momentum) + (two +1s in Price Action) = 7 bullish signals, negCount = 0.
• Final Zone = “BULLISH.”
• The trader sees that both Trend and Momentum are reinforcing each other under high volatility. They might wait one more candle for confirmation but already have strong evidence to consider a long.
---
• .
---
Disclaimer
This indicator is strictly a technical analysis tool and does not constitute financial advice. All trading involves risk, including potential loss of capital. Past performance is not indicative of future results. Traders should:
• Always backtest the “Market Zone Analyzer ” on their chosen symbols and timeframes before committing real capital.
• Combine this tool with sound risk management, position sizing, and, if possible, fundamental analysis.
• Understand that no indicator is foolproof; always be prepared for unexpected market moves.
Goodluck
-BullByte!
---
MTF_DrawingsLibrary 'MTF_Drawings'
This library helps with drawing indicators and candle charts on all timeframes.
FEATURES
CHART DRAWING : Library provides functions for drawing High Time Frame (HTF) and Low Time Frame (LTF) candles.
INDICATOR DRAWING : Library provides functions for drawing various types of HTF and LTF indicators.
CUSTOM COLOR DRAWING : Library allows to color candles and indicators based on specific conditions.
LINEFILLS : Library provides functions for drawing linefills.
CATEGORIES
The functions are named in a way that indicates they purpose:
{Ind} : Function is meant only for indicators.
{Hist} : Function is meant only for histograms.
{Candle} : Function is meant only for candles.
{Draw} : Function draws indicators, histograms and candle charts.
{Populate} : Function generates necessary arrays required by drawing functions.
{LTF} : Function is meant only for lower timeframes.
{HTF} : Function is meant only for higher timeframes.
{D} : Function draws indicators that are composed of two lines.
{CC} : Function draws custom colored indicators.
USAGE
Import the library into your script.
Before using any {Draw} function it is necessary to use a {Populate} function.
Choose the appropriate one based on the category, provide the necessary arguments, and then use the {Draw} function, forwarding the arrays generated by the {Populate} function.
This doesn't apply to {Draw_Lines}, {LineFill}, or {Barcolor} functions.
EXAMPLE
import Spacex_trader/MTF_Drawings/1 as tf
//Request lower timeframe data.
Security(simple string Ticker, simple string New_LTF, float Ind) =>
float Value = request.security_lower_tf(Ticker, New_LTF, Ind)
Value
Timeframe = input.timeframe('1', 'Timeframe: ')
tf.Draw_Ind(tf.Populate_LTF_Ind(Security(syminfo.tickerid, Timeframe, ta.rsi(close, 14)), 498, color.purple), 1, true)
FUNCTION LIST
HTF_Candle(BarsBack, BodyBear, BodyBull, BordersBear, BordersBull, WickBear, WickBull, LineStyle, BoxStyle, LineWidth, HTF_Open, HTF_High, HTF_Low, HTF_Close, HTF_Bar_Index)
Populates two arrays with drawing data of the HTF candles.
Parameters:
BarsBack (int) : Bars number to display.
BodyBear (color) : Candle body bear color.
BodyBull (color) : Candle body bull color.
BordersBear (color) : Candle border bear color.
BordersBull (color) : Candle border bull color.
WickBear (color) : Candle wick bear color.
WickBull (color) : Candle wick bull color.
LineStyle (string) : Wick style (Solid-Dotted-Dashed).
BoxStyle (string) : Border style (Solid-Dotted-Dashed).
LineWidth (int) : Wick width.
HTF_Open (float) : HTF open price.
HTF_High (float) : HTF high price.
HTF_Low (float) : HTF low price.
HTF_Close (float) : HTF close price.
HTF_Bar_Index (int) : HTF bar_index.
Returns: Two arrays with drawing data of the HTF candles.
LTF_Candle(BarsBack, BodyBear, BodyBull, BordersBear, BordersBull, WickBear, WickBull, LineStyle, BoxStyle, LineWidth, LTF_Open, LTF_High, LTF_Low, LTF_Close)
Populates two arrays with drawing data of the LTF candles.
Parameters:
BarsBack (int) : Bars number to display.
BodyBear (color) : Candle body bear color.
BodyBull (color) : Candle body bull color.
BordersBear (color) : Candle border bear color.
BordersBull (color) : Candle border bull color.
WickBear (color) : Candle wick bear color.
WickBull (color) : Candle wick bull color.
LineStyle (string) : Wick style (Solid-Dotted-Dashed).
BoxStyle (string) : Border style (Solid-Dotted-Dashed).
LineWidth (int) : Wick width.
LTF_Open (float ) : LTF open price.
LTF_High (float ) : LTF high price.
LTF_Low (float ) : LTF low price.
LTF_Close (float ) : LTF close price.
Returns: Two arrays with drawing data of the LTF candles.
Draw_Candle(Box, Line, Offset)
Draws HTF or LTF candles.
Parameters:
Box (box ) : Box array with drawing data.
Line (line ) : Line array with drawing data.
Offset (int) : Offset of the candles.
Returns: Drawing of the candles.
Populate_HTF_Ind(IndValue, BarsBack, IndColor, HTF_Bar_Index)
Populates one array with drawing data of the HTF indicator.
Parameters:
IndValue (float) : Indicator value.
BarsBack (int) : Indicator lines to display.
IndColor (color) : Indicator color.
HTF_Bar_Index (int) : HTF bar_index.
Returns: An array with drawing data of the HTF indicator.
Populate_LTF_Ind(IndValue, BarsBack, IndColor)
Populates one array with drawing data of the LTF indicator.
Parameters:
IndValue (float ) : Indicator value.
BarsBack (int) : Indicator lines to display.
IndColor (color) : Indicator color.
Returns: An array with drawing data of the LTF indicator.
Draw_Ind(Line, Mult, Exe)
Draws one HTF or LTF indicator.
Parameters:
Line (line ) : Line array with drawing data.
Mult (int) : Coordinates multiplier.
Exe (bool) : Display the indicator.
Returns: Drawing of the indicator.
Populate_HTF_Ind_D(IndValue_1, IndValue_2, BarsBack, IndColor_1, IndColor_2, HTF_Bar_Index)
Populates two arrays with drawing data of the HTF indicators.
Parameters:
IndValue_1 (float) : First indicator value.
IndValue_2 (float) : Second indicator value.
BarsBack (int) : Indicator lines to display.
IndColor_1 (color) : First indicator color.
IndColor_2 (color) : Second indicator color.
HTF_Bar_Index (int) : HTF bar_index.
Returns: Two arrays with drawing data of the HTF indicators.
Populate_LTF_Ind_D(IndValue_1, IndValue_2, BarsBack, IndColor_1, IndColor_2)
Populates two arrays with drawing data of the LTF indicators.
Parameters:
IndValue_1 (float ) : First indicator value.
IndValue_2 (float ) : Second indicator value.
BarsBack (int) : Indicator lines to display.
IndColor_1 (color) : First indicator color.
IndColor_2 (color) : Second indicator color.
Returns: Two arrays with drawing data of the LTF indicators.
Draw_Ind_D(Line_1, Line_2, Mult, Exe_1, Exe_2)
Draws two LTF or HTF indicators.
Parameters:
Line_1 (line ) : First line array with drawing data.
Line_2 (line ) : Second line array with drawing data.
Mult (int) : Coordinates multiplier.
Exe_1 (bool) : Display the first indicator.
Exe_2 (bool) : Display the second indicator.
Returns: Drawings of the indicators.
Barcolor(Box, Line, BarColor)
Colors the candles based on indicators output.
Parameters:
Box (box ) : Candle box array.
Line (line ) : Candle line array.
BarColor (color ) : Indicator color array.
Returns: Colored candles.
Populate_HTF_Ind_D_CC(IndValue_1, IndValue_2, BarsBack, BullColor, BearColor, IndColor_1, HTF_Bar_Index)
Populates two array with drawing data of the HTF indicators with color based on: IndValue_1 >= IndValue_2 ? BullColor : BearColor.
Parameters:
IndValue_1 (float) : First indicator value.
IndValue_2 (float) : Second indicator value.
BarsBack (int) : Indicator lines to display.
BullColor (color) : Bull color.
BearColor (color) : Bear color.
IndColor_1 (color) : First indicator color.
HTF_Bar_Index (int) : HTF bar_index.
Returns: Three arrays with drawing and color data of the HTF indicators.
Populate_LTF_Ind_D_CC(IndValue_1, IndValue_2, BarsBack, BullColor, BearColor, IndColor_1)
Populates two arrays with drawing data of the LTF indicators with color based on: IndValue_1 >= IndValue_2 ? BullColor : BearColor.
Parameters:
IndValue_1 (float ) : First indicator value.
IndValue_2 (float ) : Second indicator value.
BarsBack (int) : Indicator lines to display.
BullColor (color) : Bull color.
BearColor (color) : Bearcolor.
IndColor_1 (color) : First indicator color.
Returns: Three arrays with drawing and color data of the LTF indicators.
Populate_HTF_Hist_CC(HistValue, IndValue_1, IndValue_2, BarsBack, BullColor, BearColor, HTF_Bar_Index)
Populates one array with drawing data of the HTF histogram with color based on: IndValue_1 >= IndValue_2 ? BullColor : BearColor.
Parameters:
HistValue (float) : Indicator value.
IndValue_1 (float) : First indicator value.
IndValue_2 (float) : Second indicator value.
BarsBack (int) : Indicator lines to display.
BullColor (color) : Bull color.
BearColor (color) : Bearcolor.
HTF_Bar_Index (int) : HTF bar_index
Returns: Two arrays with drawing and color data of the HTF histogram.
Populate_LTF_Hist_CC(HistValue, IndValue_1, IndValue_2, BarsBack, BullColor, BearColor)
Populates one array with drawing data of the LTF histogram with color based on: IndValue_1 >= IndValue_2 ? BullColor : BearColor.
Parameters:
HistValue (float ) : Indicator value.
IndValue_1 (float ) : First indicator value.
IndValue_2 (float ) : Second indicator value.
BarsBack (int) : Indicator lines to display.
BullColor (color) : Bull color.
BearColor (color) : Bearcolor.
Returns: Two array with drawing and color data of the LTF histogram.
Populate_LTF_Hist_CC_VA(HistValue, Value, BarsBack, BullColor, BearColor)
Populates one array with drawing data of the LTF histogram with color based on: HistValue >= Value ? BullColor : BearColor.
Parameters:
HistValue (float ) : Indicator value.
Value (float) : First indicator value.
BarsBack (int) : Indicator lines to display.
BullColor (color) : Bull color.
BearColor (color) : Bearcolor.
Returns: Two array with drawing and color data of the LTF histogram.
Populate_HTF_Ind_CC(IndValue, IndValue_1, BarsBack, BullColor, BearColor, HTF_Bar_Index)
Populates one array with drawing data of the HTF indicator with color based on: IndValue >= IndValue_1 ? BullColor : BearColor.
Parameters:
IndValue (float) : Indicator value.
IndValue_1 (float) : Second indicator value.
BarsBack (int) : Indicator lines to display.
BullColor (color) : Bull color.
BearColor (color) : Bearcolor.
HTF_Bar_Index (int) : HTF bar_index
Returns: Two arrays with drawing and color data of the HTF indicator.
Populate_LTF_Ind_CC(IndValue, IndValue_1, BarsBack, BullColor, BearColor)
Populates one array with drawing data of the LTF indicator with color based on: IndValue >= IndValue_1 ? BullColor : BearColor.
Parameters:
IndValue (float ) : Indicator value.
IndValue_1 (float ) : Second indicator value.
BarsBack (int) : Indicator lines to display.
BullColor (color) : Bull color.
BearColor (color) : Bearcolor.
Returns: Two arrays with drawing and color data of the LTF indicator.
Draw_Lines(BarsBack, y1, y2, LineType, Fill)
Draws price lines on indicators.
Parameters:
BarsBack (int) : Indicator lines to display.
y1 (float) : Coordinates of the first line.
y2 (float) : Coordinates of the second line.
LineType (string) : Line type.
Fill (color) : Fill color.
Returns: Drawing of the lines.
LineFill(Upper, Lower, BarsBack, FillColor)
Fills two lines with linefill HTF or LTF.
Parameters:
Upper (line ) : Upper line.
Lower (line ) : Lower line.
BarsBack (int) : Indicator lines to display.
FillColor (color) : Fill color.
Returns: Linefill of the lines.
Populate_LTF_Hist(HistValue, BarsBack, HistColor)
Populates one array with drawing data of the LTF histogram.
Parameters:
HistValue (float ) : Indicator value.
BarsBack (int) : Indicator lines to display.
HistColor (color) : Indicator color.
Returns: One array with drawing data of the LTF histogram.
Populate_HTF_Hist(HistValue, BarsBack, HistColor, HTF_Bar_Index)
Populates one array with drawing data of the HTF histogram.
Parameters:
HistValue (float) : Indicator value.
BarsBack (int) : Indicator lines to display.
HistColor (color) : Indicator color.
HTF_Bar_Index (int) : HTF bar_index.
Returns: One array with drawing data of the HTF histogram.
Draw_Hist(Box, Mult, Exe)
Draws HTF or LTF histogram.
Parameters:
Box (box ) : Box Array.
Mult (int) : Coordinates multiplier.
Exe (bool) : Display the histogram.
Returns: Drawing of the histogram.
Trend Fib Zone Bounce (TFZB) [KedArc Quant]Description:
Trend Fib Zone Bounce (TFZB) trades with the latest confirmed Supply/Demand zone using a single, configurable Fib pullback (0.3/0.5/0.6). Trade only in the direction of the most recent zone and use a single, configurable fib level for pullback entries.
• Detects market structure via confirmed swing highs/lows using a rolling window.
• Draws Supply/Demand zones (bearish/bullish rectangles) from the latest MSS (CHOCH or BOS) event.
• Computes intra zone Fib guide rails and keeps them extended in real time.
• Triggers BUY only inside bullish zones and SELL only inside bearish zones when price touches the selected fib and closes back beyond it (bounce confirmation).
• Optional labels print BULL/BEAR + fib next to the triangle markers.
What it does
Finds structure using confirmed swing highs/lows (you choose the confirmation length).
Builds the latest zone (bullish = demand, bearish = supply) after a CHOCH/BOS event.
Draws intra-zone “guide rails” (Fib lines) and extends them live.
Signals only with the trend of that zone:
BUY inside a bullish zone when price tags the selected Fib and closes back above it.
SELL inside a bearish zone when price tags the selected Fib and closes back below it.
Optional labels print BULL/BEAR + Fib next to triangles for quick context
Why this is different
Most “zone + fib + signal” tools bolt together several indicators, or fire counter-trend signals because they don’t fully respect structure. TFZB is intentionally minimal:
Single bias source: the latest confirmed zone defines direction; nothing else overrides it.
Single entry rule: one Fib bounce (0.3/0.5/0.6 selectable) inside that zone—no counter-trend trades by design.
Clean visuals: you can show only the most recent zone, clamp overlap, and keep just the rails that matter.
Deterministic & transparent: every plot/label comes from the code you see—no external series or hidden smoothing
How it helps traders
Cuts decision noise: you always know the bias and the only entry that matters right now.
Forces discipline: if price isn’t inside the active zone, you don’t trade.
Adapts to volatility: pick 0.3 in strong trends, 0.5 as the default, 0.6 in chop.
Non-repainting zones: swings are confirmed after Structure Length bars, then used to build zones that extend forward (they don’t “teleport” later)
How it works (details)
*Structure confirmation
A swing high/low is only confirmed after Structure Length bars have elapsed; the dot is plotted back on the original bar using offset. Expect a confirmation delay of about Structure Length × timeframe.
*Zone creation
After a CHOCH/BOS (momentum shift / break of prior swing), TFZB draws the new Supply/Demand zone from the swing anchors and sets it active.
*Fib guide rails
Inside the active zone TFZB projects up to five Fib lines (defaults: 0.3 / 0.5 / 0.7) and extends them as time passes.
*Entry logic (with-trend only)
BUY: bar’s low ≤ fib and close > fib inside a bullish zone.
SELL: bar’s high ≥ fib and close < fib inside a bearish zone.
*Optionally restrict to one signal per zone to avoid over-trading.
(Optional) Aggressive confirm-bar entry
When do the swing dots print?
* The code confirms a swing only after `structureLen` bars have elapsed since that candidate high/low.
* On a 5-min chart with `structureLen = 10`, that’s about 50 minutes later.
* When the swing confirms, the script plots the dot back on the original bar (via `offset = -structureLen`). So you *see* the dot on the old bar, but it only appears on the chart once the confirming bar arrives.
> Practical takeaway: expect swing markers to appear roughly `structureLen × timeframe` later. Zones and signals are built from those confirmed swings.
Best timeframe for this Indicator
Use the timeframe that matches your holding period and the noise level of the instrument:
* Intraday :
* 5m or 15m are the sweet spots.
* Suggested `structureLen`:
* 5m: 10–14 (confirmation delay \~50–70 min)
* 15m: 8–10 (confirmation delay \~2–2.5 hours)
* Keep Entry Fib at 0.5 to start; try 0.3 in strong trends, 0.6 in chop.
* Tip: avoid the first 10–15 minutes after the open; let the initial volatility set the early structure.
* Swing/overnight:
* 1h or 4h.
* `structureLen`:
* 1h: 6–10 (6–10 hours confirmation)
* 4h: 5–8 (20–32 hours confirmation)
* 1m scalping: not recommended here—the confirmation lag relative to the noise makes zones less reliable.
Inputs (all groups)
Structure
• Show Swing Points (structureTog)
o Plots small dots on the bar where a swing point is confirmed (offset back by Structure Length).
• Structure Length (structureLen)
o Lookback used to confirm swing highs/lows and determine local structure. Higher = fewer, stronger swings; lower = more reactive.
Zones
• Show Last (zoneDispNum)
o Maximum number of zones kept on the chart when Display All Zones is off.
• Display All Zones (dispAll)
o If on, ignores Show Last and keeps all zones/levels.
• Zone Display (zoneFilter): Bullish Only / Bearish Only / Both
o Filters which zone types are drawn and eligible for signals.
• Clean Up Level Overlap (noOverlap)
o Prevents fib lines from overlapping when a new zone starts near the previous one (clamps line start/end times for readability).
Fib Levels
Each row controls whether a fib is drawn and how it looks:
• Toggle (f1Tog…f5Tog): Show/hide a given fib line.
• Level (f1Lvl…f5Lvl): Numeric ratio in . Defaults active: 0.3, 0.5, 0.7 (0 and 1 off by default).
• Line Style (f1Style…f5Style): Solid / Dashed / Dotted.
• Bull/Bear Colors (f#BullColor, f#BearColor): Per-fib color in bullish vs bearish zones.
Style
• Structure Color: Dot color for confirmed swing points.
• Bullish Zone Color / Bearish Zone Color: Rectangle fills (transparent by default).
Signals
• Entry Fib for Signals (entryFibSel): Choose 0.3, 0.5 (default), or 0.6 as the trigger line.
• Show Buy/Sell Signals (showSignals): Toggles triangle markers on/off.
• One Signal Per Zone (oneSignalPerZone): If on, suppresses additional entries within the same zone after the first trigger.
• Show Signal Text Labels (Bull/Bear + Fib) (showSignalLabels): Adds a small label next to each triangle showing zone bias and the fib used (e.g., BULL 0.5 or BEAR 0.3).
How TFZB decides signals
With trend only:
• BUY
1. Latest active zone is bullish.
2. Current bar’s close is inside the zone (between top and bottom).
3. The bar’s low ≤ selected fib and it closes > selected fib (bounce).
• SELL
1. Latest active zone is bearish.
2. Current bar’s close is inside the zone.
3. The bar’s high ≥ selected fib and it closes < selected fib.
Markers & labels
• BUY: triangle up below the bar; optional label “BULL 0.x” above it.
• SELL: triangle down above the bar; optional label “BEAR 0.x” below it.
Right-Panel Swing Log (Table)
What it is
A compact, auto-updating log of the most recent Swing High/Low events, printed in the top-right of the chart.
It helps you see when a pivot formed, when it was confirmed, and at what price—so you know the earliest bar a zone-based signal could have appeared.
Columns
Type – Swing High or Swing Low.
Date – Calendar date of the swing bar (follows the chart’s timezone).
Swing @ – Time of the original swing bar (where the dot is drawn).
Confirm @ – Time of the bar that confirmed that swing (≈ Structure Length × timeframe after the swing). This is also the earliest moment a new zone/entry can be considered.
Price – The swing price (high for SH, low for SL).
Why it’s useful
Clarity on repaint/confirmation: shows the natural delay between a swing forming and being usable—no guessing.
Planning & journaling: quick reference of today’s pivots and prices for notes/backtesting.
Scanning intraday: glance to see if you already have a confirmed zone (and therefore valid fib-bounce entries), or if you’re still waiting.
Context for signals: if a fib-bounce triangle appears before the time listed in Confirm @, it’s not a valid trade (you were too early).
Settings (Inputs → Logging)
Log swing times / Show table – turn the table on/off.
Rows to keep – how many recent entries to display.
Show labels on swing bar – optional tags on the chart (“Swing High 11:45”, “Confirm SH 14:15”) that match the table.
Recommended defaults
• Structure Length: 10–20 for intraday; 20–40 for swing.
• Entry Fib for Signals: 0.5 to start; try 0.3 in stronger trends and 0.6 in choppier markets.
• One Signal Per Zone: ON (prevents over trading).
• Zone Display: Both.
• Fib Lines: Keep 0.3/0.5/0.7 on; turn on 0 and 1 only if you need anchors.
Alerts
Two alert conditions are available:
• BUY signal – fires when a with trend bullish bounce at the selected fib occurs inside a bullish zone.
• SELL signal – fires when a with trend bearish bounce at the selected fib occurs inside a bearish zone.
Create alerts from the chart’s Alerts panel and select the desired condition. Use Once Per Bar Close to avoid intrabar flicker.
Notes & tips
• Swing dots are confirmed only after Structure Length bars, so they plot back in time; zones built from these confirmed swings do not repaint (though they extend as new bars form).
• If you don’t see a BUY where you expect one, check: (1) Is the active zone bullish? (2) Did the candle’s low actually pierce the selected fib and close above it? (3) Is One Signal Per Zone suppressing a second entry?
• You can hide visual clutter by reducing Show Last to 1–3 while keeping Display All Zones off.
Glossary
• CHOCH (Change of Character): A shift where price breaks beyond the last opposite swing while local momentum flips.
• BOS (Break of Structure): A cleaner break beyond the prior swing level in the current momentum direction.
• MSS: Either CHOCH or BOS – any event that spawns a new zone.
Extension ideas (optional)
• Add fib extensions (1.272 / 1.618) for target lines.
• Zone quality score using ATR normalization to filter weak impulses.
• HTF filter to only accept zones aligned with a higher timeframe trend.
⚠️ Disclaimer This script is provided for educational purposes only.
Past performance does not guarantee future results.
Trading involves risk, and users should exercise caution and use proper risk management when applying this strategy.