Session P EdgesThis is an attempt to chart the primary balance ranges, however,
I have been having difficulty getting the lows to work in the graph, any assistance would be welcome
Pesquisar nos scripts por "session"
Balanced Delta Volume Profile (Zeiierman)█  Overview 
 Balanced Delta Volume Profile (Zeiierman)  builds a vertical, price-by-price profile that blends total participation with balance quality. Instead of plotting raw volume alone, it weights each price bin by: 
 
 how balanced buyers vs. sellers were, 
 how compressed price was inside that bin, 
 how often price revisited it. 
 
The result spotlights fair value and acceptance zones while still revealing momentum/imbalance areas—ideal for reading rotation vs. trend, continuation vs. exhaustion, and the prices that truly matter.
   
 Highlights 
 
 Balanced score that fuses delta symmetry, price compression, and hit frequency.
 Optional heat spectrum for instant read of participation density and balance strength.
 POC-like auto highlight of the dominant price level within the lookback window.
 Works across timeframes for session profiling, swing context, or regime shifts.
 
█  How It Works 
 ⚪ Profile Construction 
The script scans a fixed History Length and divides the full high–low span into Bin Count price bins. For every bar in the window, its volume is proportionally distributed across the bins it overlaps, so wide-range bars contribute across multiple bins, while narrow bars concentrate where they traded most. This yields per-bin totals for:
 
 Total Volume (participation)
 Positive / Negative Volume (up vs. down bar contribution)
 Hit Count (how often price touched the bin)
 Average Price Range (mean bar range inside the bin; a proxy for compression)
 
⚪ Delta & Direction 
For each bin, delta symmetry is measured via the ratio of |pos − neg| to total volume. Bins with balanced two-sided flow score higher than one-sided, runaway bins. This curbs the tendency of raw volume profiles to over-reward impulsive bursts.
⚪ Balance Score 
Each price bin gets a balance score that multiplies three normalized components:
 
 Delta Balance:   rewards bins where buy/sell pressure is symmetrical (configurable via Volume Momentum Weight).
 Price Compression:  rewards bins where average bar range is relatively small (configurable via Price Momentum Weight).
 Durability:  rewards bins revisited often (configurable via Hits Weight).
 
A Min Hits Filter removes flimsy, single-touch bins from dominating the score. The profile can display pure totals or Average Mode (Vol/Hit) to compare bins fairly when hit counts differ.
⚪ Display & Heat Spectrum 
The final plotted bar length per bin is the display volume (total or average) weighted by the balance score and normalized to 100.
 
 POC-like Highlight:  The 100% bin is outlined (and labeled) when Highlight Max Volume Bin is ON.
 Heat Spectrum (optional):  A background gradient scales with normalized bar length and balance hue.
 Balance Hue:  Interpolates between Balance Low/High Colors so high-balance bins visually pop as “accepted value.”
 
█  How to Use 
The profile is effectively a map of price acceptance:
 
 High, bright bars  = strong participation at balanced prices → fair value/rotation zones.
 Thin, muted bars  = poor acceptance → imbalance or transition areas.
 POC-style level  = most influential price in the lookback window.
 
⚪ Find Fair Value & Acceptance 
Thick, high-balance bins mark value. Expect rotation: price often revisits or oscillates around these areas. They’re prime zones for mean-reversion fades, scale-ins, and risk-defined trades against the edges.
  
⚪ Identify Imbalance & Funnels 
Low-balance, low-hit bins often act like air pockets—price can move through them quickly. These zones are helpful for continuation trades into thin areas or for timing breakout pulls back into acceptance.
  
 
⚪ POC Dynamics 
When price leaves the POC and returns, watch for re-acceptance (price comes back into the POC or high-balance zone and stays there.) vs. rejection (trend continuation away from value). The auto-highlight makes this quick to judge.
   
█  Settings 
 
 History Length –  Bars scanned for the profile. Longer = broader context, slower to adapt.
 Bin Count –  Vertical resolution of bins between the window’s min and max price.
 Display Shift –  Offsets the rendering rightward for clarity.
 Average Mode (Vol/Hit) –  ON uses average volume per visit; OFF uses total volume.
 Volume Momentum Weight –  Emphasizes two-way flow; higher values favor balanced bins over one-sided deltas.
 Price Momentum Weight –  Emphasizes compression; higher values favor narrow-range, coiling price action.
 Hits Weight –  Rewards bins revisited often; higher values favor durable acceptance.
 Min Hits Filter –  Minimum visits a bin needs to qualify for the balance score.
 Show Heat Spectrum –  Background gradient for quick read of density and balance.
 Highlight Max Volume Bin –  Outline + raw volume label for the dominant bin.
 Max Volume Color –  Color used for that highlight.
 Balance Low/High Colors –  Gradient endpoints for balance hue across the profile.
 
-----------------
Disclaimer
The content provided in my scripts, indicators, ideas, algorithms, and systems is for educational and informational purposes only. It does not constitute financial advice, investment recommendations, or a solicitation to buy or sell any financial instruments. I will not accept liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from the use of or reliance on such information.
All investments involve risk, and the past performance of a security, industry, sector, market, financial product, trading strategy, backtest, or individual's trading does not guarantee future results or returns. Investors are fully responsible for any investment decisions they make. Such decisions should be based solely on an evaluation of their financial circumstances, investment objectives, risk tolerance, and liquidity needs.
AMDX/XAMD indicatorThe AMDX/XAMD indicator is designed to highlight specific trading sessions on the chart using distinct colors and optional vertical lines. Users can choose between two session types, AMDX or XAMD, and customize the visual appearance of the sessions. This tool is particularly useful for traders who want to analyze market behavior during different trading periods.
Meaning of AMDX:
A: Accumulation
M: Manipulation
D: Distribution
X: Continuation Or Reversal
Features:
 
     Session Highlighting:
         AMDX Sessions: Split into four segments - A, M, D, X.
         XAMD Sessions: Split into four segments - X, A, M, D.
     Customizable Colors:
         Choose individual colors for each session (A, M, D, X).
         Adjust the transparency of the session boxes for better visual integration with the chart.
     Drawing Styles:
         Box Style: Draws colored boxes around the session ranges.
         Line Style: Draws vertical lines at session start and end times.
     Vertical Lines:
         Option to enable or disable vertical lines at session boundaries.
         Customizable line style: Solid, Dotted, or Dashed.
     Session Labels:
         Automatically labels each session for easy identification.
 
Customization Options:
 
 Session Type: Select between AMDX and XAMD session types.
     Colors: Set custom colors for each session and vertical lines.
     Border Width: Adjust the width of the session box borders.
     Transparency: Control the transparency level of the session boxes.
     Drawing Style: Choose between Box and Line styles for session representation.
     Vertical Lines: Enable or disable vertical lines and select the line style.
 
How It Works:
The indicator calculates the start and end times for each session based on the selected session type (AMDX or XAMD). It then draws either boxes or lines to highlight these sessions on the chart. The indicator also includes options to draw vertical lines at the session boundaries and labels each session with a corresponding letter (A, M, D, X).
Use Cases:
Market Session Analysis: Easily identify and analyze market behavior during different trading sessions.
Intraday Trading: Helps intraday traders to focus on specific time segments of the trading day.
 
Visual Segmentation: Provides a clear visual segmentation of the trading day, aiding in better decision-making.
Times for AMDX/XAMD session:
    A Session: 18:00 (previous day) to 03:00 (current day)
    M Session: 03:00 to 09:00
    D Session: 09:00 to 12:00
    X Session: 12:00 to 18:00
Time for the XAMD session :
    X Session: 18:00 (previous day) to 00:00 (current day)
    A Session: 00:00 to 09:00
    M Session: 09:00 to 12:00
    D Session: 12:00 to 18:00
Time Zone PSenseiTitle: Time Zone PS Indicator
Author: Orlando Depablos
Description:
The Time Zone PS Indicator is a tool designed to help traders visualize different trading sessions on their charts. It allows users to specify three different trading sessions: the start of the day, the London session, and the New York (NYC) session. Each session is represented by a distinct color-coded background on the chart.
Features:
Customizable Sessions: Traders can define the start time and end time for each trading session according to their preference. This flexibility enables users to tailor the indicator to their specific trading strategies session time zones.
Session Display Control: Users have the option to choose whether they want to display each trading session on the chart. This feature allows for a clutter-free charting experience, where traders can focus on the sessions relevant to their analysis.
Visual Clarity: The indicator uses distinct colors for each trading session, making it easy for traders to differentiate between different time zones. This visual clarity aids in quickly identifying key trading periods throughout the day.
How to Use:
Setting Up Sessions: Use the input options to define the start and end times for the start of the day, the London session, and the NYC session. Adjust these values based on your trading preferences and time zone.
Display Preferences: Toggle the display options to choose which trading sessions you want to visualize on the chart. This allows for a customizable charting experience tailored to your specific needs.
Interpreting the Chart: Once configured, the indicator will display color-coded backgrounds on the chart corresponding to the defined trading sessions. Interpret these visual cues to identify key trading periods and plan your trading strategies accordingly.
Originality:
The Time Zone PS Indicator adds value to the TradingView community by providing traders with a customizable tool to visualize different trading sessions. While similar indicators exist, this script offers flexibility and ease of use, enhancing the charting experience for traders across various time zones.
Use Cases:
Session-Based Analysis: Traders can use the indicator to analyze price action within specific trading sessions, such as the London or NYC session, to identify potential trading opportunities.
Time Zone Adjustment: Traders operating in different time zones can adjust the indicator settings to align with their local trading hours, ensuring accurate visualization of relevant trading sessions.
Strategy Development: The indicator can aid in the development of trading strategies that capitalize on price movements during specific trading sessions, helping traders optimize their trading performance.
Chart Visualization:
The indicator provides a clear and concise visualization of different trading sessions on the chart. Each session is represented by a color-coded background, allowing traders to quickly identify key trading periods and make informed trading decisions.
Volume Profile [Makit0]VOLUME PROFILE INDICATOR v0.5 beta
Volume Profile is suitable for day and swing trading on stock and futures markets, is a volume based indicator that gives you 6 key values for each session: POC, VAH, VAL, profile HIGH, LOW and MID levels. This project was born on the idea of plotting the RTH sessions Value Areas for /ES in an automated way, but you can select between 3 different sessions: RTH, GLOBEX and FULL sessions.
Some basic concepts:
- Volume Profile calculates the total volume for the session at each price level and give us market generated information about what price and range of prices are the most traded (where the value is)
- Value Area (VA): range of prices where 70% of the session volume is traded
- Value Area High (VAH): highest price within VA
- Value Area Low (VAL): lowest price within VA
- Point of Control (POC): the most traded price of the session (with the most volume)
- Session HIGH, LOW and MID levels are also important
There are a huge amount of things to know of Market Profile and Auction Theory like types of days, types of openings, relationships between value areas and openings... for those interested Jim Dalton's work is the way to come
I'm in my 2nd trading year and my goal for this year is learning to daytrade the futures markets thru the lens of Market Profile
For info on Volume Profile: TV Volume Profile wiki page at www.tradingview.com
For info on Market Profile and Market Auction Theory: Jim Dalton's book Mind over markets (this is a MUST)
BE AWARE: this indicator is based on the current chart's time interval and it only plots on 1, 2, 3, 5, 10, 15 and 30 minutes charts.
This is the correlation table TV uses in the Volume Profile Session Volume indicator (from the wiki above)
     Chart       Indicator
 1   -   5         1
 6   -   15       5
 16  -   30      10
 31  -   60      15
 61  -   120    30
 121 -   1D     60
This indicator doesn't follow that correlation, it doesn't get the volume data from a lower timeframe, it gets the data from the current chart resolution.
FEATURES
- 6 key values for each session: POC (solid yellow), VAH (solid red), VAL (solid green), profile HIGH (dashed silver), LOW (dashed silver) and MID (dotted silver) levels 
- 3 sessions to choose for: RTH, GLOBEX and FULL
- select the numbers of sessions to plot by adding 12 hours periods back in time
- show/hide POC
- show/hide VAH & VAL
- show/hide session HIGH, LOW & MID levels
- highlight the periods of time out of the session (silver)
- extend the plotted lines all the way to the right, be careful this can turn the chart unreadable if there are a lot of sessions and lines plotted
SETTINGS
- Session: select between RTH (8:30 to 15:15 CT), GLOBEX (17:00 to 8:30 CT) and FULL (17:00 to 15:15 CT) sessions. RTH by default
- Last 12 hour periods to show: select the deph of the study by adding periods, for example, 60 periods are 30 natural days and around 22 trading days. 1 period by default
- Show POC (Point of Control): show/hide POC line. true by default
- Show VA (Value Area High & Low): show/hide VAH & VAL lines. true by default
- Show Range (Session High, Low & Mid): show/hide session HIGH, LOW & MID lines. true by default
- Highlight out of session: show/hide a silver shadow over the non session periods. true by default
- Extension: Extend all the plotted lines to the right. false by default
HOW TO SETUP
BE AWARE THIS INDICATOR PLOTS ONLY IN THE FOLLOWING CHART RESOLUTIONS: 1, 2, 3, 5, 10, 15 AND 30 MINUTES CHARTS. YOU MUST SELECT ONE OF THIS RESOLUTIONS TO THE INDICATOR BE ABLE TO PLOT
- By default this indicator plots all the levels for the last RTH session within the last 12 hours, if there is no plot try to adjust the 12 hours periods until the seesion and the periods match
- For Globex/Full sessions just select what you want from the dropdown menu and adjust the periods to plot the values
- Show or hide the levels you want with the 3 groups: POC line, VA lines and Session Range lines
- The highlight and extension options are for a better visibility of the levels as POC or VAH/VAL
THANKS TO
@watsonexchange for all the help, ideas and insights on this and the last two indicators (Market Delta & Market Internals) I'm working on my way to a 'clean chart' but for me it's not an easy path
@PineCoders for all the amazing stuff they do and all the help and tools they provide, in special the Script-Stopwatch at  that was key in lowering this indicator's execution time 
All the TV and Pine community, open source and shared knowledge are indeed the best way to help each other
IF YOU REALLY LIKE THIS WORK, please send me a comment or a private message and TELL ME WHAT you trade, HOW you trade it and your FAVOURITE SETUP for pulling out money from the market in a consistent basis, I'm learning to trade (this is my 2nd year) and I need all the help I can get
GOOD LUCK AND HAPPY TRADING
ICT Opening Range Projections (tristanlee85)ICT Opening Range Projections 
This indicator visualizes key price levels based on ICT's (Inner Circle Trader) "Opening Range" concept. This 30-minute time interval establishes price levels that the algorithm will refer to throughout the session. The indicator displays these levels, including standard deviation projections, internal subdivisions (quadrants), and the opening price.
  
 🟪 What It Does 
The Opening Range is a crucial 30-minute window where market algorithms establish significant price levels. ICT theory suggests this range forms the basis for daily price movement.
This script helps you:
 
  Mark the  high, low, and opening price  of each session.
  Divide the range into  quadrants  (premium, discount, and midpoint/Consequent Encroachment).
  Project potential price targets beyond the range using  configurable standard deviation multiples .
 
 🟪 How to Use It 
This tool aids in time-based technical analysis rooted in ICT's Opening Range model, helping you observe price interaction with algorithmic levels.
Example uses include:
 
  Identifying early structural boundaries.
  Observing price behavior within premium/discount zones.
  Visualizing initial displacement from the range to anticipate future moves.
  Comparing price reactions at projected standard deviation levels.
  Aligning price action with significant times like London or NY Open.
 
 Note:  This indicator provides a visual framework; it does  not  offer trade signals or interpretations.
 🟪 Key Information 
 
   Time Zone:   New York time (ET)  is required on your chart.
   Sessions:  Supports multiple sessions, including NY midnight, NY AM, NY PM, and three custom timeframes.
   Time Interval:  Supports multi-timeframe up to 15 minutes. Best used on a  1-minute chart  for accuracy.
 
 🟪 Session Options 
The Opening Range interval is configurable for up to 6 sessions:
 Pre-defined ICT Sessions: 
 
   NY Midnight:  12:00 AM – 12:30 AM ET
   NY AM:  9:30 AM – 10:00 AM ET
   NY PM:  1:30 PM – 2:00 PM ET
 
 Custom Sessions: 
 
  Three user-defined start/end time pairs.
 
This example shows a custom session from 03:30 - 04:00:
  
 🟪 Understanding the Levels 
