Dr. Yousif's squares

Dr. Yousif's Squares Indicator – Complete Documentation
Overview
Dr. Yousif's Squares is a multi-timeframe price visualization indicator developed in Pine Script v6 for TradingView. Instead of using traditional support and resistance lines, the indicator represents each candle as a rectangular price zone (Square) that highlights the candle's entire trading range (High → Low).
The indicator can simultaneously display the current candle, the previous candle, and the second previous candle from multiple higher timeframes on any lower timeframe chart.
Each square also contains a dotted midpoint line representing the 50% equilibrium price of that candle.
The purpose of the indicator is to help traders quickly identify:
Higher timeframe trading ranges
Institutional price zones
Candle equilibrium (50% level)
Potential support and resistance areas
Liquidity regions
Price reactions around previous candles
Main Features
1. Multi-Timeframe Analysis
The indicator supports up to five independent timeframes simultaneously.
Default configuration:
Timeframe Description
TF1 1 Hour
TF2 4 Hours
TF3 Daily
TF4 Weekly
TF5 Monthly
Each timeframe operates independently and has:
Separate color
Individual enable/disable option
Independent square generation
This allows traders to visualize important price ranges from several higher timeframes without changing charts.
2. Candle Squares
Instead of drawing only High and Low levels, the indicator creates a rectangle covering the complete price range of a candle.
Each square includes:
Top = High
Bottom = Low
Left = Candle opening time
Right = Extended into future
Graphically:
High
┌──────────────────────┐
│ │
│ │
│---------50%----------│
│ │
│ │
└──────────────────────┘
Low
The rectangle represents the complete trading range of that candle.
3. Current Candle Display
When enabled:
Show Current Candle = ON
The indicator creates a square using:
Current Higher Timeframe Candle
Variables:
High
Low
Time
This square updates whenever a new candle begins on that timeframe.
4. Previous Candle Display
When enabled:
Show Previous Candle = ON
The indicator displays the immediately completed candle.
Internally it uses:
high[1]
low[1]
time[1]
This helps traders monitor the last completed institutional range.
5. Previous Two Candles
When enabled:
Show Previous 2 Candles
The script also displays:
high[2]
low[2]
time[2]
This provides historical reference zones for comparison with current market behavior.
6. Midpoint (Equilibrium)
Each square contains a dotted horizontal line.
The midpoint is calculated as:
Midpoint = (High + Low) / 2
Example:
High = 100
Low = 80
Midpoint = 90
This level represents the equilibrium price of that candle.
Many traders monitor this level because price often reacts around the midpoint before continuing its trend.
7. Box Extension
The parameter:
Box Width
controls how far the rectangle extends into the future.
Formula:
Right Side =
Start Time
+
(Timeframe Seconds × Extension)
Example:
1H candle
3600 seconds
Extension = 2
The box extends
2 Hours
to the right.
8. Border Thickness
Users can customize the border width.
Available values:
1
2
3
4
5
A thicker border improves visibility on busy charts.
9. Individual Timeframe Colors
Every timeframe has its own color.
Example defaults:
1H → Blue
4H → Green
Daily → Orange
Weekly → Purple
Monthly → Red
This makes it easy to distinguish overlapping zones.
10. Enable / Disable Individual Timeframes
Each timeframe has an independent switch.
Example:
Enable TF1
Enable TF2
Enable TF3
Enable TF4
Enable TF5
You can display only Daily zones or only Weekly zones depending on your trading style.
11. Automatic Updates
The indicator detects when a new candle forms on each higher timeframe.
Internally:
newBar = ta.change(time) != 0
Whenever a new candle begins:
The script:
Deletes previous boxes
Deletes previous midpoint lines
Creates fresh objects
This keeps the chart clean.
12. Higher Timeframe Data
The script uses:
request.security()
to retrieve data from higher timeframes.
For every timeframe it requests:
Current candle
High
Low
Time
Previous candle
High[1]
Low[1]
Time[1]
Second previous candle
High[2]
Low[2]
Time[2]
This allows accurate multi-timeframe visualization regardless of the chart timeframe.
13. Time-Based Drawing
The indicator draws using:
xloc.bar_time
instead of
bar_index
Advantages:
No 500-bar limitation
Accurate positioning across all timeframes
Boxes maintain correct alignment during zooming and scrolling
14. Legend Table
A built-in table appears in one corner of the chart.
It displays:
TF Color
1H ■
4H ■
1D ■
1W ■
1M ■
The table position is user-selectable:
Top Right
Top Left
Bottom Right
Bottom Left
Trading Interpretation
The indicator itself does not generate buy or sell signals. Instead, it provides a visual framework for understanding how price interacts with significant higher-timeframe ranges.
Common ways traders use these zones include:
Support
If price revisits the Low of a higher-timeframe square and buyers step in, the area may act as support.
Resistance
If price reaches the High of a higher-timeframe square and selling pressure appears, the area may function as resistance.
Equilibrium
The dotted midpoint often serves as a decision area where price may:
Reverse
Consolidate
Continue the prevailing trend
Many traders monitor this level as a balance point between buyers and sellers.
Liquidity
The extremes of each square (High and Low) frequently coincide with areas where liquidity accumulates. Price may revisit these levels to trigger resting orders before reversing or continuing.
Advantages
Multi-timeframe visualization in a single chart
Clean graphical representation of candle ranges
Automatic updates on new higher-timeframe candles
Customizable colors and appearance
Configurable box width and border thickness
Optional display of current and historical candles
Built-in legend for quick reference
Time-based drawing avoids future bar limitations
Typical Use Cases
This indicator is particularly useful for:
Price Action trading
Smart Money Concepts (SMC)
Institutional order flow analysis
Support and resistance mapping
Swing trading
Intraday trading
Scalping with higher-timeframe context
Multi-timeframe confluence analysis
Summary
Dr. Yousif's Squares transforms higher-timeframe candles into persistent price zones, allowing traders to view important market structure directly on lower-timeframe charts. Each square represents the full High-to-Low range of a candle, while the dotted midpoint highlights its equilibrium level. By combining multiple timeframes, customizable visuals, and automatic updates, the indicator provides a structured way to monitor key price zones where reactions, reversals, or continuations are more likely to occur. It is best used as a contextual analysis tool alongside price action, market structure, and risk management rather than as a standalone trading system.
Overview
Dr. Yousif's Squares is a multi-timeframe price visualization indicator developed in Pine Script v6 for TradingView. Instead of using traditional support and resistance lines, the indicator represents each candle as a rectangular price zone (Square) that highlights the candle's entire trading range (High → Low).
The indicator can simultaneously display the current candle, the previous candle, and the second previous candle from multiple higher timeframes on any lower timeframe chart.
Each square also contains a dotted midpoint line representing the 50% equilibrium price of that candle.
The purpose of the indicator is to help traders quickly identify:
Higher timeframe trading ranges
Institutional price zones
Candle equilibrium (50% level)
Potential support and resistance areas
Liquidity regions
Price reactions around previous candles
Main Features
1. Multi-Timeframe Analysis
The indicator supports up to five independent timeframes simultaneously.
Default configuration:
Timeframe Description
TF1 1 Hour
TF2 4 Hours
TF3 Daily
TF4 Weekly
TF5 Monthly
Each timeframe operates independently and has:
Separate color
Individual enable/disable option
Independent square generation
This allows traders to visualize important price ranges from several higher timeframes without changing charts.
2. Candle Squares
Instead of drawing only High and Low levels, the indicator creates a rectangle covering the complete price range of a candle.
Each square includes:
Top = High
Bottom = Low
Left = Candle opening time
Right = Extended into future
Graphically:
High
┌──────────────────────┐
│ │
│ │
│---------50%----------│
│ │
│ │
└──────────────────────┘
Low
The rectangle represents the complete trading range of that candle.
3. Current Candle Display
When enabled:
Show Current Candle = ON
The indicator creates a square using:
Current Higher Timeframe Candle
Variables:
High
Low
Time
This square updates whenever a new candle begins on that timeframe.
4. Previous Candle Display
When enabled:
Show Previous Candle = ON
The indicator displays the immediately completed candle.
Internally it uses:
high[1]
low[1]
time[1]
This helps traders monitor the last completed institutional range.
5. Previous Two Candles
When enabled:
Show Previous 2 Candles
The script also displays:
high[2]
low[2]
time[2]
This provides historical reference zones for comparison with current market behavior.
6. Midpoint (Equilibrium)
Each square contains a dotted horizontal line.
The midpoint is calculated as:
Midpoint = (High + Low) / 2
Example:
High = 100
Low = 80
Midpoint = 90
This level represents the equilibrium price of that candle.
Many traders monitor this level because price often reacts around the midpoint before continuing its trend.
7. Box Extension
The parameter:
Box Width
controls how far the rectangle extends into the future.
Formula:
Right Side =
Start Time
+
(Timeframe Seconds × Extension)
Example:
1H candle
3600 seconds
Extension = 2
The box extends
2 Hours
to the right.
8. Border Thickness
Users can customize the border width.
Available values:
1
2
3
4
5
A thicker border improves visibility on busy charts.
9. Individual Timeframe Colors
Every timeframe has its own color.
Example defaults:
1H → Blue
4H → Green
Daily → Orange
Weekly → Purple
Monthly → Red
This makes it easy to distinguish overlapping zones.
10. Enable / Disable Individual Timeframes
Each timeframe has an independent switch.
Example:
Enable TF1
Enable TF2
Enable TF3
Enable TF4
Enable TF5
You can display only Daily zones or only Weekly zones depending on your trading style.
11. Automatic Updates
The indicator detects when a new candle forms on each higher timeframe.
Internally:
newBar = ta.change(time) != 0
Whenever a new candle begins:
The script:
Deletes previous boxes
Deletes previous midpoint lines
Creates fresh objects
This keeps the chart clean.
12. Higher Timeframe Data
The script uses:
request.security()
to retrieve data from higher timeframes.
For every timeframe it requests:
Current candle
High
Low
Time
Previous candle
High[1]
Low[1]
Time[1]
Second previous candle
High[2]
Low[2]
Time[2]
This allows accurate multi-timeframe visualization regardless of the chart timeframe.
13. Time-Based Drawing
The indicator draws using:
xloc.bar_time
instead of
bar_index
Advantages:
No 500-bar limitation
Accurate positioning across all timeframes
Boxes maintain correct alignment during zooming and scrolling
14. Legend Table
A built-in table appears in one corner of the chart.
It displays:
TF Color
1H ■
4H ■
1D ■
1W ■
1M ■
The table position is user-selectable:
Top Right
Top Left
Bottom Right
Bottom Left
Trading Interpretation
The indicator itself does not generate buy or sell signals. Instead, it provides a visual framework for understanding how price interacts with significant higher-timeframe ranges.
Common ways traders use these zones include:
Support
If price revisits the Low of a higher-timeframe square and buyers step in, the area may act as support.
Resistance
If price reaches the High of a higher-timeframe square and selling pressure appears, the area may function as resistance.
Equilibrium
The dotted midpoint often serves as a decision area where price may:
Reverse
Consolidate
Continue the prevailing trend
Many traders monitor this level as a balance point between buyers and sellers.
Liquidity
The extremes of each square (High and Low) frequently coincide with areas where liquidity accumulates. Price may revisit these levels to trigger resting orders before reversing or continuing.
Advantages
Multi-timeframe visualization in a single chart
Clean graphical representation of candle ranges
Automatic updates on new higher-timeframe candles
Customizable colors and appearance
Configurable box width and border thickness
Optional display of current and historical candles
Built-in legend for quick reference
Time-based drawing avoids future bar limitations
Typical Use Cases
This indicator is particularly useful for:
Price Action trading
Smart Money Concepts (SMC)
Institutional order flow analysis
Support and resistance mapping
Swing trading
Intraday trading
Scalping with higher-timeframe context
Multi-timeframe confluence analysis
Summary
Dr. Yousif's Squares transforms higher-timeframe candles into persistent price zones, allowing traders to view important market structure directly on lower-timeframe charts. Each square represents the full High-to-Low range of a candle, while the dotted midpoint highlights its equilibrium level. By combining multiple timeframes, customizable visuals, and automatic updates, the indicator provides a structured way to monitor key price zones where reactions, reversals, or continuations are more likely to occur. It is best used as a contextual analysis tool alongside price action, market structure, and risk management rather than as a standalone trading system.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.