True Breakout Pattern [TradingFinder] Breakout Signal Indicator🔵 Introduction
In many market conditions, what initially appears to be a decisive breakout often turns out to be nothing more than a false breakout or fake breakout. Price breaks through a key swing level or an important support and resistance zone, only to quickly return to its previous range.
These failed breakouts, which are often the result of liquidity traps or market manipulation, serve more as a warning sign of structural weakness than confirmation of a new trend.
This indicator is designed around the concept of the fake breakout.
The logic is simple but precise : when price breaks a swing level and returns to that level within a maximum of five candles, the move is considered a false breakout. At this point, a Fibonacci retracement is applied to the recent price swing to evaluate the pullback area.
If price, within ten candles after the return to the breakout level, enters the Fibonacci zone between 0.618 and 1.0, the setup becomes valid for a potential entry. This area is identified as a long entry zone, with the stop loss placed just beyond the 1.0 level and the take profit defined based on the desired risk-to-reward ratio.
By combining accurate detection of false breakouts, analysis of price reaction to swing levels, and alignment with Fibonacci retracement logic, this framework allows traders to identify opportunities often missed by others. In a market where failed breakouts are a common and recurring phenomenon, this indicator aims to transform these traps into measurable trading opportunities.
Long Setup :
Short Setup :
🔵 How to Use
This indicator operates based on the recognition of false breakouts from structural levels in the market, specifically swing levels, and combines that with Fibonacci retracement analysis.
In this strategy, trades are only considered when price returns to the broken level within a defined time window and reacts appropriately inside a predefined Fibonacci range. Depending on the direction of the initial breakout, the system outlines two scenarios for long and short setups.
🟣 Long Setup
In the long setup, price initially breaks below a support level or swing low. If the price returns to the broken level within a maximum of five candles, the move is identified as a fake breakout.
At this stage, a Fibonacci retracement is drawn from the recent high to the low. If price, within ten candles of returning to the level, moves into the 0.618 to 1.0 Fibonacci zone, the conditions for a long entry are met.
The stop loss is placed slightly below the 1.0 level, while the take profit is set based on the trader’s preferred risk-reward ratio. This setup aims to capture deeply discounted entries at low risk, aligned with smart money reversals.
🟣 Short Setup
In the short setup, the price breaks above a resistance level or swing high. If the price returns to that level within five candles, the move is again treated as a false breakout. Fibonacci is then drawn from the recent low to the high to observe the retracement area.
Should price enter the 0.618 to 1.0 Fibonacci range within ten candles of returning, a short entry is considered valid. In this case, the stop loss is placed just above the 1.0 level, and the take profit is adjusted based on the intended risk-reward target. This method allows traders to identify high-probability short setups by focusing on failed breakouts and deep pullbacks.
🔵 Settings
🟣 Logical settings
Swing period : You can set the swing detection period.
Valid After Trigger Bars : Limits how many candles after a fake breakout the entry zone remains valid.
Max Swing Back Method : It is in two modes "All" and "Custom". If it is in "All" mode, it will check all swings, and if it is in "Custom" mode, it will check the swings to the extent you determine.
Max Swing Back : You can set the number of swings that will go back for checking.
🟣 Display settings
Displaying or not displaying swings and setting the color of labels and lines.
🟣 Alert Settings
Alert False Breakout : Enables alerts for Breakout.
Message Frequency : Determines the frequency of alerts. Options include 'All' (every function call), 'Once Per Bar' (first call within the bar), and 'Once Per Bar Close' (final script execution of the real-time bar). Default is 'Once per Bar'.
Show Alert Time by Time Zone : Configures the time zone for alert messages. Default is 'UTC'.
🔵 Conclusion
A sound understanding of the false breakout phenomenon and its relationship to structural price behavior is essential for technical traders aiming to improve precision and consistency. Many poor trading decisions stem from misinterpreting failed breakouts and entering too early into weak signals.
A structured approach, grounded in the analysis of swing levels and validated through specific price action and timing rules, can turn these misleading moves into valuable trade opportunities.
This indicator, by combining fake breakout detection with time filters and Fibonacci-based retracement zones, helps traders only engage with the market when multiple confirming factors are in alignment. The result is a strategy that emphasizes probability, risk control, and clarity in decision-making, offering a solid edge in navigating today’s volatile markets.
Analisis Trend
Fibonacci Optimal Entry ZoneFibonacci Optimal Entry Zone - Professional Market Structure Trading Tool
Overview
This indicator combines market structure analysis with dynamic Fibonacci retracement levels to identify optimal entry zones in trending markets. Unlike standard Fibonacci tools, this indicator automatically detects swing points, tracks market structure changes (CHoCH - Change of Character), and adapts Fibonacci levels in real-time as new market structure develops.
Key Innovation - Why This Combination Works
This tool merges two powerful concepts:
Smart Money Concepts (SMC) market structure detection
Automated Fibonacci retracement analysis
The synergy creates a systematic approach to finding high-probability reversal zones by waiting for structure breaks before drawing Fibonacci levels, ensuring you're always trading with the trend rather than against it.
How It Works
1. Market Structure Detection
Uses pivot high/low analysis to identify significant swing points
Detects "Change of Character" (CHoCH) when price breaks previous structure
Distinguishes between bullish (Higher Highs/Higher Lows) and bearish (Lower Highs/Lower Lows) market conditions
2. Dynamic Fibonacci Deployment
Automatically draws Fibonacci retracements between the most recent significant swings
Updates levels in real-time as new structure forms
Includes extended levels (-2.0 to 1.618) for both retracement and extension analysis
3. Optimal Entry Zone Identification
Highlights the "Golden Zone" (0.5-0.618 for bullish, 0.382-0.5 for bearish)
Provides visual fills between key levels to identify confluence zones
Shows exact price levels at each Fibonacci ratio
Trading Methodology
For Bullish Setups:
Wait for a bullish CHoCH (break above previous high)
Monitor price retracement to Fibonacci levels
Look for entries in the 0.5-0.618 zone (Golden Zone)
Use 0.786 as final support before trend invalidation
For Bearish Setups:
Wait for a bearish CHoCH (break below previous low)
Monitor price retracement to Fibonacci levels
Look for entries in the 0.382-0.5 zone
Use 0.236 as final resistance before trend invalidation
Unique Features
Swing Tracker Mode: Continuously updates Fibonacci levels with each new swing
Structure Period Optimization: Adjustable lookback period (default 10) to capture different market conditions
Visual Clarity: Customizable colors, line styles, and label positions
Fill Zones: Create visual zones between any two Fibonacci levels
Extended Levels: Includes negative Fibonacci levels for advanced harmonic patterns
Real-time Updates: Levels extend to current bar for immediate analysis
Best Practices
Timeframe Selection: Works best on H1 and above for swing trading, M15-H1 for intraday
Confluence: Combine with support/resistance, moving averages, or volume analysis
Risk Management: Use the 0.786 level (bullish) or 0.236 level (bearish) for stop-loss placement
Trend Confirmation: Only take trades in the direction of the CHoCH signal
Settings Guide
Structure Period: Higher values (15-20) for major swings, lower values (5-10) for minor swings
Swing Tracker: Enable for active markets, disable for cleaner historical analysis
Fibonacci Levels: Customize which levels to display based on your trading style
Golden Zone Fill: Highlights the optimal entry area for visual clarity
This indicator is designed for traders who understand market structure and want an automated, systematic approach to Fibonacci-based entries. It removes the subjectivity of manual Fibonacci placement while ensuring you're always aligned with the current market structure.
Chart Requirements:
Use a clean chart with only this indicator
Show at least one complete CHoCH signal with Fibonacci levels
Demonstrate how the levels update with new swings
Highlight the golden zone if enabled
Fibonacci Retracement Engine (DFRE) [PhenLabs]📊 Fibonacci Retracement Engine (DFRE)
Version: PineScript™ v6
📌 Description
Dynamic Fibonacci Retracement Engine (DFRE) is a sophisticated technical analysis tool that automatically detects important swing points and draws precise Fibonacci retracement levels on various timeframes. The intelligent indicator eliminates the subjectivity of manual Fibonacci drawing using intelligent swing detection algorithms combined with multi timeframe confluence analysis.
Built for professional traders who demand accuracy and consistency, DFRE provides real time Fibonacci levels that adapt to modifications in market structure without sacrificing accuracy in changing market conditions. The indicator excels at identifying key support and resistance levels where price action is more likely to react, giving traders a potent edge in entry and exit timing.
🚀 Points of Innovation
Intelligent Swing Detection Algorithm : Advanced pivot detection with customizable confirmation bars and minimum swing percentage thresholds
Multi-Timeframe Confluence Engine : Simultaneous analysis across three timeframes to identify high-probability zones
Dynamic Level Management : Automatically updates and manages multiple Fibonacci sets while maintaining chart clarity
Adaptive Visualization System : Smart labeling that shows only the most relevant levels based on user preferences
Real-Time Confluence Detection : Identifies zones where multiple Fibonacci levels from different timeframes converge
Automated Alert System : Comprehensive notifications for level breakouts and confluence zone formations
🔧 Core Components
Swing Point Detection Engine : Uses pivot high/low calculations with strength confirmation to identify significant market turns
Fibonacci Calculator : Automatically computes standard retracement levels (0.236, 0.382, 0.5, 0.618, 0.786, 0.886) plus extensions (1.272, 1.618)
Multi-Timeframe Security Function : Safely retrieves Fibonacci data from higher timeframes without repainting
Confluence Analysis Module : Mathematically identifies zones where multiple levels cluster within specified thresholds
Dynamic Drawing Management : Efficiently handles line and label creation, updates, and deletion to maintain performance
🔥 Key Features
Customizable Swing Detection : Adjust swing length (3-50 bars) and strength confirmation (1-10 bars) to match your trading style
Selective Level Display : Choose which Fibonacci levels to show, from core levels to full extensions
Multi-Timeframe Analysis : Analyze up to 3 different timeframes simultaneously for confluence identification
Intelligent Labeling System : Options to show main levels only or all levels, with latest-set-only functionality
Visual Customization : Adjustable line width, colors, and extension options for optimal chart clarity
Performance Optimization : Limit maximum Fibonacci sets (1-5) to maintain smooth chart performance
Comprehensive Alerting : Get notified on level breakouts and confluence zone formations
🎨 Visualization
Dynamic Fibonacci Lines : Color-coded lines (green for uptrends, red for downtrends) with customizable width and extension
Smart Level Labels : Precise level identification with both ratio and price values displayed
Confluence Zone Highlighting : Visual emphasis on areas where multiple timeframe levels converge
Clean Chart Management : Automatic cleanup of old drawing objects to prevent chart clutter
Responsive Design : All visual elements adapt to different chart sizes and timeframes
📖 Usage Guidelines
Swing Detection Settings
Swing Detection Length - Default: 25 | Range: 3-50 | Controls the lookback period for identifying pivot points. Lower values detect more frequent swings but may include noise, while higher values focus on major market turns.
Swing Strength (Confirmation Bars) - Default: 2 | Range: 1-10 | Number of bars required to confirm a swing point. Higher values reduce false signals but increase lag.
Minimum Swing % Change - Default: 1.0% | Range: 0.1-10.0% | Minimum percentage change required to register a valid swing. Filters out insignificant price movements.
Fibonacci Level Settings
Individual Level Toggles : Enable/disable specific Fibonacci levels (0.236, 0.382, 0.5, 0.618, 0.786, 0.886)
Extensions : Show projection levels (1.272, 1.618) for target identification
Multi-Timeframe Settings
Timeframe Selection : Choose three higher timeframes for confluence analysis
Confluence Threshold : Percentage tolerance for level clustering (0.5-5.0%)
✅ Best Use Cases
Swing Trading : Identify optimal entry and exit points at key retracement levels
Confluence Trading : Focus on high-probability zones where multiple timeframe levels align
Support/Resistance Trading : Use dynamic levels that adapt to changing market structure
Breakout Trading : Monitor level breaks for momentum continuation signals
Target Setting : Utilize extension levels for profit target placement
⚠️ Limitations
Lagging Nature : Requires confirmed swing points, which means levels appear after significant moves
Market Condition Dependency : Works best in trending markets; less effective in extremely choppy conditions
Multiple Signal Complexity : Multiple timeframe analysis may produce conflicting signals requiring experience to interpret
Performance Considerations : Multiple Fibonacci sets and MTF analysis may impact indicator loading time on slower devices
💡 What Makes This Unique
Automated Precision : Eliminates manual drawing errors and subjective level placement
Multi-Timeframe Intelligence : Combines analysis from multiple timeframes for superior confluence detection
Adaptive Management : Automatically updates and manages multiple Fibonacci sets as market structure evolves
Professional-Grade Alerts : Comprehensive notification system for all significant level interactions
🔬 How It Works
Step 1 - Swing Point Identification : Scans price action using pivot high/low calculations with specified lookback periods, applies confirmation logic to eliminate false signals, and calculates swing strength based on surrounding price action for quality assessment.
Step 2 - Fibonacci Level Calculation : Automatically computes retracement and extension levels between confirmed swing points, creates dynamic level sets that update as new swing points are identified, and maintains multiple active Fibonacci sets for comprehensive market analysis.
Step 3 - Multi-Timeframe Confluence : Retrieves Fibonacci data from higher timeframes using secure request functions, analyzes level clustering across different timeframes within specified thresholds, and identifies high-probability zones where multiple levels converge.
💡 Note: This indicator works best when combined with other technical analysis tools and proper risk management. The multi-timeframe confluence feature provides the highest probability setups, but always confirm signals with additional analysis before entering trades.
Price Action Concepts [StratifyTrade]// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) creativecommons.org
// © StratifyTrade - formerly know as HunterAlgos
//@version=5
indicator("Price Action Concepts ", shorttitle = "Price Action Concepts ", overlay = true, max_lines_count = 500, max_labels_count = 500, max_boxes_count = 500, max_bars_back = 500, max_polylines_count = 100)
//-----------------------------------------------------------------------------{
//Boolean set
//-----------------------------------------------------------------------------{
s_BOS = 0
s_CHoCH = 1
i_BOS = 2
i_CHoCH = 3
i_pp_CHoCH = 4
green_candle = 5
red_candle = 6
s_CHoCHP = 7
i_CHoCHP = 8
boolean =
array.from(
false
, false
, false
, false
, false
, false
, false
, false
, false
)
//-----------------------------------------------------------------------------{
// User inputs
//-----------------------------------------------------------------------------{
show_swing_ms = input.string ("All" , "Swing " , inline = "1", group = "MARKET STRUCTURE" , options = )
show_internal_ms = input.string ("All" , "Internal " , inline = "2", group = "MARKET STRUCTURE" , options = )
internal_r_lookback = input.int (5 , "" , inline = "2", group = "MARKET STRUCTURE" , minval = 2)
swing_r_lookback = input.int (50 , "" , inline = "1", group = "MARKET STRUCTURE" , minval = 2)
ms_mode = input.string ("Manual" , "Market Structure Mode" , inline = "a", group = "MARKET STRUCTURE" , tooltip = " Use selected lenght Use automatic lenght" ,options = )
show_mtf_str = input.bool (true , "MTF Scanner" , inline = "9", group = "MARKET STRUCTURE" , tooltip = "Display Multi-Timeframe Market Structure Trend Directions. Green = Bullish. Red = Bearish")
show_eql = input.bool (false , "Show EQH/EQL" , inline = "6", group = "MARKET STRUCTURE")
plotcandle_bool = input.bool (false , "Plotcandle" , inline = "3", group = "MARKET STRUCTURE" , tooltip = "Displays a cleaner colored candlestick chart in place of the default candles. (requires hiding the current ticker candles)")
barcolor_bool = input.bool (false , "Bar Color" , inline = "4", group = "MARKET STRUCTURE" , tooltip = "Color the candle bodies according to market strucutre trend")
i_ms_up_BOS = input.color (#089981 , "" , inline = "2", group = "MARKET STRUCTURE")
i_ms_dn_BOS = input.color (#f23645 , "" , inline = "2", group = "MARKET STRUCTURE")
s_ms_up_BOS = input.color (#089981 , "" , inline = "1", group = "MARKET STRUCTURE")
s_ms_dn_BOS = input.color (#f23645 , "" , inline = "1", group = "MARKET STRUCTURE")
lvl_daily = input.bool (false , "Day " , inline = "1", group = "HIGHS & LOWS MTF")
lvl_weekly = input.bool (false , "Week " , inline = "2", group = "HIGHS & LOWS MTF")
lvl_monthly = input.bool (false , "Month" , inline = "3", group = "HIGHS & LOWS MTF")
lvl_yearly = input.bool (false , "Year " , inline = "4", group = "HIGHS & LOWS MTF")
css_d = input.color (color.blue , "" , inline = "1", group = "HIGHS & LOWS MTF")
css_w = input.color (color.blue , "" , inline = "2", group = "HIGHS & LOWS MTF")
css_m = input.color (color.blue , "" , inline = "3", group = "HIGHS & LOWS MTF")
css_y = input.color (color.blue , "" , inline = "4", group = "HIGHS & LOWS MTF")
s_d = input.string ('⎯⎯⎯' , '' , inline = '1', group = 'HIGHS & LOWS MTF' , options = )
s_w = input.string ('⎯⎯⎯' , '' , inline = '2', group = 'HIGHS & LOWS MTF' , options = )
s_m = input.string ('⎯⎯⎯' , '' , inline = '3', group = 'HIGHS & LOWS MTF' , options = )
s_y = input.string ('⎯⎯⎯' , '' , inline = '4', group = 'HIGHS & LOWS MTF' , options = )
ob_show = input.bool (true , "Show Last " , inline = "1", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Display volumetric order blocks on the chart Ammount of volumetric order blocks to show")
ob_num = input.int (5 , "" , inline = "1", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Orderblocks number", minval = 1, maxval = 10)
ob_metrics_show = input.bool (true , "Internal Buy/Sell Activity" , inline = "2", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Display volume metrics that have formed the orderblock")
css_metric_up = input.color (color.new(#089981, 50) , " " , inline = "2", group = "VOLUMETRIC ORDER BLOCKS")
css_metric_dn = input.color (color.new(#f23645 , 50) , "" , inline = "2", group = "VOLUMETRIC ORDER BLOCKS")
ob_swings = input.bool (false , "Swing Order Blocks" , inline = "a", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Display swing volumetric order blocks")
css_swing_up = input.color (color.new(color.gray , 90) , " " , inline = "a", group = "VOLUMETRIC ORDER BLOCKS")
css_swing_dn = input.color (color.new(color.silver, 90) , "" , inline = "a", group = "VOLUMETRIC ORDER BLOCKS")
ob_filter = input.string ("None" , "Filtering " , inline = "d", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Filter out volumetric order blocks by BOS/CHoCH/CHoCH+", options = )
ob_mitigation = input.string ("Absolute" , "Mitigation " , inline = "4", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Trigger to remove volumetric order blocks", options = )
ob_pos = input.string ("Precise" , "Positioning " , inline = "k", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Position of the Order Block Cover the whole candle Cover half candle Adjust to volatility Same as Accurate but more precise", options = )
use_grayscale = input.bool (false , "Grayscale" , inline = "6", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Use gray as basic order blocks color")
use_show_metric = input.bool (true , "Show Metrics" , inline = "7", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Show volume associated with the orderblock and his relevance")
use_middle_line = input.bool (true , "Show Middle-Line" , inline = "8", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Show mid-line order blocks")
use_overlap = input.bool (true , "Hide Overlap" , inline = "9", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Hide overlapping order blocks")
use_overlap_method = input.string ("Previous" , "Overlap Method " , inline = "Z", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = " Preserve the most recent volumetric order blocks Preserve the previous volumetric order blocks", options = )
ob_bull_css = input.color (color.new(#089981 , 90) , "" , inline = "1", group = "VOLUMETRIC ORDER BLOCKS")
ob_bear_css = input.color (color.new(#f23645 , 90) , "" , inline = "1", group = "VOLUMETRIC ORDER BLOCKS")
show_acc_dist_zone = input.bool (false , "" , inline = "1", group = "Accumulation And Distribution")
zone_mode = input.string ("Fast" , "" , inline = "1", group = "Accumulation And Distribution" , tooltip = " Find small zone pattern formation Find bigger zone pattern formation" ,options = )
acc_css = input.color (color.new(#089981 , 60) , "" , inline = "1", group = "Accumulation And Distribution")
dist_css = input.color (color.new(#f23645 , 60) , "" , inline = "1", group = "Accumulation And Distribution")
show_lbl = input.bool (false , "Show swing point" , inline = "1", group = "High and Low" , tooltip = "Display swing point")
show_mtb = input.bool (false , "Show High/Low/Equilibrium" , inline = "2", group = "High and Low" , tooltip = "Display Strong/Weak High And Low and Equilibrium")
toplvl = input.color (color.red , "Premium Zone " , inline = "3", group = "High and Low")
midlvl = input.color (color.white , "Equilibrium Zone" , inline = "4", group = "High and Low")
btmlvl = input.color (#089981 , "Discount Zone " , inline = "5", group = "High and Low")
fvg_enable = input.bool (false , " " , inline = "1", group = "FAIR VALUE GAP" , tooltip = "Display fair value gap")
what_fvg = input.string ("FVG" , "" , inline = "1", group = "FAIR VALUE GAP" , tooltip = "Display fair value gap", options = )
fvg_num = input.int (5 , "Show Last " , inline = "1a", group = "FAIR VALUE GAP" , tooltip = "Number of fvg to show")
fvg_upcss = input.color (color.new(#089981, 80) , "" , inline = "1", group = "FAIR VALUE GAP")
fvg_dncss = input.color (color.new(color.red , 80) , "" , inline = "1", group = "FAIR VALUE GAP")
fvg_extend = input.int (10 , "Extend FVG" , inline = "2", group = "FAIR VALUE GAP" , tooltip = "Extend the display of the FVG.")
fvg_src = input.string ("Close" , "Mitigation " , inline = "3", group = "FAIR VALUE GAP" , tooltip = " Use the close of the body as trigger Use the extreme point of the body as trigger", options = )
fvg_tf = input.timeframe ("" , "Timeframe " , inline = "4", group = "FAIR VALUE GAP" , tooltip = "Timeframe of the fair value gap")
t = color.t (ob_bull_css)
invcol = color.new (color.white , 100)
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - UDT }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
type bar
float o = open
float c = close
float h = high
float l = low
float v = volume
int n = bar_index
int t = time
type Zphl
line top
line bottom
label top_label
label bottom_label
bool stopcross
bool sbottomcross
bool itopcross
bool ibottomcross
string txtup
string txtdn
float topy
float bottomy
float topx
float bottomx
float tup
float tdn
int tupx
int tdnx
float itopy
float itopx
float ibottomy
float ibottomx
float uV
float dV
type FVG
box box
line ln
bool bull
float top
float btm
int left
int right
type ms
float p
int n
float l
type msDraw
int n
float p
color css
string txt
bool bull
type obC
float top
float btm
int left
float avg
float dV
float cV
int wM
int blVP
int brVP
int dir
float h
float l
int n
type obD
box ob
box eOB
box blB
box brB
line mL
type zone
chart.point points
float p
int c
int t
type hqlzone
box pbx
box ebx
box lbx
label plb
label elb
label lbl
type ehl
float pt
int t
float pb
int b
type pattern
string found = "None"
bool isfound = false
int period = 0
bool bull = false
type alerts
bool chochswing = false
bool chochplusswing = false
bool swingbos = false
bool chochplus = false
bool choch = false
bool bos = false
bool equal = false
bool ob = false
bool swingob = false
bool zone = false
bool fvg = false
bool obtouch = false
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - End }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - General Setup }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
bar b = bar.new()
var pattern p = pattern.new()
alerts blalert = alerts.new()
alerts bralert = alerts.new()
if p.isfound
p.period += 1
if p.period == 50
p.period := 0
p.found := "None"
p.isfound := false
p.bull := na
switch
b.c > b.o => boolean.set(green_candle, true)
b.c < b.o => boolean.set(red_candle , true)
f_zscore(src, lookback) =>
(src - ta.sma(src, lookback)) / ta.stdev(src, lookback)
var int iLen = internal_r_lookback
var int sLen = swing_r_lookback
vv = f_zscore(((close - close ) / close ) * 100,iLen)
if ms_mode == "Dynamic"
switch
vv >= 1.5 or vv <= -1.5 => iLen := 10
vv >= 1.6 or vv <= -1.6 => iLen := 9
vv >= 1.7 or vv <= -1.7 => iLen := 8
vv >= 1.8 or vv <= -1.8 => iLen := 7
vv >= 1.9 or vv <= -1.9 => iLen := 6
vv >= 2.0 or vv <= -2.0 => iLen := 5
=> iLen
var msline = array.new(0)
iH = ta.pivothigh(high, iLen, iLen)
sH = ta.pivothigh(high, sLen, sLen)
iL = ta.pivotlow (low , iLen, iLen)
sL = ta.pivotlow (low , sLen, sLen)
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - End }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - ARRAYS }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
hl () =>
= request.security(syminfo.tickerid , 'D' , hl() , lookahead = barmerge.lookahead_on)
= request.security(syminfo.tickerid , 'W' , hl() , lookahead = barmerge.lookahead_on)
= request.security(syminfo.tickerid , 'M' , hl() , lookahead = barmerge.lookahead_on)
= request.security(syminfo.tickerid , '12M', hl() , lookahead = barmerge.lookahead_on)
lstyle(style) =>
out = switch style
'⎯⎯⎯' => line.style_solid
'----' => line.style_dashed
'····' => line.style_dotted
mtfphl(h, l ,tf ,css, pdhl_style) =>
var line hl = line.new(
na
, na
, na
, na
, xloc = xloc.bar_time
, color = css
, style = lstyle(pdhl_style)
)
var line ll = line.new(
na
, na
, na
, na
, xloc = xloc.bar_time
, color = css
, style = lstyle(pdhl_style)
)
var label lbl = label.new(
na
, na
, xloc = xloc.bar_time
, text = str.format('P{0}L', tf)
, color = invcol
, textcolor = css
, size = size.small
, style = label.style_label_left
)
var label hlb = label.new(
na
, na
, xloc = xloc.bar_time
, text = str.format('P{0}H', tf)
, color = invcol
, textcolor = css
, size = size.small
, style = label.style_label_left
)
hy = ta.valuewhen(h != h , h , 1)
hx = ta.valuewhen(h == high , time , 1)
ly = ta.valuewhen(l != l , l , 1)
lx = ta.valuewhen(l == low , time , 1)
if barstate.islast
extension = time + (time - time ) * 50
line.set_xy1(hl , hx , hy)
line.set_xy2(hl , extension , hy)
label.set_xy(hlb, extension , hy)
line.set_xy1(ll , lx , ly)
line.set_xy2(ll , extension , ly)
label.set_xy(lbl, extension , ly)
if lvl_daily
mtfphl(pdh , pdl , 'D' , css_d, s_d)
if lvl_weekly
mtfphl(pwh , pwl , 'W' , css_w, s_w)
if lvl_monthly
mtfphl(pmh , pml, 'M' , css_m, s_m)
if lvl_yearly
mtfphl(pyh , pyl , '12M', css_y, s_y)
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - End }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - Market Structure }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
method darkcss(color css, float factor, bool bull) =>
blue = color.b(css) * (1 - factor)
red = color.r(css) * (1 - factor)
green = color.g(css) * (1 - factor)
color.rgb(red, green, blue, 0)
method f_line(msDraw d, size, style) =>
var line id = na
var label lbl = na
id := line.new(
d.n
, d.p
, b.n
, d.p
, color = d.css
, width = 1
, style = style
)
if msline.size() >= 250
line.delete(msline.shift())
msline.push(id)
lbl := label.new(
int(math.avg(d.n, b.n))
, d.p
, d.txt
, color = invcol
, textcolor = d.css
, style = d.bull ? label.style_label_down : label.style_label_up
, size = size
, text_font_family = font.family_monospace
)
structure(bool mtf) =>
msDraw drw = na
bool isdrw = false
bool isdrwS = false
var color css = na
var color icss = na
var int itrend = 0
var int trend = 0
bool bull_ob = false
bool bear_ob = false
bool s_bull_ob = false
bool s_bear_ob = false
n = bar_index
var ms up = ms.new(
array.new()
, array.new< int >()
, array.new()
)
var ms dn = ms.new(
array.new()
, array.new< int >()
, array.new()
)
var ms sup = ms.new(
array.new()
, array.new< int >()
, array.new()
)
var ms sdn = ms.new(
array.new()
, array.new< int >()
, array.new()
)
switch show_swing_ms
"All" => boolean.set(s_BOS , true ), boolean.set(s_CHoCH, true ) , boolean.set(s_CHoCHP, true )
"CHoCH" => boolean.set(s_BOS , false), boolean.set(s_CHoCH, true ) , boolean.set(s_CHoCHP, false )
"CHoCH+" => boolean.set(s_BOS , false), boolean.set(s_CHoCH, false) , boolean.set(s_CHoCHP, true )
"BOS" => boolean.set(s_BOS , true ), boolean.set(s_CHoCH, false) , boolean.set(s_CHoCHP, false )
"None" => boolean.set(s_BOS , false), boolean.set(s_CHoCH, false) , boolean.set(s_CHoCHP, false )
=> na
switch show_internal_ms
"All" => boolean.set(i_BOS, true ), boolean.set(i_CHoCH, true ), boolean.set(i_CHoCHP, true )
"CHoCH" => boolean.set(i_BOS, false), boolean.set(i_CHoCH, true ), boolean.set(i_CHoCHP, false)
"CHoCH+" => boolean.set(i_BOS, false), boolean.set(i_CHoCH, false ), boolean.set(i_CHoCHP, true )
"BOS" => boolean.set(i_BOS, true ), boolean.set(i_CHoCH, false ), boolean.set(i_CHoCHP, false)
"None" => boolean.set(i_BOS, false), boolean.set(i_CHoCH, false ), boolean.set(i_CHoCHP, false)
=> na
switch
iH =>
up.p.unshift(b.h )
up.l.unshift(b.h )
up.n.unshift(n )
iL =>
dn.p.unshift(b.l )
dn.l.unshift(b.l )
dn.n.unshift(n )
sL =>
sdn.p.unshift(b.l )
sdn.l.unshift(b.l )
sdn.n.unshift(n )
sH =>
sup.p.unshift(b.h )
sup.l.unshift(b.h )
sup.n.unshift(n )
// INTERNAL BULLISH STRUCTURE
if up.p.size() > 0 and dn.l.size() > 1
if ta.crossover(b.c, up.p.first())
bool CHoCH = na
string txt = na
if itrend < 0
CHoCH := true
switch
not CHoCH =>
txt := "BOS"
css := i_ms_up_BOS
blalert.bos := true
if boolean.get(i_BOS) and mtf == false and na(drw)
isdrw := true
drw := msDraw.new(
up.n.first()
, up.p.first()
, i_ms_up_BOS
, txt
, true
)
CHoCH =>
dn.l.first() > dn.l.get(1) ? blalert.chochplus : blalert.choch
txt := dn.l.first() > dn.l.get(1) ? "CHoCH+" : "CHoCH"
css := i_ms_up_BOS.darkcss(0.25, true)
if (dn.l.first() > dn.l.get(1) ? boolean.get(i_CHoCHP) : boolean.get(i_CHoCH)) and mtf == false and na(drw)
isdrw := true
drw := msDraw.new(
up.n.first()
, up.p.first()
, i_ms_up_BOS.darkcss(0.25, true)
, txt
, true
)
if mtf == false
switch
ob_filter == "None" => bull_ob := true
ob_filter == "BOS" and txt == "BOS" => bull_ob := true
ob_filter == "CHoCH" and txt == "CHoCH" => bull_ob := true
ob_filter == "CHoCH+" and txt == "CHoCH+" => bull_ob := true
itrend := 1
up.n.clear()
up.p.clear()
// INTERNAL BEARISH STRUCTURE
if dn.p.size() > 0 and up.l.size() > 1
if ta.crossunder(b.c, dn.p.first())
bool CHoCH = na
string txt = na
if itrend > 0
CHoCH := true
switch
not CHoCH =>
bralert.bos := true
txt := "BOS"
css := i_ms_dn_BOS
if boolean.get(i_BOS) and mtf == false and na(drw)
isdrw := true
drw := msDraw.new(
dn.n.first()
, dn.p.first()
, i_ms_dn_BOS
, txt
, false
)
CHoCH =>
if up.l.first() < up.l.get(1)
bralert.chochplus := true
else
bralert.choch := true
txt := up.l.first() < up.l.get(1) ? "CHoCH+" : "CHoCH"
css := i_ms_dn_BOS.darkcss(0.25, false)
if (up.l.first() < up.l.get(1) ? boolean.get(i_CHoCHP) : boolean.get(i_CHoCH)) and mtf == false and na(drw)
isdrw := true
drw := msDraw.new(
dn.n.first()
, dn.p.first()
, i_ms_dn_BOS.darkcss(0.25, false)
, txt
, false
)
if mtf == false
switch
ob_filter == "None" => bear_ob := true
ob_filter == "BOS" and txt == "BOS" => bear_ob := true
ob_filter == "CHoCH" and txt == "CHoCH" => bear_ob := true
ob_filter == "CHoCH+" and txt == "CHoCH+" => bear_ob := true
itrend := -1
dn.n.clear()
dn.p.clear()
// SWING BULLISH STRUCTURE
if sup.p.size() > 0 and sdn.l.size() > 1
if ta.crossover(b.c, sup.p.first())
bool CHoCH = na
string txt = na
if trend < 0
CHoCH := true
switch
not CHoCH =>
blalert.swingbos := true
txt := "BOS"
icss := s_ms_up_BOS
if boolean.get(s_BOS) and mtf == false and na(drw)
isdrwS := true
drw := msDraw.new(
sup.n.first()
, sup.p.first()
, s_ms_up_BOS
, txt
, true
)
CHoCH =>
if sdn.l.first() > sdn.l.get(1)
blalert.chochplusswing := true
else
blalert.chochswing := true
txt := sdn.l.first() > sdn.l.get(1) ? "CHoCH+" : "CHoCH"
icss := s_ms_up_BOS.darkcss(0.25, true)
if (sdn.l.first() > sdn.l.get(1) ? boolean.get(s_CHoCHP) : boolean.get(s_CHoCH)) and mtf == false and na(drw)
isdrwS := true
drw := msDraw.new(
sup.n.first()
, sup.p.first()
, s_ms_up_BOS.darkcss(0.25, true)
, txt
, true
)
if mtf == false
switch
ob_filter == "None" => s_bull_ob := true
ob_filter == "BOS" and txt == "BOS" => s_bull_ob := true
ob_filter == "CHoCH" and txt == "CHoCH" => s_bull_ob := true
ob_filter == "CHoCH+" and txt == "CHoCH+" => s_bull_ob := true
trend := 1
sup.n.clear()
sup.p.clear()
// SWING BEARISH STRUCTURE
if sdn.p.size() > 0 and sup.l.size() > 1
if ta.crossunder(b.c, sdn.p.first())
bool CHoCH = na
string txt = na
if trend > 0
CHoCH := true
switch
not CHoCH =>
bralert.swingbos := true
txt := "BOS"
icss := s_ms_dn_BOS
if boolean.get(s_BOS) and mtf == false and na(drw)
isdrwS := true
drw := msDraw.new(
sdn.n.first()
, sdn.p.first()
, s_ms_dn_BOS
, txt
, false
)
CHoCH =>
if sup.l.first() < sup.l.get(1)
bralert.chochplusswing := true
else
bralert.chochswing := true
txt := sup.l.first() < sup.l.get(1) ? "CHoCH+" : "CHoCH"
icss := s_ms_dn_BOS.darkcss(0.25, false)
if (sup.l.first() < sup.l.get(1) ? boolean.get(s_CHoCHP) : boolean.get(s_CHoCH)) and mtf == false and na(drw)
isdrwS := true
drw := msDraw.new(
sdn.n.first()
, sdn.p.first()
, s_ms_dn_BOS.darkcss(0.25, false)
, txt
, false
)
if mtf == false
switch
ob_filter == "None" => s_bear_ob := true
ob_filter == "BOS" and txt == "BOS" => s_bear_ob := true
ob_filter == "CHoCH" and txt == "CHoCH" => s_bear_ob := true
ob_filter == "CHoCH+" and txt == "CHoCH+" => s_bear_ob := true
trend := -1
sdn.n.clear()
sdn.p.clear()
= structure(false)
if isdrw
f_line(drw, size.small, line.style_dashed)
if isdrwS
f_line(drw, size.small, line.style_solid)
= request.security("", "15" , structure(true))
= request.security("", "60" , structure(true))
= request.security("", "240" , structure(true))
= request.security("", "1440" , structure(true))
if show_mtf_str
var tab = table.new(position = position.top_right, columns = 10, rows = 10, bgcolor = na, frame_color = color.rgb(54, 58, 69, 0), frame_width = 1, border_color = color.rgb(54, 58, 69, 100), border_width = 1)
table.cell(tab, 0, 1, text = "15" , text_color = color.silver, text_halign = text.align_center, text_size = size.normal, bgcolor = chart.bg_color, text_font_family = font.family_monospace, width = 2)
table.cell(tab, 0, 2, text = "1H" , text_color = color.silver, text_halign = text.align_center, text_size = size.normal, bgcolor = chart.bg_color, text_font_family = font.family_monospace, width = 2)
table.cell(tab, 0, 3, text = "4H" , text_color = color.silver, text_halign = text.align_center, text_size = size.normal, bgcolor = chart.bg_color, text_font_family = font.family_monospace, width = 2)
table.cell(tab, 0, 4, text = "1D" , text_color = color.silver, text_halign = text.align_center, text_size = size.normal, bgcolor = chart.bg_color, text_font_family = font.family_monospace, width = 2)
table.cell(tab, 1, 1, text = itrend15 == 1 ? "BULLISH" : itrend15 == -1 ? "BEARISH" : na , text_halign = text.align_center, text_size = size.normal, text_color = itrend15 == 1 ? i_ms_up_BOS.darkcss(-0.25, true) : itrend15 == -1 ? i_ms_dn_BOS.darkcss(0.25, false) : color.gray, bgcolor = chart.bg_color, text_font_family = font.family_monospace)
table.cell(tab, 1, 2, text = itrend1H == 1 ? "BULLISH" : itrend1H == -1 ? "BEARISH" : na , text_halign = text.align_center, text_size = size.normal, text_color = itrend1H == 1 ? i_ms_up_BOS.darkcss(-0.25, true) : itrend1H == -1 ? i_ms_dn_BOS.darkcss(0.25, false) : color.gray, bgcolor = chart.bg_color, text_font_family = font.family_monospace)
table.cell(tab, 1, 3, text = itrend4H == 1 ? "BULLISH" : itrend4H == -1 ? "BEARISH" : na , text_halign = text.align_center, text_size = size.normal, text_color = itrend4H == 1 ? i_ms_up_BOS.darkcss(-0.25, true) : itrend4H == -1 ? i_ms_dn_BOS.darkcss(0.25, false) : color.gray, bgcolor = chart.bg_color, text_font_family = font.family_monospace)
table.cell(tab, 1, 4, text = itrend1D == 1 ? "BULLISH" : itrend1D == -1 ? "BEARISH" : na , text_halign = text.align_center, text_size = size.normal, text_color = itrend1D == 1 ? i_ms_up_BOS.darkcss(-0.25, true) : itrend1D == -1 ? i_ms_dn_BOS.darkcss(0.25, false) : color.gray, bgcolor = chart.bg_color, text_font_family = font.family_monospace)
table.cell(tab, 0, 5, text = "Detected Pattern", text_halign = text.align_center, text_size = size.normal, text_color = color.silver, bgcolor = chart.bg_color, text_font_family = font.family_monospace)
table.cell(tab, 0, 6, text = p.found, text_halign = text.align_center, text_size = size.normal, text_color = na(p.bull) ? color.white : p.bull ? i_ms_up_BOS.darkcss(-0.25, true) : p.bull == false ? i_ms_dn_BOS.darkcss(0.25, false) : na, bgcolor = chart.bg_color, text_font_family = font.family_monospace)
table.merge_cells(tab, 0, 5, 1, 5)
table.merge_cells(tab, 0, 6, 1, 6)
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - End }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - Strong/Weak High/Low And Equilibrium }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
var phl = Zphl.new(
na
, na
, label.new(na , na , color = invcol , textcolor = i_ms_dn_BOS , style = label.style_label_down , size = size.tiny , text = "")
, label.new(na , na , color = invcol , textcolor = i_ms_up_BOS , style = label.style_label_up , size = size.tiny , text = "")
, true
, true
, true
, true
, ""
, ""
, 0
, 0
, 0
, 0
, high
, low
, 0
, 0
, 0
, 0
, 0
, 0
, na
, na
)
zhl(len)=>
upper = ta.highest(len)
lower = ta.lowest(len)
var float out = 0
out := b.h > upper ? 0 : b.l < lower ? 1 : out
top = out == 0 and out != 0 ? b.h : 0
btm = out == 1 and out != 1 ? b.l : 0
= zhl(sLen)
= zhl(iLen)
upphl(trend) =>
var label lbl = label.new(
na
, na
, color = invcol
, textcolor = toplvl
, style = label.style_label_down
, size = size.small
)
if top
phl.stopcross := true
phl.txtup := top > phl.topy ? "HH" : "HL"
if show_lbl
topl = label.new(
b.n - swing_r_lookback
, top
, phl.txtup
, color = invcol
, textcolor = toplvl
, style = label.style_label_down
, size = size.small
)
line.delete(phl.top )
phl.top := line.new(
b.n - sLen
, top
, b.n
, top
, color = toplvl)
phl.topy := top
phl.topx := b.n - sLen
phl.tup := top
phl.tupx := b.n - sLen
if itop
phl.itopcross := true
phl.itopy := itop
phl.itopx := b.n - iLen
phl.tup := math.max(high, phl.tup)
phl.tupx := phl.tup == high ? b.n : phl.tupx
phl.uV := phl.tup != phl.tup ? b.v : phl.uV
if barstate.islast
line.set_xy1(
phl.top
, phl.tupx
, phl.tup
)
line.set_xy2(
phl.top
, b.n + 50
, phl.tup
)
label.set_x(
lbl
, b.n + 50
)
label.set_y(
lbl
, phl.tup
)
dist = math.abs(phl.uV / (phl.uV + phl.dV)) * 100
label.set_text (lbl, trend < 0
? "Strong High | " + str.tostring(phl.uV, format.volume) + " (" + str.tostring(math.round(dist,0)) + "%)"
: "Weak High | " + str.tostring(phl.uV, format.volume) + " (" + str.tostring(math.round(dist,0)) + "%)")
dnphl(trend) =>
var label lbl = label.new(
na
, na
, color = invcol
, textcolor = btmlvl
, style = label.style_label_up
, size = size.small
)
if btm
phl.sbottomcross := true
phl.txtdn := btm > phl.bottomy ? "LH" : "LL"
if show_lbl
btml = label.new(
b.n - swing_r_lookback
, btm, phl.txtdn
, color = invcol
, textcolor = btmlvl
, style = label.style_label_up
, size = size.small
)
line.delete(phl.bottom )
phl.bottom := line.new(
b.n - sLen
, btm
, b.n
, btm
, color = btmlvl
)
phl.bottomy := btm
phl.bottomx := b.n - sLen
phl.tdn := btm
phl.tdnx := b.n - sLen
if ibtm
phl.ibottomcross := true
phl.ibottomy := ibtm
phl.ibottomx := b.n - iLen
phl.tdn := math.min(low, phl.tdn)
phl.tdnx := phl.tdn == low ? b.n : phl.tdnx
phl.dV := phl.tdn != phl.tdn ? b.v : phl.dV
if barstate.islast
line.set_xy1(
phl.bottom
, phl.tdnx
, phl.tdn
)
line.set_xy2(
phl.bottom
, b.n + 50
, phl.tdn
)
label.set_x(
lbl
, b.n + 50
)
label.set_y(
lbl
, phl.tdn
)
dist = math.abs(phl.dV / (phl.uV + phl.dV)) * 100
label.set_text (lbl, trend > 0
? "Strong Low | " + str.tostring(phl.dV, format.volume) + " (" + str.tostring(math.round(dist,0)) + "%)"
: "Weak Low | " + str.tostring(phl.uV, format.volume) + " (" + str.tostring(math.round(dist,0)) + "%)")
midphl() =>
avg = math.avg(phl.bottom.get_y2(), phl.top.get_y2())
var line l = line.new(
y1 = avg
, y2 = avg
, x1 = b.n - sLen
, x2 = b.n + 50
, color = midlvl
, style = line.style_solid
)
var label lbl = label.new(
x = b.n + 50
, y = avg
, text = "Equilibrium"
, style = label.style_label_left
, color = invcol
, textcolor = midlvl
, size = size.small
)
if barstate.islast
more = (phl.bottom.get_x1() + phl.bottom.get_x2()) > (phl.top.get_x1() + phl.top.get_x2()) ? phl.top.get_x1() : phl.bottom.get_x1()
line.set_xy1(l , more , avg)
line.set_xy2(l , b.n + 50, avg)
label.set_x (lbl , b.n + 50 )
label.set_y (lbl , avg )
dist = math.abs((l.get_y2() - close) / close) * 100
label.set_text (lbl, "Equilibrium (" + str.tostring(math.round(dist,0)) + "%)")
hqlzone() =>
if barstate.islast
var hqlzone dZone = hqlzone.new(
box.new(
na
, na
, na
, na
, bgcolor = color.new(toplvl, 70)
, border_color = na
)
, box.new(
na
, na
, na
, na
, bgcolor = color.new(midlvl, 70)
, border_color = na
)
, box.new(
na
, na
, na
, na
, bgcolor = color.new(btmlvl, 70)
, border_color = na
)
, label.new(na, na, text = "Premium" , color = invcol, textcolor = toplvl, style = label.style_label_down, size = size.small)
, label.new(na, na, text = "Equilibrium", color = invcol, textcolor = midlvl, style = label.style_label_left, size = size.small)
, label.new(na, na, text = "Discount" , color = invcol, textcolor = btmlvl, style = label.style_label_up , size = size.small)
)
dZone.pbx.set_lefttop(int(math.max(phl.topx, phl.bottomx)) , phl.tup)
dZone.pbx.set_rightbottom(b.n + 50 , 0.95 * phl.tup + 0.05 * phl.tdn)
dZone.ebx.set_lefttop(int(math.max(phl.topx, phl.bottomx)), 0.525 * phl.tup + 0.475 * phl.tdn)
dZone.ebx.set_rightbottom(b.n + 50 , 0.525 * phl.tdn + 0.475 * phl.tup)
dZone.lbx.set_lefttop(int(math.max(phl.topx, phl.bottomx)), 0.95 * phl.tdn + 0.05 * phl.tup)
dZone.lbx.set_rightbottom(b.n + 50 , phl.tdn)
dZone.plb.set_xy( int(math.avg(math.max(phl.topx, phl.bottomx), int(b.n + 50))) , phl.tup)
dZone.elb.set_xy( int(b.n + 50) , math.avg(phl.tup, phl.tdn))
dZone.lbl.set_xy( int(math.avg(math.max(phl.topx, phl.bottomx), int(b.n + 50))) , phl.tdn)
if show_mtb
upphl (trend)
dnphl (trend)
hqlzone()
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - End }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - Volumetric Order Block }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
method eB(box b, bool ext, color css, bool swing) =>
b.unshift(
box.new(
na
, na
, na
, na
, xloc = xloc.bar_time
, text_font_family = font.family_monospace
, extend = ext ? extend.right : extend.none
, border_color = swing ? color.new(css, 0) : color.new(color.white,100)
, bgcolor = css
, border_width = 1
)
)
method eL(line l, bool ext, bool solid, color css) =>
l.unshift(
line.new(
na
, na
, na
, na
, width = 1
, color = css
, xloc = xloc.bar_time
, extend = ext ? extend.right : extend.none
, style = solid ? line.style_solid : line.style_dashed
)
)
method drawVOB(bool cdn, bool bull, color css, int loc, bool swing) =>
= request.security(
syminfo.tickerid
, ""
,
, lookahead = barmerge.lookahead_off
)
var obC obj = obC.new(
array.new()
, array.new()
, array.new< int >()
, array.new()
, array.new()
, array.new()
, array.new< int >()
, array.new< int >()
, array.new< int >()
, array.new< int >()
, array.new()
, array.new()
, array.new< int >()
)
var obD draw = obD.new(
array.new()
, array.new()
, array.new()
, array.new()
, array.new()
)
if barstate.isfirst
for i = 0 to ob_num - 1
draw.mL .eL(false, false, use_grayscale ? color.new(color.gray, 0) : color.new(css,0))
draw.ob .eB(false, use_grayscale ? color.new(color.gray, 90) : css, swing)
draw.blB.eB(false, css_metric_up , swing)
draw.brB.eB(false, css_metric_dn , swing)
draw.eOB.eB(true , use_grayscale ? color.new(color.gray, 90) : css, swing)
float pos = ob_pos == "Full"
? (bull ? high : low)
: ob_pos == "Middle"
? ohlc4
: ob_pos == "Accurate"
? hl2
: hl2
if cdn
obj.h.clear()
obj.l.clear()
obj.n.clear()
for i = 1 to math.abs((loc - b.n)) - 1
obj.h.push(hH )
obj.l.push(lL )
obj.n.push(b.t )
// obj.h.reverse()
// obj.l.reverse()
int iU = obj.l.indexof(obj.l.min()) + 1
int iD = obj.h.indexof(obj.h.max()) + 1
obj.dir.unshift(
bull
? (b.c > b.o ? 1 : -1)
: (b.c > b.o ? 1 : -1)
)
obj.top.unshift(
bull
? pos
: obj.h.max()
)
obj.btm.unshift(
bull
? obj.l.min()
: pos
)
obj.left.unshift(
bull
? obj.n.get(obj.l.indexof(obj.l.min()))
: obj.n.get(obj.h.indexof(obj.h.max()))
)
obj.avg.unshift(
math.avg(obj.top.first(), obj.btm.first())
)
obj.cV.unshift(
bull
? b.v
: b.v
)
if ob_pos == "Precise"
switch bull
true =>
if obj.avg.get(0) < (b.c < b.o ? b.c : b.o ) and obj.top.get(0) > hlcc4
obj.top.set(0, obj.avg.get(0))
obj.avg.set(0, math.avg(obj.top.first(), obj.btm.first()))
false =>
if obj.avg.get(0) > (b.c < b.o ? b.o : b.c ) and obj.btm.get(0) < hlcc4
obj.btm.set(0, obj.avg.get(0))
obj.avg.set(0, math.avg(obj.top.first(), obj.btm.first()))
obj.blVP.unshift ( 0 )
obj.brVP.unshift ( 0 )
obj.wM .unshift ( 1 )
if use_overlap
int rmP = use_overlap_method == "Recent" ? 1 : 0
if obj.avg.size() > 1
if bull
? obj.btm.first() < obj.top.get(1)
: obj.top.first() > obj.btm.get(1)
obj.wM .remove(rmP)
obj.cV .remove(rmP)
obj.dir .remove(rmP)
obj.top .remove(rmP)
obj.avg .remove(rmP)
obj.btm .remove(rmP)
obj.left .remove(rmP)
obj.blVP .remove(rmP)
obj.brVP .remove(rmP)
if barstate.isconfirmed
for x = 0 to ob_num - 1
tg = switch ob_mitigation
"Middle" => obj.avg
"Absolute" => bull ? obj.btm : obj.top
for in tg
if (bull ? cC < pt : cC > pt)
obj.wM .remove(idx)
obj.cV .remove(idx)
obj.dir .remove(idx)
obj.top .remove(idx)
obj.avg .remove(idx)
obj.btm .remove(idx)
obj.left .remove(idx)
obj.blVP .remove(idx)
obj.brVP .remove(idx)
if barstate.islast
if obj.avg.size() > 0
// Alert
if bull
? ta.crossunder(low , obj.top.get(0))
: ta.crossover (high, obj.btm.get(0))
switch bull
true => blalert.obtouch := true
false => bralert.obtouch := true
float tV = 0
obj.dV.clear()
seq = math.min(ob_num - 1, obj.avg.size() - 1)
for j = 0 to seq
tV += obj.cV.get(j)
if j == seq
for y = 0 to seq
obj.dV.unshift(
math.floor(
(obj.cV.get(y) / tV) * 100)
)
obj.dV.reverse()
for i = 0 to math.min(ob_num - 1, obj.avg.size() - 1)
dmL = draw.mL .get(i)
dOB = draw.ob .get(i)
dblB = draw.blB.get(i)
dbrB = draw.brB.get(i)
deOB = draw.eOB.get(i)
dOB.set_lefttop (obj.left .get(i) , obj.top.get(i))
deOB.set_lefttop (b.t , obj.top.get(i))
dOB.set_rightbottom (b.t , obj.btm.get(i))
deOB.set_rightbottom(b.t + (b.t - b.t ) * 100 , obj.btm.get(i))
if use_middle_line
dmL.set_xy1(obj.left.get(i), obj.avg.get(i))
dmL.set_xy2(b.t , obj.avg.get(i))
if ob_metrics_show
dblB.set_lefttop (obj.left.get(i), obj.top.get(i))
dbrB.set_lefttop (obj.left.get(i), obj.avg.get(i))
dblB.set_rightbottom(obj.left.get(i), obj.avg.get(i))
dbrB.set_rightbottom(obj.left.get(i), obj.btm.get(i))
rpBL = dblB.get_right()
rpBR = dbrB.get_right()
dbrB.set_right(rpBR + (b.t - b.t ) * obj.brVP.get(i))
dblB.set_right(rpBL + (b.t - b.t ) * obj.blVP.get(i))
if use_show_metric
txt = switch
obj.cV.get(i) >= 1000000000 => str.tostring(math.round(obj.cV.get(i) / 1000000000,3)) + "B"
obj.cV.get(i) >= 1000000 => str.tostring(math.round(obj.cV.get(i) / 1000000,3)) + "M"
obj.cV.get(i) >= 1000 => str.tostring(math.round(obj.cV.get(i) / 1000,3)) + "K"
obj.cV.get(i) < 1000 => str.tostring(math.round(obj.cV.get(i)))
deOB.set_text(
str.tostring(
txt + " (" + str.tostring(obj.dV.get(i)) + "%)")
)
deOB.set_text_size (size.auto)
deOB.set_text_halign(text.align_left)
deOB.set_text_color (use_grayscale ? color.silver : color.new(css, 0))
if ob_metrics_show and barstate.isconfirmed
if obj.wM.size() > 0
for i = 0 to obj.avg.size() - 1
switch obj.dir.get(i)
1 =>
switch obj.wM.get(i)
1 => obj.blVP.set(i, obj.blVP.get(i) + 1), obj.wM.set(i, 2)
2 => obj.blVP.set(i, obj.blVP.get(i) + 1), obj.wM.set(i, 3)
3 => obj.brVP.set(i, obj.brVP.get(i) + 1), obj.wM.set(i, 1)
-1 =>
switch obj.wM.get(i)
1 => obj.brVP.set(i, obj.brVP.get(i) + 1), obj.wM.set(i, 2)
2 => obj.brVP.set(i, obj.brVP.get(i) + 1), obj.wM.set(i, 3)
3 => obj.blVP.set(i, obj.blVP.get(i) + 1), obj.wM.set(i, 1)
var hN = array.new(1, b.n)
var lN = array.new(1, b.n)
var hS = array.new(1, b.n)
var lS = array.new(1, b.n)
if iH
hN.pop()
hN.unshift(int(b.n ))
if iL
lN.pop()
lN.unshift(int(b.n ))
if sH
hS.pop()
hS.unshift(int(b.n ))
if sL
lS.pop()
lS.unshift(int(b.n ))
if ob_show
bull_ob.drawVOB(true , ob_bull_css, hN.first(), false)
bear_ob.drawVOB(false, ob_bear_css, lN.first(), false)
if ob_swings
s_bull_ob.drawVOB(true , css_swing_up, hS.first(), true)
s_bear_ob.drawVOB(false, css_swing_dn, lS.first(), true)
if bull_ob
blalert.ob := true
if bear_ob
bralert.ob := true
if s_bull_ob
blalert.swingob := true
if s_bear_ob
blalert.swingob := true
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - End }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - FVG | VI | OG }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
ghl() => request.security(syminfo.tickerid, fvg_tf, [high , low , close , open ])
tfG() => request.security(syminfo.tickerid, fvg_tf, )
cG(bool bull) =>
= ghl()
= tfG()
var FVG draw = FVG.new(
array.new()
, array.new()
)
var FVG cords = array.new()
float pup = na
float pdn = na
bool cdn = na
int pos = 2
cc = timeframe.change(fvg_tf)
if barstate.isfirst
for i = 0 to fvg_num - 1
draw.box.unshift(box.new (na, na, na, na, border_color = color.new(color.white, 100), xloc = xloc.bar_time))
draw.ln.unshift (line.new(na, na, na, na, xloc = xloc.bar_time, width = 1, style = line.style_solid))
switch what_fvg
"FVG" =>
pup := bull ? gl : l
pdn := bull ? h : gh
cdn := bull ? gl > h and cc : gh < l and cc
pos := 2
"VI" =>
pup := bull
? (gc > go
? go
: gc)
: (gc > go
? go
: gc )
pdn := bull
? (gc > go
? gc
: go )
: (gc > go
? gc
: go)
cdn := bull
? go > gc and gh > gl and gc > gc and go > go and gh < math.min(gc, go) and cc
: go < gc and gl < gh and gc < gc and go < go and gl > math.max(gc, go) and cc
pos := 1
"OG" =>
pup := bull ? b.l : gl
pdn := bull ? gh : gh
cdn := bull ? gl > gh and cc : gh < gl and cc
pos := 1
if not na(cdn) and cdn
cords.unshift(
FVG.new(
na
, na
, bull
? true
: false
, pup
, pdn
, b.t - (b.t - b.t ) * pos
, b.t + (b.t - b.t ) * fvg_extend)
)
if bull
blalert.fvg := tru
Support Resistance with Order BlocksIndicator Description
Professional Price Level Detection for Smart Trading. Master the Markets with Precision Support/Resistance and Order Block Analysis . It provides traders with clear visual cues for potential reversal and breakout areas, combining both retail and institutional trading concepts into one powerful tool.
The Support & Resistance with Order Blocks indicator is a versatile Pine Script tool designed to empower traders with clear, actionable insights into key market levels. By combining advanced pivot-based support and resistance (S/R) detection with order block (OB) filtering, this indicator delivers clean, high-probability zones for entries, exits, and reversals. With customizable display options (boxes or lines) and intuitive settings, it’s perfect for traders of all styles—whether you’re scalping, swing trading, or investing long-term. Overlay it on your TradingView chart and elevate your trading strategy today!
________________________________________
Key Features
✅ Dynamic Support/Resistance - Auto-adjusting levels based on price action
✅ Smart Order Block Detection - Identifies institutional buying/selling zones
✅ Dual Display Modes - Choose between Boxes or Clean Lines for different chart styles
✅ Customizable Sensitivity - Adjust detection parameters for different markets
✅ Broken Level Markers - Clearly shows when key levels are breached
✅ Timeframe-Adaptive - Automatically adjusts for daily/weekly charts
1. Dynamic Support & Resistance Detection
Identifies critical S/R zones using pivot high/low calculations with adjustable look back periods.
Visualizes active S/R zones with distinct colors and labels ("Support" or "Resistance" for boxes, lines for cleaner charts).
Marks broken S/R levels as "Br S" (broken support) or "Br R" (broken resistance) when historical display is enabled, aiding in breakout and reversal analysis.
2. Smart Order Block Identification
Detects bullish and bearish order blocks based on significant price movements (default: ±0.3% over 5 candles).
Highlights institutional buying/selling zones with customizable colors, displayed as boxes or lines.
Filters out overlapping OB zones to keep your chart clutter-free.
3. Dual Display Options
Boxes or Lines: Choose to display S/R and OB as boxes for detailed zones or lines for a minimalist view.
Line Width Customization: Adjust line widths for S/R and OB (1–5 pixels) for optimal visibility.
Color Customization: Tailor colors for active/broken S/R and bullish/bearish OB zones.
4. Advanced Overlap Filtering
Ensures S/R zones don’t overlap with OB zones or other S/R levels, providing only the most relevant levels.
Limits the number of active zones (default: 10) to maintain chart clarity.
5. Historical S/R Visualization
Optionally display broken S/R levels with distinct colors and labels ("Br S" or "Br R") to track historical price reactions.
Broken levels are dynamically updated and removed (or retained) based on user settings.
6. Timeframe Adaptability
Automatically adjusts pivot detection for daily/weekly timeframes (40-candle look back) versus shorter timeframes (20-candle look back).
Works seamlessly across all asset classes (stocks, forex, crypto, etc.) and timeframes.
________________________________________
How It Works
• Support & Resistance:
Uses ta.pivothigh and ta.pivotlow to detect significant price pivots, with a user-defined look back (default: 5 candles post-pivot).
Plots S/R as boxes (with labels "Support" or "Resistance") or lines, extending to the current bar for real-time relevance.
Broken S/R levels are marked with adjusted colors and labels ("S" or "R" for boxes, "Br S" or "Br R" for lines when historical display is enabled).
• Order Blocks:
Identifies OB based on strong price movements over 4 candles, plotted as boxes or lines at the candle’s midpoint.
Validates OB to prevent overlap, ensuring only significant zones are displayed.
Removes OB zones when price breaks through, keeping the chart focused on active levels.
• Customization:
Toggle S/R and OB visibility, adjust detection sensitivity, and set maximum active zones (4–50).
Fine-tune line widths and colors for a personalized chart experience.
________________________________________
Why Use This Indicator?
• Precision Trading: Pinpoint high-probability entry/exit zones with filtered S/R and OB levels.
• Clean Charts: Overlap filtering and zone limits reduce clutter, focusing on key levels.
• Versatile Display: Switch between boxes for detailed zones or lines for simplicity, with adjustable line widths.
• Institutional Edge: Leverage OB detection to align with institutional activity for smarter trades.
• User-Friendly: Intuitive settings and clear visuals make it accessible for beginners and pros alike.
________________________________________
Settings Overview________________________________________
⚙ Input Parameters
Settings Overview
Display Options:
Display Type: Choose "Boxes" or "Lines" for S/R and OB visualization.
S/R Line Width: Set line thickness for S/R lines (1–5 pixels, default: 2).
OB Line Width: Set line thickness for OB lines (1–5 pixels, default: 2).
Order Block Options:
Show Order Block: Enable/disable OB display.
Bull/Bear OB Colors: Customise border and fill colors for bullish and bearish OB zones.
Support/Resistance Options:
Show S/R: Toggle active S/R zones.
Show Historical S/R: Display broken S/R levels, marked as "Br S" or "Br R" for lines.
Detection Period: Set candle lookback for pivot detection (4–50, default: 5).
Max Active Zones: Limit active S/R and OB zones (4–50, default: 10).
Colors: Customise active and broken S/R colors for clear differentiation.
________________________________________
How to Use
1. Add to Chart: Apply the indicator to your TradingView chart.
2. Customize Settings:
o Select "Boxes" or "Lines" for your preferred display style.
o Adjust line widths, colors, and detection parameters to suit your trading style.
o Enable "Show Historical S/R" to track broken levels with "Br S" and "Br R" labels.
3. Analyze Levels:
o Use support zones (green) for buy entries and resistance zones (red) for sell entries.
o Monitor OB zones for institutional activity, signaling potential reversals or continuations.
o Watch for "Br S" or "Br R" labels to identify breakout opportunities.
4. Combine with Other Tools: Pair with trend indicators, volume analysis, or price action for a robust strategy.
5. Monitor Breakouts: Trade breakouts when price breaches S/R or OB zones, with historical labels providing context.
________________________________________
Example Use Cases
• Swing Trading: Use S/R and OB zones to identify entry/exit points, with historical broken levels for context.
• Breakout Trading: Trade price breaks through S/R or OB, using "Br S" and "Br R" labels to confirm reversals.
• Scalping: Adjust detection period for faster S/R and OB identification on lower timeframes.
________________________________________
• Performance: Optimized for all timeframes, with best results on 5M, 15M, 30M, 1H, 4H, or daily charts for swing trading.
• Compatibility: Works with any asset class and TradingView chart.
________________________________________
Get Started
Transform your trading with Support & Resistance with Order Blocks! Add it to your chart, customize it to your style, and trade with confidence. For questions or feedback, drop a comment on TradingView or message the author. Happy trading! 🚀
________________________________________
Disclaimer: This indicator is for educational and informational purposes only. Always conduct your own analysis and practice proper risk management before trading.
Staccked SMA - Regime Switching & Persistance StatisticsThis indicator is designed to identify the prevailing market regime by analyzing the behavior of a "stack" of Simple Moving Averages (SMAs). It helps you understand whether the market is currently trending, mean-reverting, or moving randomly.
Core Concept: SMA Correlation
At its heart, the indicator examines the relationship between a set of nine SMAs with different lengths (3, 5, 8, 13, 21, 34, 55, 89, 144) and the lengths themselves.
In a strong trending market (either up or down), the SMAs will be neatly "stacked" in order of their length. The shortest SMA will be furthest from the longest SMA, creating a strong, almost linear visual pattern. When we measure the statistical correlation between the SMA values and their corresponding lengths, we get a value close to +1 (perfect uptrend stack) or -1 (perfect downtrend stack). The absolute value of this correlation will be very high (close to 1).
In a mean-reverting or sideways market, the SMAs will be tangled and crisscrossing each other. There is no clear order, and the relationship between an SMA's length and its price value is weak. The correlation will be close to 0.
This indicator calculates this Pearson correlation on every bar, giving a continuous measure of how ordered or "trendy" the SMAs are. An absolute correlation above 0.8 is considered strongly trending, while a value between 0.4 and 0.8 suggests a mean-reverting character. Below 0.4, the market is likely random or choppy.
Regime Classification and Statistics
The indicator doesn't just look at the current correlation; it analyzes its behavior over a user-defined lookback window (default is 252 bars) to classify the overall market "regime."
It presents its findings in a clear table:
📊 |SMA Correlation| Regime Table: This main table provides a snapshot of the current market character.
Median: Shows the median absolute correlation over the lookback period, giving a central tendency of the market's behavior.
% > 0.80: The percentage of time the market was in a strong trend during the lookback period.
% < 0.80 & > 0.40: The percentage of time the market showed mean-reverting characteristics.
🧠 Regime: The final classification. It's labeled "📈 Trend-Dominant" if the median correlation is high and it has spent a significant portion of the time trending. It's labeled "🔄 Mean-Reverting" if the median is in the middle range and it has spent significant time in that state. Otherwise, it's considered "⚖️ Random/ Choppy".
📐 Regime Significance: This tells you how statistically confident you can be in the current regime classification, using a Z-score to compare its occurrence against random chance. ⭐⭐⭐ indicates high confidence (99%), while "❌ Not Significant" means the pattern could be random.
Regime Transition Probabilities
Optionally, a second table can be displayed that shows the historical probability of the market transitioning from one regime to another over different time horizons (t+5, t+10, t+15, and t+20 bars).
📈 → 🔄 → ⚖️ Transition Table: This table answers questions like, "If the market is trending now (From: 📈), what is the probability it will be mean-reverting (→ 🔄) in 10 bars?"
This provides powerful insights into the market's cyclical nature, helping you anticipate future behavior based on past patterns. For example, you might find that after a period of strong trending, a transition to a choppy state is more likely than a direct switch to a mean-reverting
Indicator Settings
Lookback Window for Regime Classification: This sets the number of recent bars (default is 252) the script analyzes to determine the current market regime (Trending, Mean-Reverting, or Random). A larger number provides a more stable, long-term view, while a smaller number makes the classification more sensitive to recent price action.
Show Regime Transition Table: A simple toggle (on/off) to show or hide the table that displays the probabilities of the market switching from one regime to another.
Lookback Offset for Starting Regime: This determines the "starting point" in the past for calculating regime transitions. The default is 20 bars ago. The script looks at the regime at this point and then checks what it became at later points.
Step 1, 2, 3, 4 Offset (bars): These define the future time intervals (5, 10, 15, and 20 bars by default) for the transition probability table. For example, the script checks the regime at the "Lookback Offset" and then sees what it transitioned to 5, 10, 15, and 20 bars later.
Significance Filter Settings
Use Regime Significance Filter: When enabled, this filter ensures that the regime transition statistics only count transitions that were "statistically significant." This helps to filter out noise and focus on more reliable patterns.
Min Stars Required (1=90%, 2=95%, 3=99%): This sets the minimum confidence level required for a regime to be included in the transition statistics when the significance filter is on.
1 ⭐: Requires at least 90% confidence.
2 ⭐⭐: Requires at least 95% confidence (default).
3 ⭐⭐⭐: Requires at least 99% confidence.
Last xHL📈 Last xHL – Visualize Key Highs and Lows
This script highlights the most recent significant highs and lows over a user-defined period, helping traders quickly identify key support and resistance zones.
🔍 Features:
Highest High (HH) and Highest Close/Open (HC) lines
Lowest Low (LL) and Lowest Close/Open (LC) lines
Dynamic updates with each new bar
Gradient-filled zones between HH–HC and LL–LC for visual clarity
⚙️ Customization:
Adjustable lookback period (_length) to suit your trading style
Color-coded lines and fills for quick interpretation
🧠 Use Case:
This tool is ideal for traders who want to:
Spot potential breakout or reversal zones
Identify price compression or expansion areas
Enhance their technical analysis with visual cues
This script is for educational and informational purposes only. It does not constitute financial advice. Always do your own research before making trading decisions.
Divergences HeatmapWhen the price is around a support or resistance zone, look for any divergences. Ignore any signals if the price is ranging.
Alpha - Combined BreakoutThis Pine Script indicator, "Alpha - Combined Breakout," is a combination between Smart Money Breakout Signals and UT Bot Alert, The UT Bot Alert indicator was initially developer by Yo_adriiiiaan
The idea of original code belongs HPotter.
This Indicator helps you identify potential trading opportunities by combining two distinct strategies: Smart Money Breakout and a modified UT Bot (likely a variation of the Ultimate Trend Bot). It provides visual signals, draws lines for potential take profit (TP) and stop loss (SL) levels, and includes a dashboard to track performance metrics.
Tutorial:
Understanding and Using the "Alpha - Combined Breakout" Indicator
This indicator is designed for traders looking for confirmation of market direction and potential entry/exit points by blending structural analysis with a trend-following oscillator.
How it Works (General Concept)
The indicator combines two main components:
Smart Money Breakout: This part identifies significant breaks in market structure, which "smart money" traders often use to gauge shifts in supply and demand. It looks for higher highs/lows or lower highs/lows and flags when these structural points are broken.
UT Bot: This is a trend-following component that generates buy and sell signals based on price action relative to an Average True Range (ATR) based trailing stop.
You can choose to use these signals independently or combined to generate trading alerts and visual cues on your chart. The dashboard provides a quick overview of how well the signals are performing based on your chosen settings and display mode.
Parameters and What They Do
Let's break down each input parameter:
1. Smart Money Inputs
These settings control how the indicator identifies market structure and breakouts.
swingSize (Market Structure Time-Horizon):
What it does: This integer value defines the number of candles used to identify significant "swing" (pivot) points—highs and lows.
Effect: A larger swingSize creates a smoother market structure, focusing on longer-term trends. This means signals might appear less frequently and with some delay but could be more reliable for higher timeframes or broader market movements. A smaller swingSize will pick up more minor market structure changes, leading to more frequent but potentially noisier signals, suitable for lower timeframes or scalping.
Analogy: Think of it like a zoom level on your market structure map. Higher values zoom out, showing only major mountain ranges. Lower values zoom in, showing every hill and bump.
bosConfType (BOS Confirmation Type):
What it does: This string input determines how a Break of Structure (BOS) is confirmed. You have two options:
'Candle Close': A breakout is confirmed only if a candle's closing price surpasses the previous swing high (for bullish) or swing low (for bearish).
'Wicks': A breakout is confirmed if any part of the candle (including its wick) surpasses the previous swing high or low.
Effect: 'Candle Close' provides stronger, more conservative confirmation, as it implies sustained price movement beyond the structure. 'Wicks' provides earlier, more aggressive signals, as it captures momentary breaches of the structure.
Analogy: Imagine a wall. 'Candle Close' means the whole person must get over the wall. 'Wicks' means even a finger touching over the top counts as a breach.
choch (Show CHoCH):
What it does: A boolean (true/false) input to enable or disable the display of "Change of Character" (CHoCH) labels. CHoCH indicates the first structural break against the current dominant trend.
Effect: When true, it helps identify early signs of a potential trend reversal, as it marks where the market's "character" (its tendency to make higher highs/lows or lower lows/highs) first changes.
BULL (Bullish Color) & BEAR (Bearish Color):
What they do: These color inputs allow you to customize the visual appearance of bullish and bearish signals and lines drawn by the Smart Money component.
Effect: Purely cosmetic, helps with visual identification on the chart.
sm_tp_sl_multiplier (SM TP/SL Multiplier (ATR)):
What it does: A float value that acts as a multiplier for the Average True Range (ATR) to calculate the Take Profit (TP) and Stop Loss (SL) levels specifically when you're in "Smart Money Only" mode. It uses the ATR calculated by the UT Bot's nLoss_ut as its base.
Effect: A higher multiplier creates wider TP/SL levels, potentially leading to fewer trades but larger wins/losses. A lower multiplier creates tighter TP/SL levels, potentially leading to more frequent but smaller wins/losses.
2. UT Bot Alerts Inputs
These parameters control the behavior and sensitivity of the UT Bot component.
a_ut (UT Key Value (Sensitivity)):
What it does: This integer value adjusts the sensitivity of the UT Bot.
Effect: A higher value makes the UT Bot less sensitive to price fluctuations, resulting in fewer and potentially more reliable signals. A lower value makes it more sensitive, generating more signals, which can include more false signals.
Analogy: Like a noise filter. Higher values filter out more noise, keeping only strong signals.
c_ut (UT ATR Period):
What it does: This integer sets the look-back period for the Average True Range (ATR) calculation used by the UT Bot. ATR measures market volatility.
Effect: This period directly influences the calculation of the nLoss_ut (which is a_ut * xATR_ut), thus defining the distance of the trailing stop loss and take profit levels. A longer period makes the ATR smoother and less reactive to sudden price spikes. A shorter period makes it more responsive.
h_ut (UT Signals from Heikin Ashi Candles):
What it does: A boolean (true/false) input to determine if the UT Bot calculations should use standard candlestick data or Heikin Ashi candlestick data.
Effect: Heikin Ashi candles smooth out price action, often making trends clearer and reducing noise. Using them for UT Bot signals can lead to smoother, potentially delayed signals that stay with a trend longer. Standard candles are more reactive to raw price changes.
3. Line Drawing Control Buttons
These crucial boolean inputs determine which type of signals will trigger the drawing of TP/SL/Entry lines and flags on your chart. They act as a priority system.
drawLinesUtOnly (Draw Lines: UT Only):
What it does: If checked (true), lines and flags will only be drawn when the UT Bot generates a buy/sell signal.
Effect: Isolates UT Bot signals for visual analysis.
drawLinesSmartMoneyOnly (Draw Lines: Smart Money Only):
What it does: If checked (true), lines and flags will only be drawn when the Smart Money Breakout logic generates a bullish/bearish breakout.
Effect: Overrides drawLinesUtOnly if both are checked. Isolates Smart Money signals.
drawLinesCombined (Draw Lines: UT & Smart Money (Combined)):
What it does: If checked (true), lines and flags will only be drawn when both a UT Bot signal AND a Smart Money Breakout signal occur on the same bar.
Effect: Overrides both drawLinesUtOnly and drawLinesSmartMoneyOnly if checked. Provides the strictest entry criteria for line drawing, looking for strong confluence.
Dashboard Metrics Explained
The dashboard provides performance statistics based on the lines drawing control button selected. For example, if "Draw Lines: UT Only" is active, the dashboard will show stats only for UT Bot signals.
Total Signals: The total number of buy or sell signals generated by the selected drawing mode.
TP1 Win Rate: The percentage of signals where the price reached Take Profit 1 (TP1) before hitting the Stop Loss.
TP2 Win Rate: The percentage of signals where the price reached Take Profit 2 (TP2) before hitting the Stop Loss.
TP3 Win Rate: The percentage of signals where the price reached Take Profit 3 (TP3) before hitting the Stop Loss. (Note: TP1, TP2, TP3 are in order of distance from entry, with TP3 being furthest.)
SL before any TP rate: This crucial metric shows the number of times the Stop Loss was hit / the percentage of total signals where the stop loss was triggered before any of the three Take Profit levels were reached. This gives you a clear picture of how often a trade resulted in a loss without ever moving into profit target territory.
Short Tutorial: How to Use the Indicator
Add to Chart: Open your TradingView chart, go to "Indicators," search for "Alpha - Combined Breakout," and add it to your chart.
Access Settings: Once added, click the gear icon next to the indicator name on your chart to open its settings.
Choose Your Signal Mode:
For UT Bot only: Uncheck "Draw Lines: Smart Money Only" and "Draw Lines: UT & Smart Money (Combined)". Ensure "Draw Lines: UT Only" is checked.
For Smart Money only: Uncheck "Draw Lines: UT Only" and "Draw Lines: UT & Smart Money (Combined)". Ensure "Draw Lines: Smart Money Only" is checked.
For Combined Signals: Check "Draw Lines: UT & Smart Money (Combined)". This will override the other two.
Adjust Parameters:
Start with default settings. Observe how the signals appear on your chosen asset and timeframe.
Refine Smart Money: If you see too many "noisy" market structure breaks, increase swingSize. If you want earlier breakouts, try "Wicks" for bosConfType.
Refine UT Bot: Adjust a_ut (Sensitivity) to get more or fewer UT Bot signals. Change c_ut (ATR Period) if you want larger or smaller TP/SL distances. Experiment with h_ut to see if Heikin Ashi smoothing suits your trading style.
Adjust TP/SL Multiplier: If using "Smart Money Only" mode, fine-tune sm_tp_sl_multiplier to set appropriate risk/reward levels.
Interpret Signals & Lines:
Buy/Sell Flags: These indicate the presence of a signal based on your selected drawing mode.
Entry Line (Blue Solid): This is where the signal was generated (usually the close price of the signal candle).
SL Line (Red/Green Solid): Your calculated stop loss level.
TP Lines (Dashed): Your three calculated take profit levels (TP1, TP2, TP3, where TP3 is the furthest target).
Smart Money Lines (BOS/CHoCH): These lines indicate horizontal levels where market structure breaks occurred. CHoCH labels might appear at the first structural break against the prior trend.
Monitor Dashboard: Pay attention to the dashboard in the top right corner. This dynamically updates to show the win rates for each TP and, crucially, the "SL before any TP rate." Use these statistics to evaluate the effectiveness of the indicator's signals under your current settings and chosen mode.
*
Set Alerts (Optional): You can set up alerts for any of the specific signals (UT Bot Long/Short, Smart Money Bullish/Bearish, or the "Line Draw" combined signals) to notify you when they occur, even if you're not actively watching the chart.
By following this tutorial, you'll be able to effectively use and customize the "Alpha - Combined Breakout" indicator to suit your trading strategy.
Volumetric Compressed MAVCMA uses the compressor and weighted stdev functions originally translated to pine by @gorx1. Compressor is usually used in audio to avoid clipping of certain frequencies. The original idea is actually pretty simple:
ma(simple string smt, float src, simple int len) =>
switch smt
'RMA' => ta.rma(src, len)
'SMA' => ta.sma(src, len)
'EMA' => ta.ema(src, len)
'WMA' => ta.wma(src, len)
'HMA' => ta.hma(src, len)
'LSMA' => ta.linreg(src, len, 0)
=> na
compressor(float in_1, simple int len, simple int thresh_dn_m, simple int thresh_up_m) =>
data = math.log(math.abs(in_1))
loc = ta.wma(data, len)
dev = wstdev(data, len)
thresh_dn = loc + dev * thresh_dn_m
thresh_up = loc + dev * thresh_up_m
math.exp(math.min(math.max(data, thresh_up), thresh_dn)) - math.exp(thresh_up)
compressed_out = compressor(volume, len_window, up_thresh, down_thresh)
comp_ma = ma(ma_type, close * compressed_out, len_ml) / ma(ma_type, compressed_out, len_ml)
vwma = ma(ma_type, close, len_window)
We get the ratio of the compressed volume calculation and plot it with the base MA. Base MA's length is determined by window size input compared to ML length that is used for compressed version.
This provides us another possible confirmation indicator that can be used to take advantage of volume ranges. Autmated crossover alerts are also added. A reminder is that this kind of indicators should not be used on it's own for trading but rather should be used as a confirmation along with your trend detection and main entry indicators to provide additional confluence.
Zen Open - 18 Bar v2Zen Open – 18 Bar Box (RTH Study Tool)
📄 Description:
This script highlights the first 18 bars of each Regular Trading Hours (RTH) session with a visual box and optional range label. It is intended as a study aid for traders analyzing early session structure.
Features:
• Draws a box around the first 18 bars of the RTH session
• Displays the total range as a label (optional)
• Fully customizable box color and transparency
Intended Use:
This is an educational and visual analysis tool to help traders research how the RTH open influences the rest of the session.
Tight opening range may suggest range expansion
Wide opening range may indicate reduced movement or reversal risk
This script does not generate trading signals, does not offer financial advice, and does not promote any service. It is provided for discretionary study and chart analysis only.
Smart RSI Divergence PRO | Auto Lines + Alerts
**Smart RSI Divergence PRO**
This indicator automatically finds RSI divergences on price charts:
🔹 Regular & Hidden divergences
🔹 Auto trendlines connecting swing highs & lows
🔹 Clear triangle labels on the chart
🔹 Ready-to-use alerts for your strategy
Use it to spot potential trend reversals and hidden continuation signals.
---
**How it works**
- **Regular Divergence**: Price makes a higher high (or lower low) while RSI does not → possible reversal.
- **Hidden Divergence**: Price makes a lower high (or higher low) while RSI makes a higher high (or lower low) → possible trend continuation.
---
**Signal colors**
🔻 Red triangle — Regular Bearish Divergence (potential short)
🔻 Orange triangle — Hidden Bearish Divergence (possible trend continuation down)
🔺 Green triangle — Regular Bullish Divergence (potential long)
🔺 Blue triangle — Hidden Bullish Divergence (possible trend continuation up)
Works on any timeframe and market (crypto, forex, indices, stocks).
---
**💡 Want a custom version?**
I can build private Pine Script indicators & strategies **made just for you** — scalping tools, trend or reversal signals, custom filters for crypto, forex, stocks, or any pairs you trade.
I can also improve or fix your existing scripts.
If you want a unique, clean, and profitable setup — contact me anytime!
📩 Telegram 👉 t.me
Fibonacci 61.8 BUY or SELL (EMA-Filtered)This indicator helps identify Fibonacci-based Buy or Sell zones based on recent pivot highs/lows, but only when filtered by the EMA trend.
✅ Buy Zones: Only when price is above EMA
✅ Sell Zones: Only when price is below EMA
🟩 Draws a 61.8% Fibonacci retracement line
🟥 Adds a label with price value: BUY @ or SELL @
📏 All drawing is based on pivot structure (LL → LH for buy; HH → HL for sell)
📊 EMA Trend Filter
Only draws buy setups when price > EMA
Only draws sell setups when price < EMA
You can change the EMA length:
📈 How It Works – Step by Step
✅ BUY SETUP (LL → LH, only if price > EMA):
Detects pivot low → stores as prevLow
Detects pivot high after that → stores as prevHigh
Calculates Fib Level:
fibLevel = prevLow + (prevHigh - prevLow) * 0.618
Draws a green dashed line at that fib level
Adds a label to the right:
"BUY @ price"
🚫 SELL SETUP (HH → HL, only if price < EMA):
Detects pivot high → stores as prevHigh
Detects pivot low after that → stores as prevLow
Calculates Fib Level:
fibLevel = prevHigh - (prevHigh - prevLow) * 0.618
Draws a red dashed line at that fib level
Adds a label to the right:
"SELL @ price"
✅ Strengths
Simple yet powerful EMA + Fibonacci strategy
Visually clean: only one signal shown at a time
Customizable: style, color, width, offset, precision
Works well for trend continuation trades
⚠️ Limitations
Only shows latest setup, not historical signals
Does not show price breaking fib level or reacting to it
Assumes fixed 61.8% retracement—no multi-level analysis
Doesn't differentiate between minor and major pivots
📌 How to Trade It
🟢 BUY Example:
Price above EMA
Pivot Low → Pivot High → 61.8% level plotted
Wait for price to react at that level to go long
🔴 SELL Example:
Price below EMA
Pivot High → Pivot Low → 61.8% level plotted
Wait for price to react at that level to go short
Active PMI Support/Resistance Levels [EdgeTerminal]The PMI Support & Resistance indicator revolutionizes traditional technical analysis by using Pointwise Mutual Information (PMI) - a statistical measure from information theory - to objectively identify support and resistance levels. Unlike conventional methods that rely on visual pattern recognition, this indicator provides mathematically rigorous, quantifiable evidence of price levels where significant market activity occurs.
- The Mathematical Foundation: Pointwise Mutual Information
Pointwise Mutual Information measures how much more likely two events are to occur together compared to if they were statistically independent. In our context:
Event A: Volume spikes occurring (high trading activity)
Event B: Price being at specific levels
The PMI formula calculates: PMI = log(P(A,B) / (P(A) × P(B)))
Where:
P(A,B) = Probability of volume spikes occurring at specific price levels
P(A) = Probability of volume spikes occurring anywhere
P(B) = Probability of price being at specific levels
High PMI scores indicate that volume spikes and certain price levels co-occur much more frequently than random chance would predict, revealing genuine support and resistance zones.
- Why PMI Outperforms Traditional Methods
Subjective interpretation: What one trader sees as significant, another might ignore
Confirmation bias: Tendency to see patterns that confirm existing beliefs
Inconsistent criteria: No standardized definition of "significant" volume or price action
Static analysis: Doesn't adapt to changing market conditions
No strength measurement: Can't quantify how "strong" a level truly is
PMI Advantages:
✅ Objective & Quantifiable: Mathematical proof of significance, not visual guesswork
✅ Statistical Rigor: Levels backed by information theory and probability
✅ Strength Scoring: PMI scores rank levels by statistical significance
✅ Adaptive: Automatically adjusts to different market volatility regimes
✅ Eliminates Bias: Computer-calculated, removing human interpretation errors
✅ Market Structure Aware: Reveals the underlying order flow concentrations
- How It Works
Data Processing Pipeline:
Volume Analysis: Identifies volume spikes using configurable thresholds
Price Binning: Divides price range into discrete levels for analysis
Co-occurrence Calculation: Measures how often volume spikes happen at each price level
PMI Computation: Calculates statistical significance for each price level
Level Filtering: Shows only levels exceeding minimum PMI thresholds
Dynamic Updates: Refreshes levels periodically while maintaining historical traces
Visual System:
Current Levels: Bright, thick lines with PMI scores - your actionable levels
Historical Traces: Faded previous levels showing market structure evolution
Strength Tiers: Line styles indicate PMI strength (solid/dashed/dotted)
Color Coding: Green for support, red for resistance
Info Table: Real-time display of strongest levels with scores
- Indicator Settings:
Core Parameters
Lookback Period (Default: 200)
Lower (50-100): More responsive to recent price action, catches short-term levels
Higher (300-500): Focuses on major historical levels, more stable but less responsive
Best for: Day trading (100-150), Swing trading (200-300), Position trading (400-500)
Volume Spike Threshold (Default: 1.5)
Lower (1.2-1.4): More sensitive, catches smaller volume increases, more levels detected
Higher (2.0-3.0): Only major volume surges count, fewer but stronger signals
Market dependent: High-volume stocks may need higher thresholds (2.0+), low-volume stocks lower (1.2-1.3)
Price Bins (Default: 50)
Lower (20-30): Broader price zones, less precise but captures wider areas
Higher (70-100): More granular levels, precise but may be overly specific
Volatility dependent: High volatility assets benefit from more bins (70+)
Minimum PMI Score (Default: 0.5)
Lower (0.2-0.4): Shows more levels including weaker ones, comprehensive view
Higher (1.0-2.0): Only statistically strong levels, cleaner chart
Progressive filtering: Start with 0.5, increase if too cluttered
Max Levels to Show (Default: 8)
Fewer (3-5): Clean chart focusing on strongest levels only
More (10-15): Comprehensive view but may clutter chart
Strategy dependent: Scalpers prefer fewer (3-5), swing traders more (8-12)
Historical Tracking Settings
Update Frequency (Default: 20 bars)
Lower (5-10): More frequent updates, captures rapid market changes
Higher (50-100): Less frequent updates, focuses on major structural shifts
Timeframe scaling: 1-minute charts need lower frequency (5-10), daily charts higher (50+)
Show Historical Levels (Default: True)
Enables the "breadcrumb trail" effect showing evolution of support/resistance
Disable for cleaner charts focusing only on current levels
Max Historical Marks (Default: 50)
Lower (20-30): Less memory usage, shorter history
Higher (100-200): Longer historical context but more resource intensive
Fade Strength (Default: 0.8)
Lower (0.5-0.6): Historical levels more visible
Higher (0.9-0.95): Historical levels very subtle
Visual Settings
Support/Resistance Colors: Choose colors that contrast well with your chart theme Line Width: Thicker lines (3-4) for better visibility on busy charts Show PMI Scores: Toggle labels showing statistical strength Label Size: Adjust based on screen resolution and chart zoom level
- Most Effective Usage Strategies
For Day Trading:
Setup: Lookback 100-150, Volume Threshold 1.8-2.2, Update Frequency 10-15
Use PMI levels as bounce/rejection points for scalp entries
Higher PMI scores (>1.5) offer better probability setups
Watch for volume spike confirmations at levels
For Swing Trading:
Setup: Lookback 200-300, Volume Threshold 1.5-2.0, Update Frequency 20-30
Enter on pullbacks to high PMI support levels
Target next resistance level with PMI score >1.0
Hold through minor levels, exit at major PMI levels
For Position Trading:
Setup: Lookback 400-500, Volume Threshold 2.0+, Update Frequency 50+
Focus on PMI scores >2.0 for major structural levels
Use for portfolio entry/exit decisions
Combine with fundamental analysis for timing
- Trading Applications:
Entry Strategies:
PMI Bounce Trades
Price approaches high PMI support level (>1.0)
Wait for volume spike confirmation (orange triangles)
Enter long on bullish price action at the level
Stop loss just below the PMI level
Target: Next PMI resistance level
PMI Breakout Trades
Price consolidates near high PMI level
Volume increases (watch for orange triangles)
Enter on decisive break with volume
Previous resistance becomes new support
Target: Next major PMI level
PMI Rejection Trades
Price approaches PMI resistance with momentum
Watch for rejection signals and volume spikes
Enter short on failure to break through
Stop above the PMI level
Target: Next PMI support level
Risk Management:
Stop Loss Placement
Place stops 0.1-0.5% beyond PMI levels (adjust for volatility)
Higher PMI scores warrant tighter stops
Use ATR-based stops for volatile assets
Position Sizing
Larger positions at PMI levels >2.0 (highest conviction)
Smaller positions at PMI levels 0.5-1.0 (lower conviction)
Scale out at multiple PMI targets
- Key Warning Signs & What to Watch For
Red Flags:
🚨 Very Low PMI Scores (<0.3): Weak statistical significance, avoid trading
🚨 No Volume Confirmation: PMI level without recent volume spikes may be stale
🚨 Overcrowded Levels: Too many levels close together suggests poor parameter tuning
🚨 Outdated Levels: Historical traces are reference only, not tradeable
Optimization Tips:
✅ Regular Recalibration: Adjust parameters monthly based on market regime changes
✅ Volume Context: Always check for recent volume activity at PMI levels
✅ Multiple Timeframes: Confirm PMI levels across different timeframes
✅ Market Conditions: Higher thresholds during high volatility periods
Interpreting PMI Scores
PMI Score Ranges:
0.5-1.0: Moderate statistical significance, proceed with caution
1.0-1.5: Good significance, reliable for most trading strategies
1.5-2.0: Strong significance, high-confidence trade setups
2.0+: Very strong significance, institutional-grade levels
Historical Context: The historical trace system shows how support and resistance evolve over time. When current levels align with multiple historical traces, it indicates persistent market memory at those prices, significantly increasing the level's reliability.
ma rationing🧠 MA Rationing Indicator – Multi-Averaged Momentum + Divergence Zones
This script blends various moving average ratios (SMA, EMA, WMA, RMA) to create a smoothed and zero-centered momentum oscillator. Its goal is to highlight shifts in trend strength and spot possible divergences confirmed by volume.
🔍 Key Features:
• MA Ratio Core: Composite of multiple MA types across a short vs. long smoothing window, plotted against zero for trend clarity.
• Visual Acceleration Markers: Circle color intensity reflects momentum acceleration or deceleration.
• Volume-Supported Divergence: Highlights when price diverges from momentum and volume supports the signal.
• RSI Zone Highlighting: Dynamically draws boxes over RSI Overbought/Oversold regions as sentiment zones form.
• Custom Alerts: Includes alerts for zero-line crosses and divergence + volume confirmation.
This tool is designed for users seeking to combine price action, momentum, and volume into one clear visualization. It does not provide direct trade signals and should be used alongside your broader analysis.
Golden Pocket Syndicate [GPS]Golden Pocket Syndicate is a multi-layered market analysis toolkit built for precision entries and sniper-style reversals in both trending and ranging conditions. The script fuses volume dynamics, golden pocket structures, market maker behavior, and liquidation cluster tracking into one high-confluence system.
Core Features:
• 📐 Golden Pocket Zones: Dynamic GP levels from daily, weekly, monthly, and yearly timeframes. These levels update in real-time and serve as confluence zones for entries and exits.
• 📊 WaveTrend Divergence Diamonds: Momentum shifts are detected using a custom filtered WaveTrend cross system to mark high-probability reversal conditions.
• 🧠 Market Maker Premium Divergence: Tracks price dislocation between CME and Binance to detect large player manipulation using a configurable premium threshold.
• 💎 MM Reversal Diamonds: Identifies potential market maker traps and large player pivots using historical candle behavior, EMA alignment, and price structure breaks.
• 📉 Stealth Liquidation Cluster Arrows: Volume-based liquidation pressure visualized as lightweight directional arrows based on calculated wick expansion and volume bursts. Highlights key zones where price is likely to bounce or reject.
• 🧭 Trend Validation: Uses volume-based trend conditions and short-term EMA positioning to further qualify signals and eliminate noise.
How to Use:
This indicator is designed to help traders visualize confluence between key institutional price levels, momentum shifts, and volume-based pressure points. Long/short opportunities can be explored at marked reversal diamonds or liquidation zones that align with key GP levels. Intended for use on higher timeframes (15m to 4H), though flexible across any pair or market.
HL/OL Histogram + (Close-Open)🧠 Core Concept
This indicator is designed to detect meaningful directional intent in price action using a combination of:
Intrabar candle structure (high - open, open - low)
Net price momentum (close - open)
Timed trigger levels (frozen buy/sell prices based on selected timeframe closes)
The core idea is to visually separate bullish and bearish energy in the current bar, and to mark the price at which momentum flips from down to up or vice versa, based on a change in the close - open differential.
🔍 Components Breakdown
1. Histogram Bars
Green Bars (high - open): Represent bullish upper wicks, showing intrabar strength above the open.
Red Bars (open - low): Represent bearish lower wicks, showing pressure below the open.
Plotted as histograms above and below the zero line.
2. Close–Open Line (White)
Plots the difference between close and open for each bar.
Helps you visually track when momentum flips from negative to positive, or vice versa.
A bold black zero line provides clear reference for these flips.
3. Buy/Sell Signal Logic
A Buy Trigger is generated when close - open crosses above zero
A Sell Trigger occurs when close - open crosses below zero
These trigger events are one-shot, meaning they’re only registered once per signal direction. No retriggers occur until the opposite condition is met.
📈 Trigger Price Table (Static)
On a signal trigger, the close price from a lower timeframe (15S, 30S, 1, 2, 3, or 5 min) is captured.
This price is frozen and displayed in a table at the top-right of the pane.
The price remains fixed until the opposite trigger condition fires, at which point it is replaced.
Why close price?
Using the close from the lower timeframe gives a precise, decisive reference point — ideal for planning limit entries or confirming breakout commitment.
🛠️ Use Cases
Momentum traders can use the histogram and line to time entries after strong open rejection or close breakouts.
Scalpers can quickly gauge intrabar sentiment reversals and react to new momentum without waiting for candle closes.
Algo builders can use the frozen price logic as precise entry or confirmation points in automated strategies.
YAS V1Use on chart
6
80
This advanced "All-in-One" indicator combines the most powerful smart money concepts (SMC), order blocks (OB), fair value gaps (FVG), support & resistance (SR), and liquidity voids, along with entry signals based on EMA and RSI filters.
💡 Key Features:
✅ Order Blocks (OB):
Highlights potential bullish and bearish order blocks to identify strong institutional zones where price might reverse.
✅ Fair Value Gaps (FVG):
Marks price gaps that indicate imbalance and possible zones for retracement or continuation.
✅ Support & Resistance (SR):
Automatically plots dynamic support and resistance levels using pivots, helping you to spot key reaction areas.
✅ Liquidity Voids:
Visualizes potential liquidity gaps or low-volume areas that can act as price magnets.
✅ Buy & Sell Signals:
Generates dynamic BUY and SELL signals based on a combination of EMA trend filters and RSI overbought/oversold levels.
✅ Fully Configurable:
Choose which features to display (OB, FVG, SR, Liquidity Voids, signals).
Adjust EMA and RSI settings to match your strategy.
Control the number of signals (reduce or increase) using a signal sensitivity filter.
⚙️ How it Works:
Trend Filter (EMA):
Price above EMA confirms a bullish environment, below EMA confirms bearish.
RSI Filter:
Signals are validated with RSI to avoid overtrading in ranging markets.
Zones & Gaps:
Institutional concepts (order blocks, gaps) help traders understand supply/demand and price inefficiencies.
🎯 Usage:
Perfect for:
Scalpers looking for intraday turning points.
Swing traders spotting high-probability levels.
Anyone interested in smart money concepts.
🚨 Alerts:
Includes built-in alerts for both BUY and SELL signals so you can react instantly without watching the screen all the time.
💬 Note:
This is a beta version designed to be improved with community feedback. Use it as a guide, and always confirm signals with your own analysis and risk management.
🔥 Ready to take your trading to the next level? Add this indicator to your chart, customize the settings, and start seeing the market like smart money!
AV BTC Pi Cycle OscillatorPi Cycle Oscillator
The oscillator version of the Pi Cycle Top Indicator. While I have found great differences in scales being used for the oscillator across various sources. The shape of the oscillator line is on the other hand the same across the board. With 2 specific versions. Either using the 111 Day SMA or the 2*350 SMA for division.
We allow for both versions. It is possible to select the formula for calculation on the input tab.
Either using (111 SMA - 2*350 SMA) / 111 SMA (default) or (111 SMA - 2*350 SMA) / 2*350 SMA .
We multiply the result by -100 so that overbought conditions fall at the top of the indicator chart and oversold at the bottom. Everyone has their own idea of the value range. This is no different.
For both formulas around 0 is overbought zone, while -200 and -70 are oversold areas. Thresholds are configurable in the input tab. I made an arbitrary choice for the thresholds.
If you want to see overbought and oversold areas on the price chart: Enable the Overbought and oversold Overlay area in the style tab. It is disabled by default.
Additionally: Pi Cycle Tops are marked with a red circle. ATH tops are marked with yellow diamonds. Grey lines marks halving days.
Smart Price Divergence (MACD Filter) + EMA
Smart MACD Price Divergence + EMA
This indicator automatically spots price divergences filtered by MACD momentum and trend direction with EMA:
🔹 Finds regular bullish & bearish divergences
🔹 Filters signals using a simple EMA trend filter
🔹 Clear triangle labels on the chart
🔹 Ready-to-use alerts for your strategy
Use it to catch potential reversal points when the trend may be losing strength.
How it works
Bearish Divergence: Price makes a higher high above the EMA while MACD makes a lower high → possible reversal down.
Bullish Divergence: Price makes a lower low below the EMA while MACD makes a higher low → possible reversal up.
The EMA filter helps spot extreme areas where the trend may be overextended.
Signal colors
🔻 Red triangle — Bearish Price Divergence (potential short)
🔺 Green triangle — Bullish Price Divergence (potential long)
Works on any timeframe and market (crypto, forex, indices, stocks).
✅ Subscribe to my profile to get new useful Pine Script tools soon!
💡 Want a custom version?
I can build private Pine Script indicators & strategies tailored exactly for you — scalping signals, trend or reversal strategies, custom filters for crypto, forex, stocks, or any pairs you trade.
I can also improve or fix your existing scripts.
If you want a unique, high-quality and profitable tool — contact me anytime!
📩 Telegram 👉 t.me
Rob Hoffman IRB Strategy by SniffDog30 Min Bonk Strategy. Not sure if this is beneficial for other tokens/coins. Use at you own risk.
Good strategy for starter in Rob Hoffman style of indicators.
NOTE:
1) Switch to 30 mins
2) adjust to your exchange and quantity of trade
Top 10 NASDAQ Resilience + DD BandsTracks the top 10 weighted stocks in NQ and has DD bands from RS included.
VIX-Price Covariance MonitorThe VIX-Price Covariance Monitor is a statistical tool that measures the evolving relationship between a security's price and volatility indices such as the VIX (or VVIX).
It can give indication of potential market reversal, as typically, volatility and the VIX increase before markets turn red,
This indicator calculates the Pearson correlation coefficient using the formula:
ρ(X,Y) = cov(X,Y) / (σₓ × σᵧ)
Where:
ρ is the correlation coefficient
cov(X,Y) is the covariance between price and the volatility index
σₓ and σᵧ are the standard deviations of price and the volatility index
Enjoy!
Features
Dual Correlation Periods: Analyze both short-term and long-term correlation trends simultaneously
Adaptive Color Coding: Correlation strength is visually represented through color intensity
Market Condition Assessment: Automatic interpretation of correlation values into actionable market insights
Leading/Lagging Analysis: Optional time-shift analysis to detect predictive relationships
Detailed Information Panel: Real-time statistics including current correlation values, historical averages, and trading implications
Interpretation
Positive Correlation (Red): Typically bearish for price, as rising VIX correlates with falling markets. This is what traders should be looking for.
Negative Correlation (Green): Typically bullish for price, as falling VIX correlates with rising markets
How to use it
Apply the indicator to any chart to see its correlation with the default VIX index
Adjust the correlation length to match your trading timeframe (shorter for day trading, longer for swing trading)
Enable the secondary correlation period to compare different timeframes simultaneously
For advanced analysis, enable the Leading/Lagging feature to detect if VIX changes precede or follow price movements
Use the information panel to quickly assess the current market condition and potential trading implications