The  Opening Price  is the open of the first 1-minute candle within the chosen session.
At session close, the  Opening Range  is calculated using its  High  and  Low . An optional  swing-based mode  uses swing highs/lows for range boundaries.
The range is divided into  quadrants  by its midpoint ( Consequent Encroachment  or CE):
 
   Upper Quadrant:  CE to high (premium).
   Lower Quadrant:  Low to CE (discount).
 
These subdivisions help visualize internal range dynamics, where price often reacts during algorithmic delivery.
 🟪 Working with Ranges 
By default, the range is determined by the highest high and lowest low of the 30-minute session:
  
A range can also be determined by the highest/lowest swing points:
  
Quadrants outline the premium and discount of a range that price will reference:
  
Small ranges still follow the same algorithmic logic, but may be deemed insignificant for one's trading. These can be filtered in the settings by specifying a minimum ticks limit. In this example, the range is 42 ticks (10.5 points) but the indicator is configured for 80 ticks (20 points). We can select which levels will plot if the range is below the limit. Here, only the 00:00 opening price is plotted:
  
You may opt to include the range high/low, quadrants, and projections as well. This will plot a red (configurable) range bracket to indicate it is below the limit while plotting the levels:
  
 🟪 Price Projections 
 Projections  extend beyond the Opening Range using standard deviations, framing the market beyond the initial session and identifying potential targets. You define the standard deviation multiples (e.g., 1.0, 1.5, 2.0).
Both  positive and negative extensions  are displayed, symmetrically projected from the range's high and low.
The  Dynamic Levels  option plots only the next projection level once price crosses the previous extreme. For example, only the 0.5 STDEV level plots until price reaches it, then the 1.0 level appears, and so on. This continues up to your defined maximum projections, or indefinitely if standard deviations are set to 0.
This example shows dynamic levels for a total of 6 sessions, only 1 of which meet a configured minimum limit of 50 ticks:
  
Small ranges followed by significant displacement are impacted the most with the number of levels plotted. You may hide projections when configuring the minimum ticks.
A fixed standard deviation will plot levels in both directions, regardless of the price range. Here, we plot up to 3.0 which hiding projections for small ranges:
  
 🟪 Legal Disclaimer 
This indicator is provided for informational and educational purposes only. It is not financial advice, and should not be construed as a recommendation to buy or sell any financial instrument. Trading involves substantial risk, and you could lose a significant amount of money. Past performance is not indicative of future results. Always consult with a qualified financial professional before making any trading or investment decisions. The creators and distributors of this indicator assume no responsibility for your trading outcomes.
Custom V2 KillZone US / FVG / EMAThis indicator is designed for traders looking to analyze liquidity levels, opportunity zones, and the underlying trend across different trading sessions. Inspired by the ICT methodology, this tool combines analysis of Exponential Moving Averages (EMA), session management, and Fair Value Gap (FVG) detection to provide a structured and disciplined approach to trading effectively.
Indicator Features
Identifying the Underlying Trend with Two EMAs
The indicator uses two EMAs on different, customizable timeframes to define the underlying trend:
EMA1 (default set to a daily timeframe): Represents the primary underlying trend.
EMA2 (default set to a 4-hour timeframe): Helps identify secondary corrections or impulses within the main trend.
These two EMAs allow traders to stay aligned with the market trend by prioritizing trades in the direction of the moving averages. For example, if prices are above both EMAs, the trend is bullish, and long trades are favored.
Analysis of Market Sessions
The indicator divides the day into key trading sessions:
Asian Session
London Session
US Pre-Open Session
Liquidity Kill Session
US Kill Zone Session
Each session is represented by high and low zones as well as mid-lines, allowing traders to visualize liquidity levels reached during these periods. Tracking the price levels in different sessions helps determine whether liquidity levels have been "swept" (taken) or not, which is essential for ICT methodology.
Liquidity Signal ("OK" or "STOP")
A specific signal appears at the end of the "Liquidity Kill" session (just before the "US Kill Zone" session):
"OK" Signal: Indicates that liquidity conditions are favorable for trading the "US Kill Zone" session. This means that liquidity levels have been swept in previous sessions (Asian, London, US Pre-Open), and the market is ready for an opportunity.
"STOP" Signal: Indicates that it is not favorable to trade the "US Kill Zone" session, as certain liquidity conditions have not been met.
The "OK" or "STOP" signal is based on an analysis of the high and low levels from previous sessions, allowing traders to ensure that significant liquidity zones have been reached before considering positions in the "Kill Zone".
Detection of Fair Value Gaps (FVG) in the US Kill Zone Session
When an "OK" signal is displayed, the indicator identifies Fair Value Gaps (FVG) during the "US Kill Zone" session. These FVGs are areas where price may return to fill an "imbalance" in the market, making them potential entry points.
Bullish FVG: Detected when there is a bullish imbalance, providing a buying opportunity if conditions align with the underlying trend.
Bearish FVG: Detected when there is a bearish imbalance, providing a selling opportunity in the trend direction.
FVG detection aligns with the ICT Silver Bullet methodology, where these imbalance zones serve as probable entry points during the "US Kill Zone".
How to Use This Indicator
Check the Underlying Trend
Before trading, observe the two EMAs (daily and 4-hour) to understand the general market trend. Trades will be prioritized in the direction indicated by these EMAs.
Monitor Liquidity Signals After the Asian, London, and US Pre-Open Sessions
The high and low levels of each session help determine if liquidity has already been swept in these areas. At the end of the "Liquidity Kill" session, an "OK" or "STOP" label will appear:
"OK" means you can look for trading opportunities in the "US Kill Zone" session.
"STOP" means it is preferable not to take trades in the "US Kill Zone" session.
Look for Opportunities in the US Kill Zone if the Signal is "OK"
When the "OK" label is present, focus on the "US Kill Zone" session. Use the Fair Value Gaps (FVG) as potential entry points for trades based on the ICT methodology. The identified FVGs will appear as colored boxes (bullish or bearish) during this session.
Use ICT Methodology to Manage Your Trades
Follow the FVGs as potential reversal zones in the direction of the trend, and manage your positions according to your personal strategy and the rules of the ICT Silver Bullet method.
Customizable Settings
The indicator includes several customization options to suit the trader's preferences:
EMA: Length, source (close, open, etc.), and timeframe.
Market Sessions: Ability to enable or disable each session, with color and line width settings.
Liquidity Signals: Customization of colors for the "OK" and "STOP" labels.
FVG: Option to display FVGs or not, with customizable colors for bullish and bearish FVGs, and the number of bars for FVG extension.
-------------------------------------------------------------------------------------------------------------
Cet indicateur est conçu pour les traders souhaitant analyser les niveaux de liquidité, les zones d’opportunité, et la tendance de fond à travers différentes sessions de trading. Inspiré de la méthodologie ICT, cet outil combine l'analyse des moyennes mobiles exponentielles (EMA), la gestion des sessions de marché, et la détection des Fair Value Gaps (FVG), afin de fournir une approche structurée et disciplinée pour trader efficacement.
Opening Range Breakout with Multi-Timeframe Liquidity]═══════════════════════════════════════
 OPENING RANGE BREAKOUT WITH MULTI-TIMEFRAME LIQUIDITY 
═══════════════════════════════════════
A professional Opening Range Breakout (ORB) indicator enhanced with multi-timeframe liquidity detection, trading session visualization, volume analysis, and trend confirmation tools. Designed for intraday trading with comprehensive alert system.
───────────────────────────────────────
 WHAT THIS INDICATOR DOES 
───────────────────────────────────────
This indicator combines multiple trading concepts:
- Opening Range Breakout (ORB) - Customizable time period detection with automatic high/low identification
- Multi-Timeframe Liquidity - HTF (Higher Timeframe) and LTF (Lower Timeframe) key level detection
- Trading Sessions - Tokyo, London, New York, and Sydney session visualization
- Volume Analysis - Volume spike detection and strength measurement
- Multi-Timeframe Confirmation - Trend bias from higher timeframes
- EMA Integration - Trend filter and dynamic support/resistance
- Smart Alerts - Quality-filtered breakout notifications
───────────────────────────────────────
 HOW IT WORKS 
───────────────────────────────────────
 OPENING RANGE BREAKOUT (ORB): 
Concept:
The Opening Range is a period at the start of a trading session where price establishes an initial high and low. Breakouts beyond this range often indicate the direction of the day's trend.
Detection Method:
- Default: 15-minute opening range (configurable)
- Custom Range: Set specific session times with timezone support
- Automatically identifies ORH (Opening Range High) and ORL (Opening Range Low)
- Tracks ORB mid-point for reference
Range Establishment:
1. Session starts (or custom time begins)
2. Tracks highest high and lowest low during the period
3. Range confirmed at end of opening period
4. Levels extend throughout the session
Breakout Detection:
- Bullish Breakout: Close above ORH
- Bearish Breakout: Close below ORL
- Mid-point acts as bias indicator
Visual Display:
- Shaded box during range formation
- Horizontal lines for ORH, ORL, and mid-point
- Labels showing level values
- Color-coded fills based on selected method
Fill Color Methods:
1. Session Comparison:
   - Green: Current OR mid > Previous OR mid
   - Red: Current OR mid < Previous OR mid
   - Gray: Equal or first session
   - Shows day-over-day momentum
2. Breakout Direction (Recommended):
   - Green: Price currently above ORH (bullish breakout)
   - Red: Price currently below ORL (bearish breakout)
   - Gray: Price inside range (no breakout)
   - Real-time breakout status
MULTI-TIMEFRAME LIQUIDITY:
Two-Tier System for comprehensive level identification:
HTF (Higher Timeframe) Key Liquidity:
- Default: 4H timeframe (configurable to Daily, Weekly)
- Identifies major institutional levels
- Uses pivot detection with adjustable parameters
- Suitable for swing highs/lows where large orders rest
LTF (Lower Timeframe) Key Liquidity:
- Default: 1H timeframe (configurable)
- Provides precision entry/exit levels
- Finer granularity for intraday trading
- Captures minor swing points
Calculation Method:
- Pivot high/low detection algorithm
- Configurable left bars (lookback) and right bars (confirmation)
- Timeframe multiplier for accurate multi-timeframe detection
- Automatic level extension
Mitigation System:
- Tracks when levels are swept (broken)
- Configurable mitigation type: Wick or Close-based
- Option to remove or show mitigated levels
- Display limit prevents chart clutter
Asset-Specific Optimization:
The indicator includes quick reference settings for different assets:
- Major Forex (EUR/USD, GBP/USD): Default settings optimal
- Crypto (BTC/ETH): Left=12, Right=4, Display=7
- Gold: HTF=1D, Left=20
 TRADING SESSIONS: 
Four Major Sessions with Full Customization:
Tokyo Session:
- Default: 04:00-13:00 UTC+4
- Asian trading hours
- Often sets daily range
London Session:
- Default: 11:00-20:00 UTC+4
- Highest liquidity period
- Major institutional activity
New York Session:
- Default: 16:00-01:00 UTC+4
- US market hours
- High-impact news events
Sydney Session:
- Default: 01:00-10:00 UTC+4
- Earliest Asian activity
- Lower volatility
Session Features:
- Shaded background boxes
- Session name labels
- Optional open/close lines
- Session high/low tracking with colored lines
- Each session has independent color settings
- Fully customizable times and timezones
VOLUME ANALYSIS:
Volume-Based Trade Confirmation:
Volume MA:
- Configurable period (default: 20)
- Establishes average volume baseline
- Used for spike detection
Volume Spike Detection:
- Identifies when volume exceeds MA * multiplier
- Default: 1.5x average volume
- Confirms breakout strength
Volume Strength Measurement:
- Calculates current volume as percentage of average
- Shows relative volume intensity
- Used in alert quality filtering
High Volume Bars:
- Identifies bars above 50th percentile
- Additional confirmation layer
- Indicates institutional participation
MULTI-TIMEFRAME CONFIRMATION:
Trend Bias from Higher Timeframes:
HTF 1 (Trend):
- Default: 1H timeframe
- Uses EMA to determine intermediate trend
- Compares current timeframe EMA to HTF EMA
HTF 2 (Bias):
- Default: 4H timeframe
- Uses 50 EMA for longer-term bias
- Confirms overall market direction
Bias Classifications:
- Bullish Bias: HTF close > HTF 50 EMA AND Current EMA > HTF1 EMA
- Bearish Bias: HTF close < HTF 50 EMA AND Current EMA < HTF1 EMA
- Neutral Bias: Mixed signals between timeframes
EMA Stack Analysis:
- Compares EMA alignment across timeframes
- +1: Bullish stack (lower TF EMA > higher TF EMA)
- -1: Bearish stack (lower TF EMA < higher TF EMA)
- 0: Neutral/crossed
Usage:
- Filters false breakouts
- Confirms trend direction
- Improves trade quality
 EMA INTEGRATION: 
Dynamic EMA for Trend Reference:
Features:
- Configurable period (default: 20)
- Customizable color and width
- Acts as dynamic support/resistance
- Trend filter for ORB trades
Application:
- Above EMA: Favor long breakouts
- Below EMA: Favor short breakouts
- EMA cross: Potential trend change
- Distance from EMA: Momentum gauge
SMART ALERT SYSTEM:
Quality-Filtered Breakout Notifications:
Alert Types:
1. Standard ORB Breakout
2. High Quality ORB Breakout
Quality Criteria:
- Volume Confirmation: Volume > 1.2x average
- MTF Confirmation: Bias aligned with breakout direction
Standard Alert:
- Basic breakout detection
- Price crosses ORH or ORL
- Icon: 🚀 (bullish) or 🔻 (bearish)
High Quality Alert:
- Both volume AND MTF confirmed
- Stronger probability setup
- Icon: 🚀⭐ (bullish) or 🔻⭐ (bearish)
Alert Information Includes:
- Alert quality rating
- Breakout level and current price
- Volume strength percentage (if enabled)
- MTF bias status (if enabled)
- Recommended action
One Alert Per Bar:
- Prevents alert spam
- Uses flag system to track sent alerts
- Resets on new ORB session
───────────────────────────────────────
 HOW TO USE 
───────────────────────────────────────
 OPENING RANGE SETUP: 
Basic Configuration:
1. Select time period for opening range (default: 15 minutes)
2. Choose fill color method (Breakout Direction recommended)
3. Enable historical data display if needed
Custom Range (Advanced):
1. Enable Custom Range toggle
2. Set specific session time (e.g., 0930-0945)
3. Select appropriate timezone
4. Useful for specific market opens (NYSE, LSE, etc.)
 LIQUIDITY LEVELS SETUP: 
Quick Configuration by Asset:
- Forex: Use default settings (Left=15, Right=5)
- Crypto: Set Left=12, Right=4, Display=7
- Gold: Set HTF=1D, Left=20
HTF Liquidity:
- Purpose: Major support/resistance levels
- Recommended: 4H for day trading, 1D for swing trading
- Use as profit targets or reversal zones
LTF Liquidity:
- Purpose: Entry/exit refinement
- Recommended: 1H for day trading, 4H for swing trading
- Use for position management
Mitigation Settings:
- Wick-based: More sensitive (default)
- Close-based: More conservative
- Remove or Show mitigated levels based on preference
TRADING SESSIONS SETUP:
Enable/Disable Sessions:
- Master toggle for all sessions
- Individual session controls
- Show/hide session names
Session High/Low Lines:
- Enable to see session extremes
- Each session has custom colors
- Useful for range trading
Customization:
- Adjust session times for your broker
- Set timezone to match your location
- Customize colors for visibility
 VOLUME ANALYSIS SETUP: 
Enable Volume Analysis:
1. Toggle on Volume Analysis
2. Set MA length (20 recommended)
3. Adjust spike multiplier (1.5 typical)
Usage:
- Confirm breakouts with volume
- Identify climactic moves
- Filter false signals
MULTI-TIMEFRAME SETUP:
HTF Selection:
- HTF 1 (Trend): 1H for day trading, 4H for swing
- HTF 2 (Bias): 4H for day trading, 1D for swing
Interpretation:
- Trade only with bias alignment
- Neutral bias: Be cautious
- Bias changes: Potential reversals
EMA SETUP:
Configuration:
- Period: 20 for responsive, 50 for smoother
- Color: Choose contrasting color
- Width: 1-2 for visibility
Usage:
- Filter trades: Long above, Short below
- Dynamic support/resistance reference
- Trend confirmation
ALERT SETUP:
TradingView Alert Creation:
1. Enable alerts in indicator settings
2. Enable ORB Breakout Alerts
3. Right-click chart → Add Alert
4. Select this indicator
5. Choose "Any alert() function call"
6. Configure delivery method (mobile, email, webhook)
Alert Filtering:
- All alerts include quality rating
- High Quality alerts = Volume + MTF confirmed
- Standard alerts = Basic breakout only
───────────────────────────────────────
 TRADING STRATEGIES 
───────────────────────────────────────
CLASSIC ORB STRATEGY:
Setup:
1. Wait for opening range to complete
2. Price breaks and closes above ORH or below ORL
3. Volume > average (if enabled)
4. MTF bias aligned (if enabled)
Entry:
- Bullish: Buy on break above ORH
- Bearish: Sell on break below ORL
- Consider retest entries for better risk/reward
Stop Loss:
- Bullish: Below ORL or range mid-point
- Bearish: Above ORH or range mid-point
- Adjust based on volatility
Targets:
- Initial: Range width extension (ORH + range width)
- Secondary: HTF liquidity levels
- Final: Session high/low or major support/resistance
ORB + LIQUIDITY CONFLUENCE:
Enhanced Setup:
1. Opening range established
2. HTF liquidity level near or beyond ORH/ORL
3. Breakout occurs with volume
4. Price targets the liquidity level
Entry:
- Enter on ORB breakout
- Target the HTF liquidity level
- Use LTF liquidity for position management
Management:
- Partial profits at ORB + range width
- Move stop to breakeven at LTF liquidity
- Final exit at HTF liquidity sweep
ORB REJECTION STRATEGY (Counter-Trend):
Setup:
1. Price breaks above ORH or below ORL
2. Weak volume (below average)
3. MTF bias opposite to breakout
4. Price closes back inside range
Entry:
- Failed bullish break: Short below ORH
- Failed bearish break: Long above ORL
Stop Loss:
- Beyond the failed breakout level
- Or beyond session extreme
Target:
- Opposite end of opening range
- Range mid-point for partial profit
SESSION-BASED ORB TRADING:
Tokyo Session:
- Typically narrower ranges
- Good for range trading
- Wait for London open breakout
London Session:
- Highest volume and volatility
- Strong ORB setups
- Major liquidity sweeps common
New York Session:
- Strong trending moves
- News-driven volatility
- Good for momentum trades
Sydney Session:
- Quieter conditions
- Suitable for range strategies
- Sets up Tokyo session
EMA-FILTERED ORB:
Rules:
- Only take bullish breaks if price > EMA
- Only take bearish breaks if price < EMA
- Ignore counter-trend breaks
Benefits:
- Reduces false signals
- Aligns with larger trend
- Improves win rate
───────────────────────────────────────
CONFIGURATION GUIDE
───────────────────────────────────────
OPENING RANGE SETTINGS:
Time Period:
- 15 min: Standard for most markets
- 30 min: Wider range, fewer breakouts
- 60 min: For slower markets or swing trades
Custom Range:
- Use for specific market opens
- NYSE: 0930-1000 EST
- LSE: 0800-0830 GMT
- Set timezone to match exchange
Historical Display:
- Enable: See all previous session data
- Disable: Cleaner chart, current session only
LIQUIDITY SETTINGS:
Left Bars (5-30):
- Lower: More frequent, sensitive levels
- Higher: Fewer, more significant levels
- Recommended: 15 for most markets
Right Bars (1-25):
- Confirmation period
- Higher: More reliable, less frequent
- Recommended: 5 for balance
Display Limit (1-20):
- Number of active levels shown
- Higher: More context, busier chart
- Recommended: 7 for clarity
Extension Options:
- Short: Levels visible near formation
- Current: Extended to current bar (recommended)
- Max: Extended indefinitely
VOLUME SETTINGS:
MA Length (5-50):
- Shorter: More responsive to spikes
- Longer: Smoother baseline
- Recommended: 20 for balance
Spike Multiplier (1.0-3.0):
- Lower: More sensitive spike detection
- Higher: Only extreme spikes
- Recommended: 1.5 for day trading
MULTI-TIMEFRAME SETTINGS:
HTF 1 (Trend):
- 5m chart: Use 15m or 1H
- 15m chart: Use 1H or 4H
- 1H chart: Use 4H or 1D
HTF 2 (Bias):
- One level higher than HTF 1
- Provides longer-term context
- Don't use same as HTF 1
EMA SETTINGS:
Length:
- 20: Responsive, more signals
- 50: Smoother, stronger filter
- 200: Long-term trend only
Style:
- Choose contrasting color
- Width 1-2 for visibility
- Match your trading style
───────────────────────────────────────
BEST PRACTICES
───────────────────────────────────────
Chart Timeframe Selection:
- ORB Trading: Use 5m or 15m charts
- Session Review: Use 1H or 4H charts
- Swing Trading: Use 1H or 4H charts
Quality Over Quantity:
- Wait for high-quality alerts (volume + MTF)
- Avoid trading every breakout
- Focus on confluence setups
Risk Management:
- Position size based on range width
- Wider ranges = smaller positions
- Use stop losses always
- Take partial profits at targets
Market Conditions:
- Best results in trending markets
- Reduce position size in choppy conditions
- Consider session overlaps for volatility
- Avoid trading near major news if inexperienced
Continuous Improvement:
- Track win rate by session
- Note which confluence factors work best
- Adjust settings based on market volatility
- Review performance weekly
───────────────────────────────────────
PERFORMANCE OPTIMIZATION
───────────────────────────────────────
This indicator is optimized with:
- max_bars_back declarations for efficient processing
- Conditional calculations based on enabled features
- Proper memory management for drawing objects
- Minimal recalculation on each bar
Best Practices:
- Disable unused features (sessions, MTF, volume)
- Limit historical display to reduce rendering
- Use appropriate timeframe for your strategy
- Clear old drawing objects periodically
───────────────────────────────────────
EDUCATIONAL DISCLAIMER
───────────────────────────────────────
This indicator combines established trading concepts:
- Opening Range Breakout theory (price action)
- Liquidity level detection (pivot analysis)
- Session-based trading (time-of-day patterns)
- Volume analysis (confirmation technique)
- Multi-timeframe analysis (trend alignment)
All calculations use standard technical analysis methods:
- Pivot high/low detection algorithms
- Moving averages for trend and volume
- Session time filtering
- Timeframe security functions
The indicator identifies potential trading setups but does not predict future price movements. Success requires proper application within a complete trading strategy including risk management, position sizing, and market context.
───────────────────────────────────────
USAGE DISCLAIMER
───────────────────────────────────────
This tool is for educational and analytical purposes. Opening Range Breakout trading involves substantial risk. The alert system and quality filters are designed to identify potential setups but do not guarantee profitability. Always conduct independent analysis, use proper risk management, and never risk capital you cannot afford to lose. Past performance does not indicate future results. Trading intraday breakouts requires experience and discipline.
───────────────────────────────────────
CREDITS & ATTRIBUTION
───────────────────────────────────────
ORIGINAL SOURCE:
This indicator builds upon concepts from LuxAlgo's-ORB
CANDLE RANGE THEORY (H1 Only)Hello traders.
This indicator identifies CRT candles
-Each candle is a range.
-Each candle has its own po3.
-Focus on specific times of the day. By recognizing the importance of time and price, we can capture high-quality trades. Together with HTF PD array, Look for 4-hour candles forming at specific times of the day. (1am - 5am - 9am EST)
-After the 1st candle, wait for the 2nd candle to clear the high/low of the 1st candle and then close inside the 1st candle range at a specific time (1-5-9) and look for entries in the LTF
  
Why choose 1 5 9 hours EST?
### **1. 1:00 AM (EST)**
- **Trading Session:** This is the time between the Tokyo (Asian) session and the Sydney (Australian) session. The Asian market is very active.
- **Characteristics:**
- Liquidity: Moderate, as only the Asian market is active.
- Volatility: Pairs involving JPY (Japanese Yen), AUD (Australian Dollar), and NZD (New Zealand Dollar) tend to have higher volatility.
- Trading Opportunities: Suitable for traders who like to trade trends or news in the Asian region.
- **Note:** Volatility may be lower than the London or New York session.
### **2. 5:00 AM (EST)**
- **Trading Session:** This is the time near the end of the Tokyo session and the London (European) session is about to open.
- **Characteristics:**
- Liquidity: Starts to increase due to the preparation of the European market.
- Volatility: This is the time between two trading sessions, there can be strong fluctuations, especially in major currency pairs such as EUR/USD, GBP/USD.
- Trading opportunities: Suitable for breakout trading strategies when liquidity increases.
- **Note:** The overlap between Tokyo and London can cause sudden fluctuations.
### **3. 9:00 AM (EST)**
- **Trading sessions:** This time is within the London session and near the beginning of the New York session.
- **Characteristics:**
- Liquidity: Very high, as this is the period between the two largest sessions – London and New York.
- Volatility: Extremely strong, especially for major currency pairs such as EUR/USD, GBP/USD, USD/JPY.
- Trading opportunities: Suitable for both news trading and trend trading, as this is the time when a lot of economic data is released (usually from the US or the European region).
- **Note:** High volatility can bring big profits, but also comes with high risks.
### **Summary of effects:**
- **1 AM (EST):** Moderate volatility, focusing on Asian currency pairs.
- **5 AM (EST):** Increased liquidity and volatility, suitable for breakout trading.
- **9 AM (EST):** High volatility and high liquidity, the best time for Forex trading.
==> How to trade, when the high/low of CRT is swept, move to LTF to wait for confirmation to enter the order
  
  
  
  
Only sell at high level and buy at discount price.
Find CE at specific important time. Trading CRT with HTF direction has better win rate.
The more inside bars, the higher the probability.
Place a partial and Move breakeven at 50% range.
Do a backtest and post your chart.
High Low Levels by JZCustom High Low Levels Indicator - features
Clearly plotted high and low levels for specific trading sessions. This indicator provides visual representations of key price levels during various trading periods. Below are the main features and benefits of this indicator:
1. Display high and low levels for each session
- previous day high/low: display the high and low from the previous day, giving you a better understanding of how the price moves compared to the prior day.
- asia, london, and custom sessions: track the high and low levels for the major trading sessions (asian and london) and two custom user-defined sessions.
2. Complete line and label customization
- custom line appearance: choose the color, line style (solid, dashed, dotted), and line thickness for each trading session. you can also decide if the lines should extend beyond the current price action.
- custom labels: define your own label texts for each custom session. this way, you can label the levels precisely and easily track price movements.
3. Define your own trading sessions
- add up to two custom sessions (custom and custom 2), which can be defined using precise start and end times (hour and minute).
- each custom session allows you to specify the label text for the high and low levels, enabling you to easily differentiate different parts of the day on the chart.
4. Clear and intuitive design
- grouped settings: all settings are grouped based on trading sessions, so you can easily customize every aspect of the visual representation.
- simple toggle on/off: you can easily enable or disable each line (previous day, asia, london, custom 1, custom 2). this allows you to keep your chart clean and focus only on the important levels you need at any moment.
5. Flexible time zones
- time zone settings: set the time zone (utc, europe/london, america/new_york, asia/tokyo) to properly align the timeframes for each level depending on the market you're focusing on.
6. Automatic cleanup of old lines and labels
- old levels removal: automatically remove old lines and labels to prevent clutter on your chart. this ensures that only current, relevant levels for each trading day or session are displayed.
7. Precise plotting and line extension
- accurate level markings: the indicator calculates the precise times when the high and low levels were reached and plots lines that visually represent these levels.
- line extension options: you have the option to extend the high/low lines beyond their point of calculation, which helps with identifying price action trends beyond the current period.
Dec 7, 2024
Release Notes
Changes and Improvements for Users:
1. Customizable Offset for Lines and Labels:
- A new input, `Line and Label Offset`, allows users to control how far the lines and their associated text labels extend. This ensures the labels and lines remain aligned and can be adjusted as needed.
2. Unified Offset Control:
- The same offset value is applied to all types of lines and labels (e.g., Previous Day High/Low, Asia High/Low, London High/Low, and custom sessions). Users can change this in one place to affect the entire script consistently.
3. Enhanced Flexibility:
- Users now have more control over the appearance and position of their lines and labels, making the indicator adaptable to different chart setups and personal preferences.
These updates aim to enhance user convenience and customization, ensuring a more tailored charting experience.
Monday range by MatboomThe "Monday Range" Pine Script indicator calculates and displays the lowest and highest prices during a specified trading session, focusing on Mondays. Users can configure the trading session parameters, such as start and end times and time zone. The indicator visually highlights the session range on the chart by plotting the session low and high prices and applying a background color within the session period. The customizable days of the week checkboxes allow users to choose which days the indicator should consider for analysis.
 Session Configuration: 
session  = input.session("0000-0000", title="Trading Session")
timeZone = input.string("UTC", title="Time Zone")
monSession = input.bool(true, title="Mon ", group="Trading Session", inline="d1")
tueSession = input.bool(true, title="Tue ", group="Trading Session", inline="d1")
 Users can configure the trading session start and end times and the time zone.
Checkboxes for Monday (monSession) and Tuesday (tueSession) sessions are provided. 
 SessionLow and SessionHigh Functions: 
SessionLow(sessionTime, sessionTimeZone=syminfo.timezone) => ...
SessionHigh(sessionTime, sessionTimeZone=syminfo.timezone) => ...
 Custom functions to calculate the lowest (SessionLow) and highest (SessionHigh) prices during a specified trading session. 
 InSession Function: 
InSession(sessionTimes, sessionTimeZone=syminfo.timezone) => ...
 Determines if the current bar is inside the specified trading session. 
 Days of Week String and Session String: 
sessionDays = ""
if monSession
    sessionDays += "2"
if tueSession
    sessionDays += "3"
tradingSession = session + ":" + sessionDays
 Constructs a string representing the selected days of the week for the session. 
 Fetch Session Low and High: 
sessLow = SessionLow(tradingSession, timeZone)
sessHigh = SessionHigh(tradingSession, timeZone)
 Calls the custom functions to obtain the session low and high prices. 
 Plot Session Low and High and Background Color for Session 
plot(sessLow, color=color.red, title="Session Low")
plot(sessHigh, color=color.red, title="Session Low")
bgcolor(InSession(tradingSession, timeZone) ? color.new(color.aqua, 90) : na)
skThis Pine Script is an indicator designed to mark and highlight specific trading sessions on a TradingView chart. Here's a description of the script's functionality:
1. *Session Selection*: The script allows you to select a session time frame using the `session_input` input. The available options for session time frames are "D" (daily), "W" (weekly), "M" (monthly), "H" (hourly), "15" (15 minutes), "5" (5 minutes), and "1" (1 minute).
2. *Session Times*: You can specify the start and end times for three different trading sessions - CBDR (Central Bank Dealer Range), Asia, and London - using the corresponding input options. These times are specified in Indian Standard Time (IST).
3. *Time Calculation*: The script calculates the start and end times for each session based on the specified hours and minutes. It uses the `timestamp` function to create time objects for these sessions.
4. *Session Highlighting*: The script creates rectangles on the chart to highlight each session:
   - CBDR Session: A gray rectangle is drawn during the CBDR session time.
   - Asia Session: Another gray rectangle is drawn during the Asia session time.
   - London Session: A green rectangle is drawn at the top of the chart during the London session time.
5. *Transparency*: The rectangles have a transparency level of 90%, allowing you to see the price data beneath them while still marking the sessions.
6. *Overlay*: The indicator is set to overlay on the price chart, so it doesn't obstruct the price data.
7. *Customization*: You can customize the session times and appearance by adjusting the input values in the settings panel of the indicator.
Overall, this script provides a visual way to identify and highlight specific trading sessions on your TradingView chart, helping traders understand price action in different market sessions.
Time of Day Background with Bar Count & TableDescription: 
This indicator provides a comprehensive overview of market activity by dynamically displaying the time-of-day background and tracking bullish and bearish bar counts across different sessions. It also features a table summarizing the market performance for the last 7 days, segmented into four time-based sessions: Morning, Afternoon, Evening, and Night.
 Key Features: 
 
Time of Day Background:
 
The chart's background color changes based on the time of day:
Evening (12 AM - 6 AM) is shaded blue.
Morning (6 AM - 12 PM) is shaded aqua.
Afternoon (12 PM - 6 PM) is shaded yellow.
Night (6 PM - 12 AM) is shaded silver.
 
Bullish and Bearish Bar Counting:
 
It tracks the number of bullish (closing higher than opening) and bearish (closing lower than opening) candles.
The sum of the price differences (bullish minus bearish) for each session is displayed as a dynamic label, indicating overall market direction for each session.
Session Breakdown:
The chart is divided into four sessions, each lasting 6 hours (Morning, Afternoon, Evening, Night).
A new label is generated at the start of each session, indicating the bullish/bearish performance and the net difference in price movements for that session.
Historical Session Performance:
The indicator tracks and stores the performance for each session over the past 7 days.
A table is generated in the top-right corner of the chart, summarizing the performance for each session (Morning, Afternoon, Evening, Night) and the price changes for each of the past 7 days.
The values are color-coded to indicate positive (green) or negative (red) results.
Dynamic Table:
The table presents performance data for each time session over the past week with color-coded cells:
Green cells indicate positive performance.
Red cells indicate negative performance.
Empty cells represent no data for that session.
 Use Case: 
This indicator is useful for traders who want to track market activity and performance across different times of day and monitor how each session contributes to the overall market trend. It provides both visual insights (through background color) and numerical data (via the table) for better decision-making.
 Settings: 
The background color and session labels update automatically based on the time of day.
The table updates every day, tracking the performance of each session over the past week.
Trading IQ - ICT LibraryLibrary   "ICTlibrary" 
Used to calculate various ICT related price levels and strategies. An ongoing project.
Hello Coders!
This library is meant for sourcing ICT related concepts. While some functions might generate more output than you require, you can specify "Lite Mode" as "true" in applicable functions to slim down necessary inputs.
 isLastBar(userTF) 
  Identifies the last bar on the chart before a timeframe change
  Parameters:
     userTF (simple int) : the timeframe you wish to calculate the last bar for, must be converted to integer using 'timeframe.in_seconds()'
  Returns: bool true if bar on chart is last bar of higher TF, dalse if bar on chart is not last bar of higher TF
 necessaryData(atrTF) 
  returns necessaryData UDT for historical data access
  Parameters:
     atrTF (float) : user-selected timeframe ATR value.
  Returns: logZ. log return Z score, used for calculating order blocks.
 method gradBoxes(gradientBoxes, idColor, timeStart, bottom, top, rightCoordinate) 
  creates neon like effect for box drawings
  Namespace types: array
  Parameters:
     gradientBoxes (array) : an array.new() to store the gradient boxes
     idColor (color) 
     timeStart (int) : left point of box
     bottom (float) : bottom of box price point
     top (float) : top of box price point
     rightCoordinate (int) : right point of box
  Returns: void
 checkIfTraded(tradeName) 
  checks if recent trade is of specific name
  Parameters:
     tradeName (string) 
  Returns: bool true if recent trade id matches target name, false otherwise
 checkIfClosed(tradeName) 
  checks if recent closed trade is of specific name
  Parameters:
     tradeName (string) 
  Returns: bool true if recent closed trade id matches target name, false otherwise
 IQZZ(atrMult, finalTF) 
  custom ZZ to quickly determine market direction.
  Parameters:
     atrMult (float) : an atr multiplier used to determine the required price move for a ZZ direction change
     finalTF (string) : the timeframe used for the atr calcuation
  Returns: dir market direction. Up => 1, down => -1
 method drawBos(id, startPoint, getKeyPointTime, getKeyPointPrice, col, showBOS, isUp) 
  calculates and draws Break Of Structure
  Namespace types: array
  Parameters:
     id (array) 
     startPoint (chart.point) 
     getKeyPointTime (int) : the actual time of startPoint, simplystartPoint.time
     getKeyPointPrice (float) : the actual time of startPoint, simplystartPoint.price
     col (color) : color of the BoS line / label
     showBOS (bool) : whether to show label/line. This function still calculates internally for other ICT related concepts even if not drawn.
     isUp (bool) : whether BoS happened during price increase or price decrease.
  Returns: void
 method drawMSS(id, startPoint, getKeyPointTime, getKeyPointPrice, col, showMSS, isUp, upRejections, dnRejections, highArr, lowArr, timeArr, closeArr, openArr, atrTFarr, upRejectionsPrices, dnRejectionsPrices) 
  calculates and draws Market Structure Shift. This data is also used to calculate Rejection Blocks.
  Namespace types: array
  Parameters:
     id (array) 
     startPoint (chart.point) 
     getKeyPointTime (int) : the actual time of startPoint, simplystartPoint.time
     getKeyPointPrice (float) : the actual time of startPoint, simplystartPoint.price
     col (color) : color of the MSS line / label
     showMSS (bool) : whether to show label/line. This function still calculates internally for other ICT related concepts even if not drawn.
     isUp (bool) : whether MSS happened during price increase or price decrease.
     upRejections (array) 
     dnRejections (array) 
     highArr (array) : array containing historical highs, should be taken from the UDT "necessaryData" defined above
     lowArr (array) : array containing historical lows, should be taken from the UDT "necessaryData" defined above
     timeArr (array) : array containing historical times, should be taken from the UDT "necessaryData" defined above
     closeArr (array) : array containing historical closes, should be taken from the UDT "necessaryData" defined above
     openArr (array) : array containing historical opens, should be taken from the UDT "necessaryData" defined above
     atrTFarr (array) : array containing historical atr values (of user-selected TF), should be taken from the UDT "necessaryData" defined above
     upRejectionsPrices (array) : array containing up rejections prices. Is sorted and used to determine selective looping for invalidations.
     dnRejectionsPrices (array) : array containing down rejections prices. Is sorted and used to determine selective looping for invalidations.
  Returns: void
 method getTime(id, compare, timeArr) 
  gets time of inputted price (compare) in an array of data
this is useful when the user-selected timeframe for ICT concepts is greater than the chart's timeframe
  Namespace types: array
  Parameters:
     id (array) : the array of data to search through, to find which index has the same value as "compare"
     compare (float) : the target data point to find in the array
     timeArr (array) : array of historical times
  Returns: the time that the data point in the array was recorded
 method OB(id, highArr, signArr, lowArr, timeArr, sign) 
  store bullish orderblock data
  Namespace types: array
  Parameters:
     id (array) 
     highArr (array) : array of historical highs
     signArr (array) : array of historical price direction "math.sign(close - open)"
     lowArr (array) : array of historical lows
     timeArr (array) : array of historical times
     sign (int) : orderblock direction, -1 => bullish, 1 => bearish
  Returns: void
 OTEstrat(OTEstart, future, closeArr, highArr, lowArr, timeArr, longOTEPT, longOTESL, longOTElevel, shortOTEPT, shortOTESL, shortOTElevel, structureDirection, oteLongs, atrTF, oteShorts) 
  executes the OTE strategy
  Parameters:
     OTEstart (chart.point) 
     future (int) : future time point for drawings
     closeArr (array) : array of historical closes
     highArr (array) : array of historical highs
     lowArr (array) : array of historical lows
     timeArr (array) : array of historical times
     longOTEPT (string) : user-selected long OTE profit target, please create an input.string() for this using the example below
     longOTESL (int) : user-selected long OTE stop loss, please create an input.string() for this using the example below
     longOTElevel (float) : long entry price of selected retracement ratio for OTE
     shortOTEPT (string) : user-selected short OTE profit target, please create an input.string() for this using the example below
     shortOTESL (int) : user-selected short OTE stop loss, please create an input.string() for this using the example below
     shortOTElevel (float) : short entry price of selected retracement ratio for OTE
     structureDirection (string) : current market structure direction, this should be "Up" or "Down". This is used to cancel pending orders if market structure changes
     oteLongs (bool) : input.bool() for whether OTE longs can be executed
     atrTF (float) : atr of the user-seleceted TF
     oteShorts (bool) : input.bool() for whether OTE shorts can be executed
@exampleInputs
oteLongs        = input.bool(defval = false, title = "OTE Longs", group = "Optimal Trade Entry")
longOTElevel    = input.float(defval = 0.79, title = "Long Entry Retracement Level", options =  , group = "Optimal Trade Entry")
longOTEPT       = input.string(defval = "-0.5", title = "Long TP", options =  , group = "Optimal Trade Entry")
longOTESL       = input.int(defval = 0, title = "How Many Ticks Below Swing Low For Stop Loss", group = "Optimal Trade Entry")
oteShorts       = input.bool(defval = false, title = "OTE Shorts", group = "Optimal Trade Entry")
shortOTElevel   = input.float(defval = 0.79, title = "Short Entry Retracement Level", options =  , group = "Optimal Trade Entry")
shortOTEPT      = input.string(defval = "-0.5", title = "Short TP", options =  , group = "Optimal Trade Entry")
shortOTESL      = input.int(defval = 0, title = "How Many Ticks Above Swing Low For Stop Loss", group = "Optimal Trade Entry")
  Returns: void (0)
 displacement(logZ, atrTFreg, highArr, timeArr, lowArr, upDispShow, dnDispShow, masterCoords, labelLevels, dispUpcol, rightCoordinate, dispDncol, noBorders) 
  calculates and draws dispacements
  Parameters:
     logZ (float) : log return of current price, used to determine a "significant price move" for a displacement
     atrTFreg (float) : atr of user-seleceted timeframe
     highArr (array) : array of historical highs
     timeArr (array) : array of historical times
     lowArr (array) : array of historical lows
     upDispShow (int) : amount of historical upside displacements to show
     dnDispShow (int) : amount of historical downside displacements to show
     masterCoords (map) : a  map to push the most recent displacement prices into, useful for having key levels in one data structure
     labelLevels (string) : used to determine label placement for the displacement, can be inside box, outside box, or none, example below
     dispUpcol (color) : upside displacement color
     rightCoordinate (int) : future time for displacement drawing, best is "last_bar_time"
     dispDncol (color) : downside displacement color
     noBorders (bool) : input.bool() to remove box borders, example below
@exampleInputs
labelLevels     = input.string(defval = "Inside" , title = "Box Label Placement", options =  )
noBorders       = input.bool(defval = false, title = "No Borders On Levels")
  Returns: void
 method getStrongLow(id, startIndex, timeArr, lowArr, strongLowPoints) 
  unshift strong low data to array id
  Namespace types: array
  Parameters:
     id (array) 
     startIndex (int) : the starting index for the timeArr array of the UDT "necessaryData".
this point should start from at least 1 pivot prior to find the low before an upside BoS
     timeArr (array) : array of historical times
     lowArr (array) : array of historical lows
     strongLowPoints (array) : array of strong low prices. Used to retrieve highest strong low price and see if need for
removal of invalidated strong lows
  Returns: void
 method getStrongHigh(id, startIndex, timeArr, highArr, strongHighPoints) 
  unshift strong high data to array id
  Namespace types: array
  Parameters:
     id (array) 
     startIndex (int) : the starting index for the timeArr array of the UDT "necessaryData".
this point should start from at least 1 pivot prior to find the high before a downside BoS
     timeArr (array) : array of historical times
     highArr (array) : array of historical highs
     strongHighPoints (array) 
  Returns: void
 equalLevels(highArr, lowArr, timeArr, rightCoordinate, equalHighsCol, equalLowsCol, liteMode) 
  used to calculate recent equal highs or equal lows
  Parameters:
     highArr (array) : array of historical highs
     lowArr (array) : array of historical lows
     timeArr (array) : array of historical times
     rightCoordinate (int) : a future time (right for boxes, x2 for lines)
     equalHighsCol (color) : user-selected color for equal highs drawings
     equalLowsCol (color) : user-selected color for equal lows drawings
     liteMode (bool) : optional for a lite mode version of an ICT strategy. For more control over drawings leave as "True", "False" will apply neon effects
  Returns: void
 quickTime(timeString) 
  used to quickly determine if a user-inputted time range is currently active in NYT time
  Parameters:
     timeString (string) : a time range
  Returns: true if session is active, false if session is inactive
 macros(showMacros, noBorders) 
  used to calculate and draw session macros
  Parameters:
     showMacros (bool) : an input.bool() or simple bool to determine whether to activate the function
     noBorders (bool) : an input.bool() to determine whether the box anchored to the session should have borders
  Returns: void
 po3(tf, left, right, show) 
  use to calculate HTF po3 candle
@tip only call this function on "barstate.islast"
  Parameters:
     tf (simple string) 
     left (int) : the left point of the candle, calculated as bar_index + left,
     right (int) : :the right point of the candle, calculated as bar_index + right,
     show (bool) : input.bool() whether to show the po3 candle or not
  Returns: void
 silverBullet(silverBulletStratLong, silverBulletStratShort, future, userTF, H, L, H2, L2, noBorders, silverBulletLongTP, historicalPoints, historicalData, silverBulletLongSL, silverBulletShortTP, silverBulletShortSL) 
  used to execute the Silver Bullet Strategy
  Parameters:
     silverBulletStratLong (simple bool) 
     silverBulletStratShort (simple bool) 
     future (int) : a future time, used for drawings, example "last_bar_time"
     userTF (simple int) 
     H (float) : the high price of the user-selected TF
     L (float) : the low price of the user-selected TF
     H2 (float) : the high  price of the user-selected TF
     L2 (float) : the low  price of the user-selected TF
     noBorders (bool) : an input.bool() used to remove the borders from box drawings
     silverBulletLongTP (series silverBulletLevels) 
     historicalPoints (array) 
     historicalData (necessaryData) 
     silverBulletLongSL (series silverBulletLevels) 
     silverBulletShortTP (series silverBulletLevels) 
     silverBulletShortSL (series silverBulletLevels) 
  Returns: void
 method invalidFVGcheck(FVGarr, upFVGpricesSorted, dnFVGpricesSorted) 
  check if existing FVGs are still valid
  Namespace types: array
  Parameters:
     FVGarr (array) 
     upFVGpricesSorted (array) : an array of bullish FVG prices, used to selective search through FVG array to remove invalidated levels
     dnFVGpricesSorted (array) : an array of bearish FVG prices, used to selective search through FVG array to remove invalidated levels
  Returns: void (0)
 method drawFVG(counter, FVGshow, FVGname, FVGcol, data, masterCoords, labelLevels, borderTransp, liteMode, rightCoordinate) 
  draws FVGs on last bar
  Namespace types: map
  Parameters:
     counter (map) : a counter, as map, keeping count of the number of FVGs drawn, makes sure that there aren't more FVGs drawn
than int FVGshow
     FVGshow (int) : the number of FVGs to show. There should be a bullish FVG show and bearish FVG show. This function "drawFVG" is used separately
for bearish FVG and bullish FVG.
     FVGname (string) : the name of the FVG, "FVG Up" or "FVG Down"
     FVGcol (color) : desired FVG color
     data (FVG) 
     masterCoords (map) : a map containing the names and price points of key levels. Used to define price ranges.
     labelLevels (string) : an input.string with options "Inside", "Outside", "Remove". Determines whether FVG labels should be inside box, outside,
or na.
     borderTransp (int) 
     liteMode (bool) 
     rightCoordinate (int) : the right coordinate of any drawings. Must be a time point.
  Returns: void
 invalidBlockCheck(bullishOBbox, bearishOBbox, userTF) 
  check if existing order blocks are still valid
  Parameters:
     bullishOBbox (array) : an array declared using the UDT orderBlock that contains bullish order block related data
     bearishOBbox (array) : an array declared using the UDT orderBlock that contains bearish order block related data
     userTF (simple int) 
  Returns: void (0)
 method lastBarRejections(id, rejectionColor, idShow, rejectionString, labelLevels, borderTransp, liteMode, rightCoordinate, masterCoords) 
  draws rejectionBlocks on last bar
  Namespace types: array
  Parameters:
     id (array) : the array, an array of rejection block data declared using the UDT rejection block
     rejectionColor (color) : the desired color of the rejection box
     idShow (int) 
     rejectionString (string) : the desired name of the rejection blocks
     labelLevels (string) : an input.string() to determine if labels for the block should be inside the box, outside, or none.
     borderTransp (int) 
     liteMode (bool) : an input.bool(). True = neon effect, false = no neon.
     rightCoordinate (int) : atime for the right coordinate of the box
     masterCoords (map) : a map  that stores the price of key levels and assigns them a name, used to determine price ranges
  Returns: void
 method OBdraw(id, OBshow, BBshow, OBcol, BBcol, bullishString, bearishString, isBullish, labelLevels, borderTransp, liteMode, rightCoordinate, masterCoords) 
  draws orderblocks and breaker blocks for data stored in UDT array()
  Namespace types: array
  Parameters:
     id (array) : the array, an array of order block data declared using the UDT orderblock
     OBshow (int) : the number of order blocks to show
     BBshow (int) : the number of breaker blocks to show
     OBcol (color) : color of order blocks
     BBcol (color) : color of breaker blocks
     bullishString (string) : the title of bullish blocks, which is a regular bullish orderblock or a bearish orderblock that's converted to breakerblock
     bearishString (string) : the title of bearish blocks, which is a regular bearish orderblock or a bullish orderblock that's converted to breakerblock
     isBullish (bool) : whether the array contains bullish orderblocks or bearish orderblocks. If bullish orderblocks,
the array will naturally contain bearish BB, and if bearish OB, the array will naturally contain bullish BB
     labelLevels (string) : an input.string() to determine if labels for the block should be inside the box, outside, or none.
     borderTransp (int) 
     liteMode (bool) : an input.bool(). True = neon effect, false = no neon.
     rightCoordinate (int) : atime for the right coordinate of the box
     masterCoords (map) : a map  that stores the price of key levels and assigns them a name, used to determine price ranges
  Returns: void
 FVG 
  UDT for FVG calcualtions
  Fields:
     H (series float) : high price of user-selected timeframe
     L (series float) : low price of user-selected timeframe
     direction (series string) : FVG direction => "Up" or "Down"
     T (series int) : => time of bar on user-selected timeframe where FVG was created
     fvgLabel (series label) : optional label for FVG
     fvgLineTop (series line) : optional line for top of FVG
     fvgLineBot (series line) : optional line for bottom of FVG
     fvgBox (series box) : optional box for FVG
 labelLine 
  quickly pair a line and label together as UDT
  Fields:
     lin (series line) : Line you wish to pair with label
     lab (series label) : Label you wish to pair with line
 orderBlock 
  UDT for order block calculations
  Fields:
     orderBlockData (array) : array containing order block x and y points
     orderBlockBox (series box) : optional order block box
     vioCount (series int) : = 0    violation count of the order block. 0 = Order Block, 1 = Breaker Block
     traded (series bool) 
     status (series string) : = "OB"   status == "OB" => Level is order block. status == "BB" => Level is breaker block.
     orderBlockLab (series label) : options label for the order block / breaker block.
 strongPoints 
  UDT for strong highs and strong lows
  Fields:
     price (series float) : price of the strong high or strong low
     timeAtprice (series int) : time of the strong high or strong low
     strongPointLabel (series label) : optional label for strong point
     strongPointLine (series line) : optional line for strong point
     overlayLine (series line) : optional lines for strong point to enhance visibility
     overlayLine2 (series line) : optional lines for strong point to enhance visibility
 displacement 
  UDT for dispacements
  Fields:
     highPrice (series float) : high price of displacement
     lowPrice (series float) : low price of displacement
     timeAtPrice (series int) : time of bar where displacement occurred
     displacementBox (series box) : optional box to draw displacement
     displacementLab (series label) : optional label for displacement
 po3data 
  UDT for po3 calculations
  Fields:
     dHigh (series float) : higher timeframe high price
     dLow (series float) : higher timeframe low price
     dOpen (series float) : higher timeframe open price
     dClose (series float) : higher timeframe close price
     po3box (series box) : box to draw po3 candle body
     po3line (array) : line array to draw po3 wicks
     po3Labels (array) : label array to label price points of po3 candle
 macros 
  UDT for session macros
  Fields:
     sessions (array) : Array of sessions, you can populate this array using the "quickTime" function located above "export macros".
     prices (matrix) : Matrix of session data -> open, high, low, close, time
     sessionTimes (array) : Array of session names. Pairs with array sessions.
     sessionLines (matrix) : Optional array for sesion drawings.
 OTEtimes 
  UDT for data storage and drawings associated with OTE strategy
  Fields:
     upTimes (array) : time of highest point before trade is taken
     dnTimes (array) : time of lowest point before trade is taken
     tpLineLong (series line) : line to mark tp level long
     tpLabelLong (series label) : label to mark tp level long
     slLineLong (series line) : line to mark sl level  long
     slLabelLong (series label) : label to mark sl level long
     tpLineShort (series line) : line to mark tp level short
     tpLabelShort (series label) : label to mark tp level short
     slLineShort (series line) : line to mark sl level  short
     slLabelShort (series label) : label to mark sl level short
 sweeps 
  UDT for data storage and drawings associated with liquidity sweeps
  Fields:
     upSweeps (matrix) : matrix containing liquidity sweep price points and time points for up sweeps
     dnSweeps (matrix) : matrix containing liquidity sweep price points and time points for down sweeps
     upSweepDrawings (array) : optional up sweep box array. Pair the size of this array with the rows or columns,
     dnSweepDrawings (array) : optional up sweep box array. Pair the size of this array with the rows or columns,
 raidExitDrawings 
  UDT for drawings associated with the Liquidity Raid Strategy
  Fields:
     tpLine (series line) : tp line for the liquidity raid entry
     tpLabel (series label) : tp label for the liquidity raid entry
     slLine (series line) : sl line for the liquidity raid entry
     slLabel (series label) : sl label for the liquidity raid entry
 m2022 
  UDT for data storage and drawings associated with the Model 2022 Strategy
  Fields:
     mTime (series int) : time of the FVG where entry limit order is placed
     mIndex (series int) : array index of FVG where entry limit order is placed. This requires an array of FVG data, which is defined above.
     mEntryDistance (series float) : the distance of the FVG to the 50% range. M2022 looks for the fvg closest to 50% mark of range.
     mEntry (series float) : the entry price for the most eligible fvg
     fvgHigh (series float) : the high point of the eligible fvg
     fvgLow (series float) : the low point of the eligible fvg
     longFVGentryBox (series box) : long FVG box, used to draw the eligible FVG
     shortFVGentryBox (series box) : short FVG box, used to draw the eligible FVG
     line50P (series line) : line used to mark 50% of the range
     line100P (series line) : line used to mark 100% (top) of the range
     line0P (series line) : line used to mark 0% (bottom) of the range
     label50P (series label) : label used to mark 50% of the range
     label100P (series label) : label used to mark 100% (top) of the range
     label0P (series label) : label used to mark 0% (bottom) of the range
     sweepData (array) 
 silverBullet 
  UDT for data storage and drawings associated with the Silver Bullet Strategy
  Fields:
     session (series bool) 
     sessionStr (series string) : name of the session for silver bullet
     sessionBias (series string) 
     sessionHigh (series float) : = high   high of session // use math.max(silverBullet.sessionHigh, high)
     sessionLow (series float) : = low    low of session  // use math.min(silverBullet.sessionLow, low)
     sessionFVG (series float) : if applicable, the FVG created during the session
     sessionFVGdraw (series box) : if applicable, draw the FVG created during the session
     traded (series bool) 
     tp (series float) : tp of trade entered at the session FVG
     sl (series float) : sl of trade entered at the session FVG
     sessionDraw (series box) : optional draw session with box
     sessionDrawLabel (series label) : optional label session with label
 silverBulletDrawings 
  UDT for trade exit drawings associated with the Silver Bullet Strategy
  Fields:
     tpLine (series line) : tp line drawing for strategy
     tpLabel (series label) : tp label drawing for strategy
     slLine (series line) : sl line drawing for strategy
     slLabel (series label) : sl label drawing for strategy
 unicornModel 
  UDT for data storage and drawings associated with the Unicorn Model Strategy
  Fields:
     hPoint (chart.point) 
     hPoint2 (chart.point) 
     hPoint3 (chart.point) 
     breakerBlock (series box) : used to draw the breaker block required for the Unicorn Model
     FVG (series box) : used to draw the FVG required for the Unicorn model
     topBlock (series float) : price of top of breaker block, can be used to detail trade entry
     botBlock (series float) : price of bottom of breaker block, can be used to detail trade entry
     startBlock (series int) : start time of the breaker block, used to set the "left = " param for the box
     includes (array) : used to store the time of the breaker block, or FVG, or the chart point sequence that setup the Unicorn Model.
     entry (series float) : // eligible entry price, for longs"math.max(topBlock, FVG.get_top())",
     tpLine (series line) : optional line to mark PT
     tpLabel (series label) : optional label to mark PT
     slLine (series line) : optional line to mark SL
     slLabel (series label) : optional label to mark SL
 rejectionBlocks 
  UDT for data storage and drawings associated with rejection blocks
  Fields:
     rejectionPoint (chart.point) 
     bodyPrice (series float) : candle body price closest to the rejection point, for "Up" rejections => math.max(open, close),
     rejectionBox (series box) : optional box drawing of the rejection block
     rejectionLabel (series label) : optional label for the rejection block
 equalLevelsDraw 
  UDT for data storage and drawings associated with equal highs / equal lows
  Fields:
     connector (series line) : single line placed at the first high or low, y = avgerage of distinguished equal highs/lows
     connectorLab (series label) : optional label to be placed at the highs or lows
     levels (array) : array containing the equal highs or lows prices
     times (array) : array containing the equal highs or lows individual times
     startTime (series int) : the time of the first high or low that forms a sequence of equal highs or lows
     radiate (array) : options label to "radiate" the label in connector lab. Can be used for anything
 necessaryData 
  UDT for data storage of historical price points.
  Fields:
     highArr (array) : array containing historical high points
     lowArr (array) : array containing historical low points
     timeArr (array) : array containing historical time points
     logArr (array) : array containing historical log returns
     signArr (array) : array containing historical price directions
     closeArr (array) : array containing historical close points
     binaryTimeArr (array) : array containing historical time points, uses "push" instead of "unshift" to allow for binary search
     binaryCloseArr (array) : array containing historical close points, uses "push" instead of "unshift" to allow the correct
     binaryOpenArr (array) : array containing historical optn points, uses "push" instead of "unshift" to allow the correct
     atrTFarr (array) : array containing historical user-selected TF atr points
     openArr (array) : array containing historical open points
Volume Profile (Simple)Simple Volume Profile (Simple) 
Master the Market's Structure with a Clear View of Volume
by mercaderoaurum
The Simple Volume Profile (Simple) indicator removes the guesswork by showing you exactly where the most significant trading activity has occurred. By visualizing the Point of Control (POC) and Value Area (VA) for today and yesterday, you can instantly identify the price levels that matter most, giving you a critical edge in your intraday trading.
This tool is specifically optimized for day trading SPY on a 1-minute chart, but it's fully customizable for any symbol or timeframe.
Key Features
Multi-Day Analysis: Automatically plots the volume profiles for the current and previous trading sessions, allowing you to see how today's market is reacting to yesterday's key levels.
Automatic Key Level Plotting: Instantly see the most important levels from each session:
Point of Control (POC): The single price level with the highest traded volume, acting as a powerful magnet for price.
Value Area High (VAH): The upper boundary of the area where 50% of the volume was traded. It often acts as resistance.
Value Area Low (VAL): The lower boundary of the 50% value area, often acting as support.
Extended Levels: The POC, VAH, and VAL from previous sessions are automatically extended into the current day, providing a clear map of potential support and resistance zones.
Customizable Sessions: While optimized for the US stock market, you can define any session time and time zone, making it a versatile tool for forex, crypto, and futures traders.
Core Trading Strategies
The Simple Volume Profile helps you understand market context. Instead of trading blind, you can now make decisions based on where the market has shown the most interest.
1. Identifying Support and Resistance
This is the most direct way to use the indicator. The extended lines from the previous day are your roadmap for the current session.
Previous Day's POC (pPOC): This is the most significant level. Watch for price to react strongly here. It can act as powerful support if approached from above or strong resistance if approached from below.
Previous Day's VAH (pVAH): Expect this level to act as initial resistance. A clean break above pVAH can signal a strong bullish trend.
Previous Day's VAL (pVAL): Expect this level to act as initial support. A firm break below pVAL can indicate a strong bearish trend.
Example Strategy: If SPY opens and rallies up to the previous day's VAH and stalls, this is a high-probability area to look for a short entry, with a stop loss just above the level.
2. The "Open-Drive" Rejection
How the market opens in relation to the previous day's value area is a powerful tell.
Open Above Yesterday's Value Area: If the market opens above the pVAH, it signals strength. The first pullback to test the pVAH is often a key long entry point. The level is expected to flip from resistance to support.
Open Below Yesterday's Value Area: If the market opens below the pVAL, it signals weakness. The first rally to test the pVAL is a potential short entry, as the level is likely to act as new resistance.
3. Fading the Extremes
When price pushes far outside the previous day's value area, it can become overextended.
Reversal at Highs: If price rallies significantly above the pVAH and then starts to lose momentum (e.g., forming bearish divergence on RSI or a topping pattern), it could be an opportunity to short the market, targeting a move back toward the pVAH or pPOC.
Reversal at Lows: Conversely, if price drops far below the pVAL and shows signs of bottoming, it can be a good opportunity to look for a long entry, targeting a reversion back to the value area.
Recommended Settings (SPY Intraday)
These settings are the default and are optimized for scalping or day trading SPY on a 1-minute chart.
Value Area (%): 50%. This creates a tighter, more sensitive value area, perfect for identifying the most critical intraday zones.
Number of Rows: 1000. This high resolution is essential for a low-volatility instrument like SPY, ensuring that the profile is detailed and the levels are precise.
Session Time: 0400-1800 in America/New_York. This captures the full pre-market and core session, which is crucial for understanding the day's complete volume story.
Ready to trade with an edge? Add the Simple Volume Profile (Multi-Day) to your chart now and see the market in a new light!
Casa_VolumeProfileSessionLibrary   "Casa_VolumeProfileSession" 
Analyzes price and volume during regular trading hours to provide a session volume profile,
including Point of Control (POC), Value Area High (VAH), and Value Area Low (VAL).
Calculates and displays these levels historically and for the developing session.
Offers customizable visualization options for the Value Area, POC, histogram, and labels.
Uses lower timeframe data for increased accuracy and supports futures sessions.
The number of rows used for the volume profile can be fixed or dynamically calculated based on the session's price range and the instrument's minimum tick increment, providing optimal resolution.
 calculateEffectiveRows(configuredRows, dayHigh, dayLow) 
  Determines the optimal number of rows for the volume profile, either using the configured value or calculating dynamically based on price range and tick size
  Parameters:
     configuredRows (int) : User-specified number of rows (0 means auto-calculate)
     dayHigh (float) : Highest price of the session
     dayLow (float) : Lowest price of the session
  Returns: The number of rows to use for the volume profile
 debug(vp, position) 
  Helper function to write some information about the supplied SVP object to the screen in a table.
  Parameters:
     vp (Object) : The SVP object to debug
     position (string) : The position.* to place the table. Defaults to position.bottom_center
 getLowerTimeframe() 
  Depending on the timeframe of the chart, determines a lower timeframe to grab volume data from for the analysis
  Returns: The timeframe string to fetch volume for
 get(volumeProfile, lowerTimeframeHigh, lowerTimeframeLow, lowerTimeframeVolume, lowerTimeframeTime, lowerTimeframeSessionIsMarket) 
  Populated the provided SessionVolumeProfile object with vp data on the session.
  Parameters:
     volumeProfile (Object) : The SessionVolumeProfile object to populate
     lowerTimeframeHigh (array) : The lower timeframe high values
     lowerTimeframeLow (array) : The lower timeframe low values
     lowerTimeframeVolume (array) : The lower timeframe volume values
     lowerTimeframeTime (array) : The lower timeframe time values
     lowerTimeframeSessionIsMarket (array) : The lower timeframe session.ismarket values (that are futures-friendly)
 drawPriorValueAreas(todaySessionVolumeProfile, extendYesterdayOverToday, showLabels, labelSize, pocColor, pocStyle, pocWidth, vahlColor, vahlStyle, vahlWidth, vaColor) 
  Given a SessionVolumeProfile Object, will render the historical value areas for that object.
  Parameters:
     todaySessionVolumeProfile (Object) : The SessionVolumeProfile Object to draw
     extendYesterdayOverToday (bool) : Defaults to true
     showLabels (bool) : Defaults to true
     labelSize (string) : Defaults to size.small
     pocColor (color) : Defaults to #e500a4
     pocStyle (string) : Defaults to line.style_solid
     pocWidth (int) : Defaults to 1
     vahlColor (color) : The color of the value area high/low lines. Defaults to #1592e6
     vahlStyle (string) : The style of the value area high/low lines. Defaults to line.style_solid
     vahlWidth (int) : The width of the value area high/low lines. Defaults to 1
     vaColor (color) : The color of the value area background. Defaults to #00bbf911)
 drawHistogram(volumeProfile, bgColor, showVolumeOnHistogram) 
  Given a SessionVolumeProfile object, will render the histogram for that object.
  Parameters:
     volumeProfile (Object) : The SessionVolumeProfile object to draw
     bgColor (color) : The baseline color to use for the histogram. Defaults to #00bbf9
     showVolumeOnHistogram (bool) : Show the volume amount on the histogram bars. Defaults to false.
 Object 
  Object Contains all settings and calculated values for a Volume Profile Session analysis
  Fields:
     numberOfRows (series int) : Number of price levels to divide the range into. If set to 0, auto-calculates based on price range and tick size
     valueAreaCoverage (series int) : Percentage of total volume to include in the Value Area (default 70%)
     trackDevelopingVa (series bool) : Whether to calculate and display the Value Area as it develops during the session
     valueAreaHigh (series float) : Upper boundary of the Value Area - price level containing specified % of volume
     pointOfControl (series float) : Price level with the highest volume concentration
     valueAreaLow (series float) : Lower boundary of the Value Area
     startTime (series int) : Session start time in Unix timestamp format
     endTime (series int) : Session end time in Unix timestamp format
     dayHigh (series float) : Highest price of the session
     dayLow (series float) : Lowest price of the session
     step (series float) : Size of each price row (calculated as price range divided by number of rows)
     pointOfControlLevel (series int) : Index of the row containing the Point of Control
     valueAreaHighLevel (series int) : Index of the row containing the Value Area High
     valueAreaLowLevel (series int) : Index of the row containing the Value Area Low
     lastTime (series int) : Tracks the most recent timestamp processed
     volumeRows (map) : Stores volume data for each price level row (key=row number, value=volume)
     ltfSessionHighs (array) : Stores high prices from lower timeframe data
     ltfSessionLows (array) : Stores low prices from lower timeframe data
     ltfSessionVols (array) : Stores volume data from lower timeframe data
Time-Based VWAP (TVWAP)(TVWAP) Indicator
The Time-Based Volume Weighted Average Price (TVWAP) indicator is a customized version of VWAP designed for intraday trading sessions with defined start and end times. Unlike the traditional VWAP, which calculates the volume-weighted average price over an entire trading day, this indicator allows you to focus on specific time periods, such as ICT kill zones (e.g., London Open, New York Open, Power Hour). It helps crypto scalpers and advanced traders identify price deviations relative to volume during key trading windows.
Key Features:
Custom Time Interval:
You can set the exact start and end times for the VWAP calculation using input settings for hours and minutes (24-hour format).
Ideal for analyzing short, high-liquidity periods.
Dynamic Accumulation of Price and Volume:
The indicator resets at the beginning of the specified session and accumulates price-volume data until the end of the session.
Ensures that the TVWAP reflects the weighted average price specific to the chosen session.
Visual Representation:
The indicator plots the TVWAP line only during the specified time window, providing a clear visual reference for price action during that period.
Outside the session, the TVWAP line is hidden (na).
Use Cases:
ICT Scalp Trading:
Monitor price rebalances or potential liquidity sweeps near TVWAP during important trading sessions.
Mean Reversion Strategies:
Detect pullbacks toward the session’s average price for potential entry points.
Breakout Confirmation:
Confirm price direction relative to TVWAP during kill zones or high-volume times to determine if a breakout is supported by volume.
Inputs:
Start Hour/Minute: The time when the TVWAP calculation starts.
End Hour/Minute: The time when the TVWAP calculation ends.
Technical Explanation:
The indicator uses the timestamp function to create time markers for the session start and end.
During the session, the price-volume (close * volume) is accumulated along with the total volume.
TVWAP is calculated as:
TVWAP = (Sum of (Price × Volume)) ÷ (Sum of Volume)
 
Once the session ends, the TVWAP resets for the next trading period.
Customization Ideas:
Alerts: Add notifications when the price touches or deviates significantly from TVWAP.
Different Colors: Use different line colors based on upward or downward trends.
Multiple Sessions: Add support for multiple TVWAP lines for different time periods (e.g., London + New York).
Initial Balance Breakout Signals [LuxAlgo]The  Initial Balance Breakout Signals  help traders identify breakouts of the Initial Balance (IB) range. 
The indicator includes automatic detection of IB or can use custom sessions, highlights top and bottom IB extensions, custom Fibonacci levels, and goes further with an IB forecast with two different modes.
🔶  USAGE 
  
The initial balance is the price range made within the first hour of the trading session. It is an intraday concept based on the idea that high volume and volatility enter the market through institutional trading at the start of the session, setting the tone for the rest of the day.
The initial balance is useful for gauging market sentiment, or, in other words, the relationship between buyers and sellers.
 
 Bullish sentiment: Price trades above the IB range.
 Mixed sentiment: Price trades within the IB range.
 Bearish sentiment: Price trades below the IB range.
 
The initial balance high and low are important levels that many traders use to gauge sentiment. There are two main ideas behind trading around the IB range.
 
 IB Extreme Breakout: When the price breaks and holds the IB high or low, there is a high probability that the price will continue in that direction.
 IB Extreme Rejection: When the price tries to break those levels but fails, there is a high probability that it will reach the opposite IB extreme.
 
This indicator is a complete Initial Balance toolset with custom sessions, breakout signals, IB extensions, Fibonacci retracements, and an IB forecast. All of these features will be explained in the following sections.
🔹  Custom Sessions and Signals 
  
By default, sessions for Initial Balance and breakout signals are in Auto mode. This means that Initial Balance takes the first hour of the trading session and shows breakout signals for the rest of the session.
With this option, traders can use the tool for open range trading, making it highly versatile. The concept behind open range (OR) is the same as that of initial balance (IB), but in OR, the range is determined by the first minute, three or five minutes, or up to the first 30 minutes of the trading session.
As shown in the image above, the top chart uses the Auto feature for the IB and Breakouts sessions. The bottom chart has the Auto feature disabled to use custom sessions for both parameters. In this case, the first three minutes of the trading session are used, turning the tool into an Open Range trading indicator.
  
This chart shows another example of using custom sessions to display overnight NASDAQ futures sessions.
The left chart shows a custom session from the Tokyo open to the London open, and the right chart shows a custom session from the London open to the New York open.
The chart shows both the Asian and European sessions, their top and bottom extremes, and the breakout signals from those extremes.
🔹  Initial Balance Extensions 
  
Traders can easily extend both extremes of the Initial Balance to display their preferred targets for breakouts. Enable or disable any of them and set the IB percentage to use for the extension.
As the chart shows, the percentage selected on the settings panel directly affects the displayed levels.
Setting 25 means the tool will use a quarter of the detected initial balance range for extensions beyond the IB extremes. Setting 100 means the full IB range will be used.
Traders can use these extensions as targets for breakout signals.
🔹  Fibonacci Levels 
  
Traders can display default or custom Fibonacci levels on the IB range to trade retracements and assess the strength of market movements. Each level can be enabled or disabled and customized by level, color, and line style.
As we can see on the chart, after the IB was completed, prices were unable to fall below the 0.236 Fibonacci level. This indicates significant bullish pressure, so it is expected that prices will rise.
Traders can use these levels as guidelines to assess the strength of the side trying to penetrate the IB. In this case, the sellers were unable to move the market beyond the first level.
🔹  Initial Balance Forecast 
  
The tool features two different forecasting methods for the current IB. By default, it takes the average of the last ten values and applies a multiplier of one.
 
 IB Against Previous Open: averages the difference between IB extremes and the open of the previous session.
 Filter by current day of the week: averages the difference between IB extremes and the open of the current session for the same day of the week.
 
This feature allows traders to see the difference between the current IB and the average of the last IBs. It makes it very easy to interpret: if the current IB is higher than the average, buyers are in control; if it is lower than the average, sellers are in control.
For example, on the left side of the chart, we can see that the last day was very bullish because the IB was completely above the forecasted value. This is the IB mean of the last ten trading days.
On the right, we can see that on Monday, September 15, the IB traded slightly higher but within the forecasted value of the IB mean of the last ten Mondays. In this case, it is within expectations.
🔶  SETTINGS 
 
 Display Last X IBs: Select how many IBs to display.
 Initial Balance: Choose a custom session or enable the Auto feature.
 Breakouts: Enable or disable breakouts. Choose custom session or enable the Auto feature.
 
🔹  Extensions 
 
 Top Extension: Enable or disable the top extension and choose the percentage of IB to use.
 Bottom extension: Enable or disable the bottom extension and choose the percentage of IB to use.
 
🔹  Fibonacci Levels 
 
 Display Fibonacci: Enable or disable Fibonacci levels.
 Reverse: Reverse Fibonacci levels.
 Levels, Colors & Style
 Display Labels: Enable or disable labels and choose text size.
 
🔹  Forecast 
 
 Display Forecast: Select the forecast method.
- IB Against Previous Open: Calculates the average difference between the IB high and low and the previous day's IB open price.
- Filter by Current Day of Week: Calculates the average difference between the IB high and low and the IB open price for the same day of the week.
 Forecast Memory: The number of data points used to calculate the average.
 Forecast Multiplier: This multiplier will be applied to the average. Bigger numbers will result in wider predicted ranges.
 Forecast Colors: Choose from a variety of colors.
 Forecast Style: Choose a line style.
 
🔹  Style 
 
 Initial Balance Colors
 Extension Transparency: Choose the extension's transparency. 0 is solid, and 100 is fully transparent.
Global Market Clock Pro🌍✨ Global Market Clock Pro is a market session visualizer that combines utility and fun on your charts! 📊⏰ This indicator includes three analog clocks representing the Tokyo, London, and New York sessions, added in an entertaining way to make analysis more enjoyable and dynamic. 😊 Each clock clearly shows the session start and end times through arcs and distinctive markers, making it easier to identify active market periods. 💡
 
Also, a statistics table is added offering detailed information for each session:
📊 Percentage Change : Displays the price variation between sessions.
💰 Price Range : Highlights volatility within each session.
📈 Session Volume : Evaluates market activity based on traded volume.
📊 Average Volatility : Helps measure price fluctuations over time.
📌 Mean (Average Close) : Calculated by dividing the sum of closing prices of each bar by the total number of bars recorded during the session. This value gives you a reference for average price behavior, helping you detect general trends and key support/resistance levels. 📉
 
📌 Max Range (Maximum Range) : Represents the largest difference recorded between the highest and lowest prices during the session. This indicator is crucial for identifying volatility peaks, as it shows how far the market moved during its most active moments. 🔥
⚠️ VERY IMPORTANT : This tool works best only in timeframes under 4 hours ! ⏳
By integrating these data points directly into your chart, this indicator becomes a powerful tool to align your strategies with market activity in each session. Whether you're a day trader or a long-term investor, Global Market Clock Pro provides clear, data-driven insights to enhance decision-making. 💻📈
 Español: 
🌍✨ Global Market Clock Pro es un visualizador de sesiones de mercado que combina utilidad y diversión en tus gráficos. 📊⏰ Este indicador incluye tres relojes analógicos que representan las sesiones de Tokio, Londres y Nueva York, agregados de manera entretenida para hacer el análisis más ameno y dinámico. 😊 Cada reloj muestra con claridad los horarios de inicio y cierre de sesión mediante arcos y marcadores distintivos, facilitando la identificación de los periodos activos del mercado. 💡
 
Además, se añade una tabla de estadísticas que ofrece información detallada de cada sesión:
📊 Cambio porcentual : Muestra la variación de precio entre sesiones.
💰 Rango de precios : Destaca la volatilidad dentro de cada sesión.
📈 Volumen de sesión : Evalúa la actividad del mercado mediante el volumen negociado.
📊 Volatilidad promedio : Ayuda a medir las fluctuaciones del precio a lo largo del tiempo.
📌 Mean (Promedio de Cierre) : Se calcula dividiendo la suma de los precios de cierre de cada barra entre el número total de barras registradas durante la sesión. Este valor te brinda una referencia del comportamiento medio del precio, permitiéndote detectar tendencias generales y niveles clave de soporte o resistencia. 📉
 
📌 Max Range (Rango Máximo) : Representa la mayor diferencia registrada entre el precio más alto y el más bajo durante la sesión. Este indicador es fundamental para identificar los picos de volatilidad, ya que muestra hasta qué punto el mercado se movió en sus momentos de mayor actividad. 🔥
⚠️ ¡MUY IMPORTANTE! : Esta herramienta funciona mejor solo en temporalidades menores a 4 horas . ⏳
Al integrar estos datos directamente en el gráfico, este indicador se convierte en una herramienta poderosa para sincronizar tus estrategias con la actividad del mercado en cada sesión. Ya seas un trader intradía o un inversor a largo plazo, Global Market Clock Pro proporciona claridad basada en datos para mejorar la toma de decisiones. 💻📈
🚀 ¡No dejes pasar la oportunidad de optimizar tu experiencia de trading con esta innovadora herramienta! ✨
JK_Traders_Reality_LibLibrary   "JK_Traders_Reality_Lib" 
This library contains common elements used in Traders Reality scripts
 calcPvsra(pvsraVolume, pvsraHigh, pvsraLow, pvsraClose, pvsraOpen, redVectorColor, greenVectorColor, violetVectorColor, blueVectorColor, darkGreyCandleColor, lightGrayCandleColor) 
  calculate the pvsra candle color and return the color as well as an alert if a vector candle has apperared.
Situation "Climax"
Bars with volume >= 200% of the average volume of the 10 previous chart TFs, or bars
where the product of candle spread x candle volume is >= the highest for the 10 previous
chart time TFs.
Default Colors:  Bull bars are green and bear bars are red.
Situation "Volume Rising Above Average"
Bars with volume >= 150% of the average volume of the 10 previous chart TFs.
Default Colors:  Bull bars are blue and bear are violet.
  Parameters:
     pvsraVolume (float) : the instrument volume series (obtained from request.sequrity)
     pvsraHigh (float) : the instrument high series (obtained from request.sequrity)
     pvsraLow (float) : the instrument low series (obtained from request.sequrity)
     pvsraClose (float) : the instrument close series (obtained from request.sequrity)
     pvsraOpen (float) : the instrument open series (obtained from request.sequrity)
     redVectorColor (simple color) : red vector candle color
     greenVectorColor (simple color) : green vector candle color
     violetVectorColor (simple color) : violet/pink vector candle color
     blueVectorColor (simple color) : blue vector candle color
     darkGreyCandleColor (simple color) : regular volume candle down candle color - not a vector
     lightGrayCandleColor (simple color) : regular volume candle up candle color - not a vector
@return  
 adr(length, barsBack) 
  Parameters:
     length (simple int) : how many elements of the series to calculate on
     barsBack (simple int) : starting possition for the length calculation - current bar or some other value eg last bar
@return adr the adr for the specified lenght
 adrHigh(adr, fromDo) 
  Calculate the ADR high given an ADR
  Parameters:
     adr (float) : the adr
     fromDo (simple bool) : boolean flag, if false calculate traditional adr from high low of today, if true calcualte from exchange midnight
@return adrHigh the position of the adr high in price
 adrLow(adr, fromDo) 
  Parameters:
     adr (float) : the adr
     fromDo (simple bool) : boolean flag, if false calculate traditional adr from high low of today, if true calcualte from exchange midnight
@return adrLow the position of the adr low in price
 splitSessionString(sessXTime) 
  given a session in the format 0000-0100:23456 split out the hours and minutes
  Parameters:
     sessXTime (simple string) : the session time string usually in the format 0000-0100:23456
@return  
 calcSessionStartEnd(sessXTime, gmt) 
  calculate the start and end timestamps of the session
  Parameters:
     sessXTime (simple string) : the session time string usually in the format 0000-0100:23456
     gmt (simple string) : the gmt offset string usually in the format GMT+1 or GMT+2 etc
@return  
 drawOpenRange(sessXTime, sessXcol, showOrX, gmt) 
  draw open range for a session
  Parameters:
     sessXTime (simple string) : session string in the format 0000-0100:23456
     sessXcol (simple color) : the color to be used for the opening range box shading
     showOrX (simple bool) : boolean flag to toggle displaying the opening range
     gmt (simple string) : the gmt offset string usually in the format GMT+1 or GMT+2 etc
@return void
 drawSessionHiLo(sessXTime, showRectangleX, showLabelX, sessXcolLabel, sessXLabel, gmt, sessionLineStyle) 
  Parameters:
     sessXTime (simple string) : session string in the format 0000-0100:23456
     showRectangleX (simple bool) 
     showLabelX (simple bool) 
     sessXcolLabel (simple color) : the color to be used for the hi/low lines and label
     sessXLabel (simple string) : the session label text
     gmt (simple string) : the gmt offset string usually in the format GMT+1 or GMT+2 etc
     sessionLineStyle (simple string) : the line stile for the session high low lines
@return void
 calcDst() 
  calculate market session dst on/off flags
@return   indicating if DST is on or off for a particular region
 timestampPreviousDayOfWeek(previousDayOfWeek, hourOfDay, gmtOffset, oneWeekMillis) 
  Timestamp any of the 6 previous days in the week (such as last Wednesday at 21 hours GMT)
  Parameters:
     previousDayOfWeek (simple string) : Monday or Satruday
     hourOfDay (simple int) : the hour of the day when psy calc is to start
     gmtOffset (simple string) : the gmt offset string usually in the format GMT+1 or GMT+2 etc
     oneWeekMillis (simple int) : the amount if time for a week in milliseconds
@return the timestamp of the psy level calculation start time
 getdayOpen() 
  get the daily open - basically exchange midnight
@return the daily open value which is float price
 newBar(res) 
  new_bar: check if we're on a new bar within the session in a given resolution
  Parameters:
     res (simple string) : the desired resolution
@return true/false is a new bar for the session has started
 toPips(val) 
  to_pips Convert value to pips
  Parameters:
     val (float) : the value to convert to pips
@return the value in pips
 rLabel(ry, rtext, rstyle, rcolor, valid, labelXOffset) 
  a function that draws a right aligned lable for a series during the current bar
  Parameters:
     ry (float) : series float the y coordinate of the lable
     rtext (simple string) : the text of the label
     rstyle (simple string) : the style for the lable
     rcolor (simple color) : the color for the label
     valid (simple bool) : a boolean flag that allows for turning on or off a lable
     labelXOffset (int) : how much to offset the label from the current position
 rLabelOffset(ry, rtext, rstyle, rcolor, valid, labelOffset) 
  a function that draws a right aligned lable for a series during the current bar
  Parameters:
     ry (float) : series float the y coordinate of the lable
     rtext (string) : the text of the label
     rstyle (simple string) : the style for the lable
     rcolor (simple color) : the color for the label
     valid (simple bool) : a boolean flag that allows for turning on or off a lable
     labelOffset (int) 
 rLabelLastBar(ry, rtext, rstyle, rcolor, valid, labelXOffset) 
  a function that draws a right aligned lable for a series only on the last bar
  Parameters:
     ry (float) : series float the y coordinate of the lable
     rtext (string) : the text of the label
     rstyle (simple string) : the style for the lable
     rcolor (simple color) : the color for the label
     valid (simple bool) : a boolean flag that allows for turning on or off a lable
     labelXOffset (int) : how much to offset the label from the current position
 drawLine(xSeries, res, tag, xColor, xStyle, xWidth, xExtend, isLabelValid, xLabelOffset, validTimeFrame) 
  a function that draws a line and a label for a series
  Parameters:
     xSeries (float) : series float the y coordinate of the line/label
     res (simple string) : the desired resolution controlling when a new line will start
     tag (simple string) : the text for the lable
     xColor (simple color) : the color for the label
     xStyle (simple string) : the style for the line
     xWidth (simple int) : the width of the line
     xExtend (simple string) : extend the line
     isLabelValid (simple bool) : a boolean flag that allows for turning on or off a label
     xLabelOffset (int) 
     validTimeFrame (simple bool) : a boolean flag that allows for turning on or off a line drawn
 drawLineDO(xSeries, res, tag, xColor, xStyle, xWidth, xExtend, isLabelValid, xLabelOffset, validTimeFrame) 
  a function that draws a line and a label for the daily open series
  Parameters:
     xSeries (float) : series float the y coordinate of the line/label
     res (simple string) : the desired resolution controlling when a new line will start
     tag (simple string) : the text for the lable
     xColor (simple color) : the color for the label
     xStyle (simple string) : the style for the line
     xWidth (simple int) : the width of the line
     xExtend (simple string) : extend the line
     isLabelValid (simple bool) : a boolean flag that allows for turning on or off a label
     xLabelOffset (int) 
     validTimeFrame (simple bool) : a boolean flag that allows for turning on or off a line drawn
 drawPivot(pivotLevel, res, tag, pivotColor, pivotLabelColor, pivotStyle, pivotWidth, pivotExtend, isLabelValid, validTimeFrame, levelStart, pivotLabelXOffset) 
  draw a pivot line - the line starts one day into the past
  Parameters:
     pivotLevel (float) : series of the pivot point
     res (simple string) : the desired resolution
     tag (simple string) : the text to appear
     pivotColor (simple color) : the color of the line
     pivotLabelColor (simple color) : the color of the label
     pivotStyle (simple string) : the line style
     pivotWidth (simple int) : the line width
     pivotExtend (simple string) : extend the line
     isLabelValid (simple bool) : boolean param allows to turn label on and off
     validTimeFrame (simple bool) : only draw the line and label at a valid timeframe
     levelStart (int) : basically when to start drawing the levels
     pivotLabelXOffset (int) : how much to offset the label from its current postion
@return the pivot line series
 getPvsraFlagByColor(pvsraColor, redVectorColor, greenVectorColor, violetVectorColor, blueVectorColor, lightGrayCandleColor) 
  convert the pvsra color to an internal code
  Parameters:
     pvsraColor (color) : the calculated pvsra color
     redVectorColor (simple color) : the user defined red vector color
     greenVectorColor (simple color) : the user defined green vector color
     violetVectorColor (simple color) : the user defined violet vector color
     blueVectorColor (simple color) : the user defined blue vector color
     lightGrayCandleColor (simple color) : the user defined regular up candle color
@return pvsra internal code
 updateZones(pvsra, direction, boxArr, maxlevels, pvsraHigh, pvsraLow, pvsraOpen, pvsraClose, transperancy, zoneupdatetype, zonecolor, zonetype, borderwidth, coloroverride, redVectorColor, greenVectorColor, violetVectorColor, blueVectorColor) 
  a function that draws the unrecovered vector candle zones
  Parameters:
     pvsra (int) : internal code
     direction (simple int) : above or below the current pa
     boxArr (array) : the array containing the boxes that need to be updated
     maxlevels (simple int) : the maximum number of boxes to draw
     pvsraHigh (float) : the pvsra high value series
     pvsraLow (float) : the pvsra low value series
     pvsraOpen (float) : the pvsra open value series
     pvsraClose (float) : the pvsra close value series
     transperancy (simple int) : the transparencfy of the vecor candle zones
     zoneupdatetype (simple string) : the zone update type
     zonecolor (simple color) : the zone color if overriden
     zonetype (simple string) : the zone type
     borderwidth (simple int) : the width of the border
     coloroverride (simple bool) : if the color overriden
     redVectorColor (simple color) : the user defined red vector color
     greenVectorColor (simple color) : the user defined green vector color
     violetVectorColor (simple color) : the user defined violet vector color
     blueVectorColor (simple color) : the user defined blue vector color
 cleanarr(arr) 
  clean an array from na values
  Parameters:
     arr (array) : the array to clean
@return if the array was cleaned
 calcPsyLevels(oneWeekMillis, showPsylevels, psyType, sydDST) 
  calculate the psy levels
4 hour res based on how mt4 does it
mt4 code
int Li_4 = iBarShift(NULL, PERIOD_H4, iTime(NULL, PERIOD_W1, Li_0)) - 2 - Offset;
ObjectCreate("PsychHi", OBJ_TREND, 0, Time , iHigh(NULL, PERIOD_H4, iHighest(NULL, PERIOD_H4, MODE_HIGH, 2, Li_4)), iTime(NULL, PERIOD_W1, 0), iHigh(NULL, PERIOD_H4,
iHighest(NULL, PERIOD_H4, MODE_HIGH, 2, Li_4)));
so basically because the session is 8 hours and we are looking at a 4 hour resolution we only need to take the highest high an lowest low of 2 bars
we use the gmt offset to adjust the 0000-0800 session to Sydney open which is at 2100 during dst and at 2200 otherwize. (dst - spring foward, fall back)
keep in mind sydney is in the souther hemisphere so dst is oposite of when london and new york go into dst
  Parameters:
     oneWeekMillis (simple int) : a constant value
     showPsylevels (simple bool) : should psy levels be calculated
     psyType (simple string) : the type of Psylevels - crypto or forex
     sydDST (bool) : is Sydney in DST
@return  
 adrHiLo(length, barsBack, fromDO) 
  Parameters:
     length (simple int) : how many elements of the series to calculate on
     barsBack (simple int) : starting possition for the length calculation - current bar or some other value eg last bar
     fromDO (simple bool) : boolean flag, if false calculate traditional adr from high low of today, if true calcualte from exchange midnight
@return adr, adrLow and adrHigh  - the adr, the position of the adr High and adr Low with respect to price
 drawSessionHiloLite(sessXTime, showRectangleX, showLabelX, sessXcolLabel, sessXLabel, gmt, sessionLineStyle, sessXcol) 
  Parameters:
     sessXTime (simple string) : session string in the format 0000-0100:23456
     showRectangleX (simple bool) 
     showLabelX (simple bool) 
     sessXcolLabel (simple color) : the color to be used for the hi/low lines and label
     sessXLabel (simple string) : the session label text
     gmt (simple string) : the gmt offset string usually in the format GMT+1 or GMT+2 etc
     sessionLineStyle (simple string) : the line stile for the session high low lines
     sessXcol (simple color) : - the color for the box color that will color the session
@return void
 msToHmsString(ms) 
  converts milliseconds into an hh:mm string. For example, 61000 ms to '0:01:01'
  Parameters:
     ms (int) : - the milliseconds to convert to hh:mm
@return string - the converted hh:mm string
 countdownString(openToday, closeToday, showMarketsWeekends, oneDay) 
  that calculates how much time is left until the next session taking the session start and end times into account. Note this function does not work on intraday sessions.
  Parameters:
     openToday (int) : - timestamps of when the session opens in general - note its a series because the timestamp was created using the dst flag which is a series itself thus producing a timestamp series
     closeToday (int) : - timestamp of when the session closes in general - note its a series because the timestamp was created using the dst flag which is a series itself thus producing a timestamp series
@return a countdown of when next the session opens or 'Open' if the session is open now
     showMarketsWeekends (simple bool) 
     oneDay (simple int) 
 countdownStringSyd(sydOpenToday, sydCloseToday, showMarketsWeekends, oneDay) 
  that calculates how much time is left until the next session taking the session start and end times into account. special case of intraday sessions like sydney
  Parameters:
     sydOpenToday (int) 
     sydCloseToday (int) 
     showMarketsWeekends (simple bool) 
     oneDay (simple int)
My auto dual avwap with Auto swing low/pivot low finderWelcome to My Auto Dual AVWAP with Auto Swing Low/Pivot Low Finder – an open-source TradingView indicator designed to enhance your technical analysis toolbox. This indicator is published under the Mozilla Public License 2.0 and is available for anyone to study, modify, and distribute.
Key Features
Auto Pivot/Swing Low Finder:
In addition to VWAP lines, the indicator incorporates an automatic detection mechanism for swing lows/pivot lows. This feature assists in identifying potential support areas and price reversals, further enhancing your trading strategy.
Dual VWAP Calculation with high/low range:
The indicator calculates two separate volume-weighted average price (VWAP) lines based on different price inputs (low and high prices) and defined time sessions. This allows traders to gain a more nuanced view of market activity during specific trading periods.
Customizable Time Sessions:
You can specify distinct start and end times for each VWAP calculation session. This flexibility helps you align the indicator with your preferred trading hours or market sessions, making it adaptable to various time zones and trading styles.
Easy to Customize:
With clear code structure and detailed comments, the script is designed to be accessible even for traders who want to customize or extend its functionality. Whether you're a seasoned coder or just starting out, the code is written with transparency in mind.
How It Works
Session Initialization:
The script sets up two distinct time sessions using user-defined start and end times. For each session, it detects the beginning of the trading period to reset cumulative values.
Cumulative Calculations:
During each session, the indicator accumulates the product of price and volume as well as the total volume. The VWAP is then computed as the ratio of these cumulative values.
Dual Data Sources:
Two separate data inputs (using low and high prices) are used to calculate two VWAP lines. This dual approach provides a broader perspective on market trends and can help in identifying dynamic support and resistance levels.
Visualization:
The calculated VWAP lines are plotted directly on your chart with distinct colors and thickness settings for easy visualization. This makes it simple to interpret the data at a glance.
Why Use This Indicator?
Whether you are a day trader, swing trader, or simply looking to refine your market analysis, My Auto Dual AVWAP with Auto Swing Low/Pivot Low Finder offers a robust set of features that can help you identify key price levels and improve your decision-making process. Its open-source nature invites collaboration and customization, ensuring that you can tailor it to fit your unique trading style.
Feel free to explore, modify, and share this indicator. Happy trading!
Overnight High/LowThe script identifies the Overnight High (the highest price) and Overnight Low (the lowest price) for a trading instrument during a specified overnight session. It then plots these levels on the chart for reference in subsequent trading sessions.
Key Features:
Time Settings:
The script defines the start (startHour) and end (endHour + endMinute) times for the overnight session.
The session spans across two calendar days, such as 5:00 PM (17:00) to 9:30 AM (09:30).
Tracking High and Low:
During the overnight session, the script dynamically tracks:
Overnight High: The highest price reached during the session.
Overnight Low: The lowest price reached during the session.
Reset Mechanism:
After the overnight session ends (at the specified end time), the script resets the overnightHigh and overnightLow variables, preparing for the next session.
Visual Representation:
The script uses horizontal dotted lines to plot:
A green line for the Overnight High.
A red line for the Overnight Low.
These lines extend to the right of the chart, providing visual reference points for traders.
How It Works:
Session Detection:
The script checks whether the current time falls within the overnight session:
If the hour is greater than or equal to the start hour (e.g., 17:00).
Or if the hour is less than or equal to the end hour (e.g., 09:30), considering the next day.
The end minute (e.g., 30 minutes past the hour) is also considered for precision.
High and Low Calculation:
During the overnight session:
If the overnightHigh is not yet defined, it initializes with the current candle's high.
If already defined, it updates by comparing the current candle's high to the existing overnightHigh using the math.max function.
Similarly, overnightLow is initialized or updated using the math.min function.
Post-Session Reset:
After the session ends, the script clears the overnightHigh and overnightLow variables by setting them to na (not available).
Line Drawing:
The script draws horizontal dotted lines for the Overnight High and Low during and after the session.
The lines extend indefinitely to the right of the chart.
Benefits:
Visual Aid: Helps traders quickly identify overnight support and resistance levels, which are critical for intraday trading.
Automation: Removes the need for manually plotting these levels each day.
Customizable: Time settings can be adjusted to match different markets or trading strategies.
This script is ideal for traders who use the overnight range as part of their analysis for breakouts, reversals, or trend continuation strategies.
chrono_utilsLibrary   "chrono_utils" 
Collection of objects and common functions that are related to datetime windows session days and time
ranges. The main purpose of this library is to handle time-related functionality and make it easy to reason about a
future bar checking if it will be part of a predefined session and/or inside a datetime window. All existing session
functionality I found in the documentation e.g. "not na(time(timeframe, session, timezone))" are not suitable for
strategy scripts, since the execution of the orders is delayed by one bar, due to the script execution happening at
the bar close. Moreover, a history operator with a negative value that looks forward is not allowed in any pinescript
expression. So, a prediction for the next bar using the bars_back argument of "time()"" and "time_close()" was
necessary. Thus, I created this library to overcome this small but very important limitation. In the meantime, I
added useful functionality to handle session-based behavior. An interesting utility that emerged from this
development is the data anomaly detection where a comparison between the prediction and the actual value is happening.
If those two values are different then a data inconsistency happened between the prediction bar and the actual bar
(probably due to a holiday, half session day, a timezone change etc..)
 exTimezone(timezone) 
  exTimezone - Convert extended timezone to timezone string
  Parameters:
     timezone (simple string) : - The timezone or a special string
  Returns: string representing the timezone
 nameOfDay(day) 
  nameOfDay - Convert the day id into a short nameOfDay
  Parameters:
     day (int) : - The day id to convert
  Returns: - The short name of the day
 today() 
  today - Get the day id of this day
  Returns: - The day id
 nthDayAfter(day, n) 
  nthDayAfter - Get the day id of n days after the given day
  Parameters:
     day (int) : - The day id of the reference day
     n (int) : - The number of days to go forward
  Returns: - The day id of the day that is n days after the reference day
 nextDayAfter(day) 
  nextDayAfter - Get the day id of next day after the given day
  Parameters:
     day (int) : - The day id of the reference day
  Returns: - The day id of the next day after the reference day
 nthDayBefore(day, n) 
  nthDayBefore - Get the day id of n days before the given day
  Parameters:
     day (int) : - The day id of the reference day
     n (int) : - The number of days to go forward
  Returns: - The day id of the day that is n days before the reference day
 prevDayBefore(day) 
  prevDayBefore - Get the day id of previous day before the given day
  Parameters:
     day (int) : - The day id of the reference day
  Returns: - The day id of the previous day before the reference day
 tomorrow() 
  tomorrow - Get the day id of the next day
  Returns: - The next day day id
 normalize(num, min, max) 
  normalizeHour - Check if number is inthe range of  
  Parameters:
     num (int) 
     min (int) 
     max (int) 
  Returns: - The normalized number
 normalizeHour(hourInDay) 
  normalizeHour - Check if hour is valid and return a noralized hour range from  
  Parameters:
     hourInDay (int) 
  Returns: - The normalized hour
 normalizeMinute(minuteInHour) 
  normalizeMinute - Check if minute is valid and return a noralized minute from  
  Parameters:
     minuteInHour (int) 
  Returns: - The normalized minute
 monthInMilliseconds(mon) 
  monthInMilliseconds - Calculate the miliseconds in one bar of the timeframe
  Parameters:
     mon (int) : - The month of reference to get the miliseconds
  Returns: - The number of milliseconds of the month
 barInMilliseconds() 
  barInMilliseconds - Calculate the miliseconds in one bar of the timeframe
  Returns: - The number of milliseconds in one bar
 method to_string(this) 
  to_string - Formats the time window into a human-readable string
  Namespace types: DateTimeWindow
  Parameters:
     this (DateTimeWindow) : - The time window object with the from and to datetimes
  Returns: - The string of the time window
 method to_string(this) 
  to_string - Formats the session days into a human-readable string with short day names
  Namespace types: SessionDays
  Parameters:
     this (SessionDays) : - The session days object with the day selection
  Returns: - The string of the session day short names
 method to_string(this) 
  to_string - Formats the session time into a human-readable string
  Namespace types: SessionTime
  Parameters:
     this (SessionTime) : - The session time object with the hour and minute of the time of the day
  Returns: - The string of the session time
 method to_string(this) 
  to_string - Formats the session time into a human-readable string
  Namespace types: SessionTimeRange
  Parameters:
     this (SessionTimeRange) : - The session time range object with the start and end time of the daily session
  Returns: - The string of the session time
 method to_string(this) 
  to_string - Formats the session into a human-readable string
  Namespace types: Session
  Parameters:
     this (Session) : - The session object with the day and the time range selection
  Returns: - The string of the session
 method init(this, fromDateTime, toDateTime) 
  init - Initialize the time window object from boolean values of each session day
  Namespace types: DateTimeWindow
  Parameters:
     this (DateTimeWindow) : - The time window object that will hold the from and to datetimes
     fromDateTime (int) : - The starting datetime of the time window
     toDateTime (int) : - The ending datetime of the time window
  Returns: - The time window object
 method init(this, refTimezone, chTimezone, fromDateTime, toDateTime) 
  init - Initialize the time window object from boolean values of each session day
  Namespace types: DateTimeWindow
  Parameters:
     this (DateTimeWindow) : - The time window object that will hold the from and to datetimes
     refTimezone (simple string) : - The timezone of reference of the 'from' and 'to' dates
     chTimezone (simple string) : - The target timezone to convert the 'from' and 'to' dates
     fromDateTime (int) : - The starting datetime of the time window
     toDateTime (int) : - The ending datetime of the time window
  Returns: - The time window object
 method init(this, sun, mon, tue, wed, thu, fri, sat) 
  init - Initialize the session days object from boolean values of each session day
  Namespace types: SessionDays
  Parameters:
     this (SessionDays) : - The session days object that will hold the day selection
     sun (bool) : - Is Sunday a trading day?
     mon (bool) : - Is Monday a trading day?
     tue (bool) : - Is Tuesday a trading day?
     wed (bool) : - Is Wednesday a trading day?
     thu (bool) : - Is Thursday a trading day?
     fri (bool) : - Is Friday a trading day?
     sat (bool) : - Is Saturday a trading day?
  Returns: - The session days object
 method init(this, unixTime) 
  init - Initialize the object from the hour and minute of the session time in exchange timezone (syminfo.timezone)
  Namespace types: SessionTime
  Parameters:
     this (SessionTime) : - The session time object with the hour and minute of the time of the day
     unixTime (int) : - The unix time
  Returns: - The session time object
 method init(this, hourInDay, minuteInHour) 
  init - Initialize the object from the hour and minute of the session time in exchange timezone (syminfo.timezone)
  Namespace types: SessionTime
  Parameters:
     this (SessionTime) : - The session time object with the hour and minute of the time of the day
     hourInDay (int) : - The hour of the time
     minuteInHour (int) : - The minute of the time
  Returns: - The session time object
 method init(this, hourInDay, minuteInHour, refTimezone) 
  init - Initialize the object from the hour and minute of the session time
  Namespace types: SessionTime
  Parameters:
     this (SessionTime) : - The session time object with the hour and minute of the time of the day
     hourInDay (int) : - The hour of the time
     minuteInHour (int) : - The minute of the time
     refTimezone (string) : - The timezone of reference of the 'hour' and 'minute'
  Returns: - The session time object
 method init(this, startTime, endTime) 
  init - Initialize the object from the start and end session time in exchange timezone (syminfo.timezone)
  Namespace types: SessionTimeRange
  Parameters:
     this (SessionTimeRange) : - The session time range object that will hold the start and end time of the daily session
     startTime (SessionTime) : - The time the session begins
     endTime (SessionTime) : - The time the session ends
  Returns: - The session time range object
 method init(this, startTimeHour, startTimeMinute, endTimeHour, endTimeMinute, refTimezone) 
  init - Initialize the object from the start and end session time
  Namespace types: SessionTimeRange
  Parameters:
     this (SessionTimeRange) : - The session time range object that will hold the start and end time of the daily session
     startTimeHour (int) : - The time hour the session begins
     startTimeMinute (int) : - The time minute the session begins
     endTimeHour (int) : - The time hour the session ends
     endTimeMinute (int) : - The time minute the session ends
     refTimezone (string) 
  Returns: - The session time range object
 method init(this, days, timeRanges) 
  init - Initialize the session object from session days and time range
  Namespace types: Session
  Parameters:
     this (Session) : - The session object that will hold the day and the time range selection
     days (SessionDays) : - The session days object that defines the days the session is happening
     timeRanges (array) : - The array of all the session time ranges during a session day
  Returns: - The session object
 method init(this, days, timeRanges, names, colors) 
  init - Initialize the session object from session days and time range
  Namespace types: SessionView
  Parameters:
     this (SessionView) : - The session view object that will hold the session, the names and the color selections
     days (SessionDays) : - The session days object that defines the days the session is happening
     timeRanges (array) : - The array of all the session time ranges during a session day
     names (array) : - The array of the names of the sessions
     colors (array) : - The array of the colors of the sessions
  Returns: - The session object
 method get_size_in_secs(this) 
  get_size_in_secs - Count the seconds from start to end in the given timeframe
  Namespace types: DateTimeWindow
  Parameters:
     this (DateTimeWindow) : - The time window object with the from and to datetimes
  Returns: - The number of seconds inside the time widow for the given timeframe
 method get_size_in_secs(this) 
  get_size_in_secs - Calculate the seconds inside the session
  Namespace types: SessionTimeRange
  Parameters:
     this (SessionTimeRange) : - The session time range object with the start and end time of the daily session
  Returns: - The number of seconds inside the session
 method get_size_in_bars(this) 
  get_size_in_bars - Count the bars from start to end in the given timeframe
  Namespace types: DateTimeWindow
  Parameters:
     this (DateTimeWindow) : - The time window object with the from and to datetimes
  Returns: - The number of bars inside the time widow for the given timeframe
 method get_size_in_bars(this) 
  get_size_in_bars - Calculate the bars inside the session
  Namespace types: SessionTimeRange
  Parameters:
     this (SessionTimeRange) : - The session time range object with the start and end time of the daily session
  Returns: - The number of bars inside the session for the given timeframe
 method is_bar_included(this, offset_forward) 
  is_bar_included - Check if the given bar is between the start and end dates of the window
  Namespace types: DateTimeWindow
  Parameters:
     this (DateTimeWindow) : - The time window object with the from and to datetimes
     offset_forward (simple int) : - The number of bars forward. Default is 1
  Returns: - Whether the current bar is inside the datetime window
 method is_bar_included(this, offset_forward) 
  is_bar_included - Check if the given bar is inside the session as defined by the input params (what "not na(time(timeframe.period, this.to_sess_string()) )" should return if you could write it
  Namespace types: Session
  Parameters:
     this (Session) : - The session with the day and the time range selection
     offset_forward (simple int) : - The bar forward to check if it is between the from and to datetimes. Default is 1
  Returns: - Whether the current time is inside the session
 method to_sess_string(this) 
  to_sess_string - Formats the session days into a session string with day ids
  Namespace types: SessionDays
  Parameters:
     this (SessionDays) : - The session days object
  Returns: - The string of the session day ids
 method to_sess_string(this) 
  to_sess_string - Formats the session time into a session string
  Namespace types: SessionTime
  Parameters:
     this (SessionTime) : - The session time object with the hour and minute of the time of the day
  Returns: - The string of the session time
 method to_sess_string(this) 
  to_sess_string - Formats the session time into a session string
  Namespace types: SessionTimeRange
  Parameters:
     this (SessionTimeRange) : - The session time range object with the start and end time of the daily session
  Returns: - The string of the session time
 method to_sess_string(this) 
  to_sess_string - Formats the session into a session string
  Namespace types: Session
  Parameters:
     this (Session) : - The session object with the day and the time range selection
  Returns: - The string of the session
 method from_sess_string(this, sess) 
  from_sess_string - Initialize the session days object from the session string
  Namespace types: SessionDays
  Parameters:
     this (SessionDays) : - The session days object that will hold the day selection
     sess (string) : - The session string part that represents the days  
  Returns: - The session days object
 method from_sess_string(this, sess) 
  from_sess_string - Initialize the session time object from the session string in exchange timezone (syminfo.timezone)
  Namespace types: SessionTime
  Parameters:
     this (SessionTime) : - The session time object that will hold the hour and minute of the time
     sess (string) : - The session string part that represents the time HHmm
  Returns: - The session time object
 method from_sess_string(this, sess, refTimezone) 
  from_sess_string - Initialize the session time object from the session string
  Namespace types: SessionTime
  Parameters:
     this (SessionTime) : - The session time object that will hold the hour and minute of the time
     sess (string) : - The session string part that represents the time HHmm
     refTimezone (simple string) : - The timezone of reference of the 'hour' and 'minute'
  Returns: - The session time object
 method from_sess_string(this, sess) 
  from_sess_string - Initialize the session time range object from the session string in exchange timezone (syminfo.timezone)
  Namespace types: SessionTimeRange
  Parameters:
     this (SessionTimeRange) : - The session time range object that will hold the start and end time of the daily session
     sess (string) : - The session string part that represents the time range HHmm-HHmm
  Returns: - The session time range object
 method from_sess_string(this, sess, refTimezone) 
  from_sess_string - Initialize the session time range object from the session string
  Namespace types: SessionTimeRange
  Parameters:
     this (SessionTimeRange) : - The session time range object that will hold the start and end time of the daily session
     sess (string) : - The session string part that represents the time range HHmm-HHmm
     refTimezone (simple string) : - The timezone of reference of the time ranges
  Returns: - The session time range object
 method from_sess_string(this, sess) 
  from_sess_string - Initialize the session object from the session string in exchange timezone (syminfo.timezone)
  Namespace types: Session
  Parameters:
     this (Session) : - The session object that will hold the day and the time range selection
     sess (string) : - The session string that represents the session HHmm-HHmm,HHmm-HHmm:ddddddd
  Returns: - The session time range object
 method from_sess_string(this, sess, refTimezone) 
  from_sess_string - Initialize the session object from the session string
  Namespace types: Session
  Parameters:
     this (Session) : - The session object that will hold the day and the time range selection
     sess (string) : - The session string that represents the session HHmm-HHmm,HHmm-HHmm:ddddddd
     refTimezone (simple string) : - The timezone of reference of the time ranges
  Returns: - The session time range object
 method nth_day_after(this, day, n) 
  nth_day_after - The nth day after the given day that is a session day (true) in the object
  Namespace types: SessionDays
  Parameters:
     this (SessionDays) : - The session days object with the day selection
     day (int) : - The day id of the reference day
     n (int) : - The number of days after
  Returns: - The day id of the nth session day of the week after the given day
 method nth_day_before(this, day, n) 
  nth_day_before - The nth day before the given day that is a session day (true) in the object
  Namespace types: SessionDays
  Parameters:
     this (SessionDays) : - The session days object with the day selection
     day (int) : - The day id of the reference day
     n (int) : - The number of days after
  Returns: - The day id of the nth session day of the week before the given day
 method next_day(this) 
  next_day - The next day that is a session day (true) in the object
  Namespace types: SessionDays
  Parameters:
     this (SessionDays) : - The session days object with the day selection
  Returns: - The day id of the next session day of the week
 method previous_day(this) 
  previous_day - The previous day that is session day (true) in the object
  Namespace types: SessionDays
  Parameters:
     this (SessionDays) : - The session days object with the day selection
  Returns: - The day id of the previous session day of the week
 method get_sec_in_day(this) 
  get_sec_in_day - Count the seconds since the start of the day this session time represents
  Namespace types: SessionTime
  Parameters:
     this (SessionTime) : - The session time object with the hour and minute of the time of the day
  Returns: - The number of seconds passed from the start of the day until that session time
 method get_ms_in_day(this) 
  get_ms_in_day - Count the milliseconds since the start of the day this session time represents
  Namespace types: SessionTime
  Parameters:
     this (SessionTime) : - The session time object with the hour and minute of the time of the day
  Returns: - The number of milliseconds passed from the start of the day until that session time
 method is_day_included(this, day) 
  is_day_included - Check if the given day is inside the session days
  Namespace types: SessionDays
  Parameters:
     this (SessionDays) : - The session days object with the day selection
     day (int) : - The day to check if it is a trading day
  Returns: - Whether the current day is included in the session days
 DateTimeWindow 
  DateTimeWindow - Object that represents a datetime window with a beginning and an end
  Fields:
     fromDateTime (series int) : - The beginning of the datetime window
     toDateTime (series int) : - The end of the datetime window
 SessionDays 
  SessionDays - Object that represent the trading days of the week
  Fields:
     days (map) : - The map that contains all days of the week and their session flag
 SessionTime 
  SessionTime - Object that represents the time (hour and minutes)
  Fields:
     hourInDay (series int) : - The hour of the day that ranges from 0 to 24
     minuteInHour (series int) : - The minute of the hour that ranges from 0 to 59
     minuteInDay (series int) : - The minute of the day that ranges from 0 to 1440. They will be calculated based on hourInDay and minuteInHour when method is called
 SessionTimeRange 
  SessionTimeRange - Object that represents a range that extends from the start to the end time
  Fields:
     startTime (SessionTime) : - The beginning of the time range
     endTime (SessionTime) : - The end of the time range
     isOvernight (series bool) : - Whether or not this is an overnight time range
 Session 
  Session - Object that represents a session
  Fields:
     days (SessionDays) : - The map of the trading days
     timeRanges (array) : - The array with all time ranges of the session during the trading days
 SessionView 
  SessionView - Object that visualize a session
  Fields:
     sess (Session) : - The Session object to be visualized
     names (array) : - The names of the session time ranges
     colors (array) : - The colors of the session time ranges






















