FlowScope [Hapharmonic]FlowScope: Uncover the Market's True Intent  🔬
  
Ever wished you could look  inside  the candles and see where the real action is happening? FlowScope is your microscope for the market's flow, designed to give you a powerful edge by revealing the volume distribution that price action alone can't show you.
Instead of just looking at the open, high, low, and close, FlowScope lets you dive deeper into the market's auction process. It groups candles together and builds a detailed  Volume Profile  for that period, showing you exactly  where  the trading happened and revealing the story behind the price action.
Let's explore how you can use it to gain a powerful new edge.
 🧐 Core Concept: How It Works 
At its heart, FlowScope does three key things:
 
   It Groups Candles:  You decide how many candles to group together. For example, setting " Group Candles " to 4 on a 5-minute chart effectively gives you a detailed 20-minute candle and profile. This helps you see the bigger picture and filter out market noise.
   It Builds a Volume Profile:  For each group, FlowScope analyzes the volume at every single price level. It then displays this as a horizontal histogram (we call this a "footprint" or profile). Longer bars mean more volume was traded at that price, indicating a "fair" price or an area of acceptance. Shorter bars mean price moved through quickly, indicating rejection.
   It Creates a Custom "Grouped Candle":  To summarize the group's overall price action, FlowScope draws a single, custom candle representing the entire group's:
     
       Open:  The open of the  first  candle in the group.
       High:  The absolute  highest price  reached within the group.
       Low:  The absolute  lowest price  reached within the group.
       Close:  The close of the  last  candle in the group.
     
This gives you a crystal-clear view of the group's net result, free from the back-and-forth noise of the individual candles inside it.
 
Below are some of the stunning preset color palettes you can choose from to customize your view:
  
  
  
  
  
  
  
  
  
  
 🚀 How to Use: Practical Applications 
FlowScope isn't just for looking pretty; it's a powerful analysis tool. Here are a few ways to integrate it into your trading:
 
   Identify High-Volume Nodes (HVNs):  Look for the longest bars in the profile. These are price levels where the market spent the most time and traded the most volume. HVNs often act as powerful "magnets" for price, becoming key areas of support and resistance.
   Spot Low-Volume Nodes (LVNs):  These are areas with very short bars or gaps in the profile. They represent price levels that the market moved through quickly and inefficiently. If price returns to an LVN, it's likely to move through it quickly again.
   Analyze the Summary Box:  This is where the real magic happens! ✨
     
       Total Volume (Σ):  The total volume for the entire group.
       Buy (B) vs. Sell (S) Volume:  FlowScope analyzes the lower timeframe action to estimate the buying and selling pressure that made up the total volume. Is a big red candle mostly aggressive selling, or was it just a lack of buyers? The B/S data gives you clues. A high-volume candle with nearly 50/50 buy/sell pressure might indicate absorption or a potential reversal.
     
   Use the Grouped Candle for Clarity:  Is the market in a clear uptrend, or is it just choppy? The grouped candle can give you a much clearer signal. A series of strong, green grouped candles shows much more conviction than a mix of small green and red candles.
 
 ⚙️ Settings & Customization 
This is where you can truly make FlowScope your own. Let's walk through each setting.
     Profile Settings 
     
       Group Candles:  The number of standard chart candles you want to combine into a single FlowScope profile. A setting of  1  will analyze every single bar. A higher number gives you a broader market view. When Group Candles is set to 5, the data from the 5 individual candles are combined, and the volume is calculated accordingly.
      
       Max Profile Boxes:  This setting is more than just a number; it's a smart limit that ensures your profiles are always readable and relevant to the current market conditions.
         
           Adaptive Sizing (The Ideal Goal):  FlowScope first tries to create the  perfect  profile by making each volume box's height proportional to the current market volatility. It calculates an "ideal" box height based on the Average True Range ( ATR / 10 ). This is powerful because it automatically adapts: you get smaller, more detailed boxes in quiet, low-volatility markets, and larger, clearer boxes in volatile, fast-moving markets.
           The Safety Cap (Your Setting):  However, what if you group several candles during a massive price move? The price range could be huge! If we only used the small, ATR-based box height, you might end up with hundreds of tiny, unreadable boxes. This is where your  Max Profile Boxes  setting (defaulting to 50) comes in. It acts as a  maximum detail cap . If the adaptive, volatility-based calculation determines that it would need  more  boxes than your setting (e.g., more than 50), the indicator will override it. It will then simply divide the entire price range of the group into exactly the number of boxes you specified (e.g., 50).
         
     In short: You are setting the maximum allowable detail. FlowScope intelligently adapts the profile's granularity below that limit based on market volatility, ensuring you always get a clear and meaningful picture. 
     
     Style 
     
       Show Profile BG:  A simple toggle to show or hide the faint background color behind the volume bars. Turning it off can create a cleaner look.
       Color Mode:  This dropdown controls how the volume profile text is colored.
         
           Custom Gradient:  This mode uses the three custom colors you select in the "Profile Colors" section to create a beautiful gradient across the profile.
           Candle Color:  This mode colors the profile based on whether the grouped candle was bullish (green) or bearish (red). The color will be a gradient, with the most intense color applied to the box with the highest volume; the colors of the other boxes will fade out from that point. It's a great way to see the profile's "mood" at a glance.
         
          
     
     Profile Colors  🎨
     
       Use Preset Palette:  This is the master switch!
         
           If checked:  You can choose from 10 stunning, pre-designed color palettes from the  Palette  dropdown. The custom color pickers below will be disabled.
           If unchecked (Default):  The  Palette  dropdown will be disabled, and you can now choose your own three colors for the gradient.
         
       Palette:   (Only active when "Use Preset Palette" is checked) . Choose from 10 luxurious, eye-catching color schemes like "Solar Flare" or "Deep Space" to instantly change the look and feel of your chart.
       Low Price / Mid Price / High Price:   (Only active when "Use Preset Palette" is unchecked) . These three color pickers allow you to design your own unique gradient for the  Custom Gradient  color mode.
     
     Candle Display 
     
     These settings control the custom "Grouped Candle" that summarizes the profile. When using the "Show Custom Candle" feature, you should change the chart's candlestick display to Bars for a cleaner view.
      
       Show Custom Candle:  This is the main toggle. When you check this box, the original chart candles will be hidden, and your custom FlowScope candle will be displayed instead. This custom candle is intentionally small to ensure it does not visually overlap with the volume profile boxes.
      
       Show Body:   (Only active when "Show Custom Candle" is checked) . Toggles the visibility of the candle's body.
       Wick Width & Body Width:   (Only active when "Show Custom Candle" is checked) . These sliders let you control the thickness of the wick and body lines to match your personal style.
       Up Color / Down Color:   (Only active when "Show Custom Candle" is checked) . Choose the colors for your bullish and bearish custom candles.
     
Experiment with the settings, find a style that works for you, and start seeing the market in a whole new light.
Happy trading! 📈😊
Intrabar
Internal Candle Strength [LuxAlgo]The  Internal Candle Strength  tool allows traders to divide each chart bar into multiple rows of custom size and inspect the strength of the lower timeframes trends located within each row. 
This tool effectively helps traders in identifying the power dynamic between bulls and bears within multiple areas within each bar, providing the ability to conduct LTF analysis.
🔶  USAGE 
  
The strength displayed within each row ranges from 0% to 100%, with 0% being the most bearish and 100% being the most bullish.
Traders should be aware of the extreme probabilities located at the higher/lower end of the bars, as this can signal a change in strength and price direction.
  
Traders can select the lower timeframe to pull the data from or the row size in the scale of the chart. Selecting a lower timeframe will provide more data to evaluate an area's strength.
Do note that only a timeframe lower than the chart timeframe should be selected.
🔹  Row Size 
  
Selecting a smaller row size will increase the number of rows per bar, allowing for a more detailed analysis. A lower value will also generally mean that less data will be considered when calculating the strength of a specific area.
As we can see on the chart above (all BTCUSD 30m), by selecting a different row size, traders can control how many rows are displayed per bar.
🔶  SETTINGS 
 
 Timeframe: Lower timeframe used to calculate the candle strength.
 Row Size: Size of each row on the chart scale, expressed as a fraction of the candle range.
Timeframe LoopThe  Timeframe Loop  publication aims to visualize intrabar price progression in a new, different way.
  
🔶  CONCEPTS and USAGE 
I got inspiration from the Pressure/Volume loop, which is used in Mechanical Ventilation with Critical Care patients to visualize pressure/volume evolution during inhalation/exhalation.
  
The main idea is that intrabar prices are visualized by a loop, going to the right during the first half and returning to the left towards its closing point. Here, the main chart timeframe (CTF) is 4 hours, and we see the movements of eight 30-minute lower timeframe (LTF) periods, highlighted by four yellow dots/lines (first 2 hours -> "Right") and four blue dots/lines (last 2 hours <- "Left"):
  
🔹  BTF 
If "Show Lowest TF" is enabled, the LTF is split into another lower TF (BTF - "Base TF"); in this case, the 30-minute LTF is split into 10 parts of 3 minutes (BTF):
  
Enabling "Loop Lowest TF" will enable the BTF to react similarly to the largest loop; from halfway, it will return to its startpoint:
  
Here is a more detailed example:
  
🔹  Mini-Candles 
The included option "Mini-Candles" will bring even more detail, showing the LTF as Japanese candlesticks with user-defined colors and adjustable body width; in this example, the mini-candles associated with the first half (yellow lines/dots) are green/red, while blue/fuchsia in the second half (blue lines/dots):
CTF 10 minutes, LTF 1 minute, BTF 5 seconds
  
One can see the detailed intrabar price progression in one glance.
CTF 5 minutes, LTF 1 minute, BTF 5 seconds
  
If the LTF/BTF ratio, divided by two, results in a non-integer number, the right side will be a vertical line instead of just a turning point. In that case, the smaller, most right blue loop will be situated at the right of that line.
 
 10 minutes / 1 minute = 10 -> 10 / 2 =    5 parts
     5 minutes / 1 minute =   5 ->   5 / 2 = 2.5 parts
 
🔶  SETTINGS 
🔹  Timeframes 
 
 Lower Timeframe 1
 Lower Timeframe 2
 
No need to worry about the order of both timeframes; BTF will be the lowest TF of the 2, LTF the highest; both have to be lower than the main chart TF (CTF); otherwise, it will result in the error: "`Lower Timeframes` should be lower than current chart timeframe".
  
The ratio LTF / BTF should be equal or higher than 2; otherwise, this error will show: "`Lower Timeframe` should minimally be twice the `Base (smallest) Timeframe`"
Lastly, the ratio CTF / BTF should be lower than 500; otherwise, this error will pop up: "`Current Chart timeframe` / `Lower Timeframe` should be less than 500."
I have tried to capture runtime errors as best I could. If one should be triggered (red exclamation mark next to the title), it is best to increase the lowest TF.
🔹  Options 
 
 Show Lowest TF: Show BTF progression.
 Loop Lowest TF: Enabling will let the BTF line return halfway.
 Show Mini-Candles
 Show Steps
 
"Show Steps" can be useful to see how the script works, where the location of the current price is compared against the position of the left (L) and right (R) labels:
  
🔹  Style 
  
Intrabar Volume Distribution [BigBeluga]Intrabar Volume Distribution   is an advanced volume and order flow indicator that visualizes the buy and sell volume distribution within each candlestick.
🔔  Before Use:   
 
  Turn off the background color of your candles for clear visibility.  
  
  Overlay the indicator on the top layout to ensure accurate alignment with the price chart.  
 
🔵 Key Features: 
 Inside Bar Volume Visualization:   
 
     Each candlestick is divided into two columns:  
       
           Left column displays the sell % volume amount.  
           Right column displays the buy % volume amount.  
       
  
     Provides a clear representation of buyer-seller activity within individual bars.  
 
 Percentage Volume Labels:   
 
     Labels above each bar show the percentage share of sell and buy volume relative to the total (100%).  
  
     Quickly assess market sentiment and volume imbalances.  
 
 Point of Control (POC) Levels:   
 
     Orange dashed lines mark the POC inside each bar, indicating the price level with the highest traded volume.  
  
     Helps identify key liquidity zones within individual candlesticks.  
 
 Multi-Timeframe Volume Analysis:   
 
     The indicator automatically uses a timeframe 20-30 times lower than the current one to gather detailed volume data.  
     For each higher timeframe candle, it collects 20-30 bars of lower timeframe data for precise volume mapping.  
     Each bar is divided into 100 volume bins to capture detailed volume distribution across the price range.  
  
     Bins are filled based on the aggregated volume from the lower timeframe data.  
 
 Lookback Period:   
 
     Allows traders to select how many bars to display with delta and volume information.  
     The beginning of the selected lookback period is marked with a gray line and label for quick reference.  
  
     Indicator displays up to 80 bars back
  
 
🔵 Usage:   
 
 Order Flow Analysis:  Monitor buy/sell volume distribution to spot potential reversals or continuations.  
 Liquidity Identification:  Use POC levels to locate areas of strong market interest and potential support/resistance.  
 Volume Imbalance Detection:  Pay attention to percentage labels for quick recognition of buyer or seller dominance.  
 Scalping & Intraday Trading:  Ideal for traders seeking real-time insight into order flow and volume behavior.  
 Historical Analysis:  Adjust the lookback period to analyze past price action and volume activity.  
 
 Intrabar Volume Distribution   is a powerful tool for traders aiming to gain deeper insight into market sentiment through detailed volume analysis, allowing for more informed trading decisions based on real-time order flow dynamics.
Intrabar BoxPlotThe  Intrabar BoxPlot  publication highlights an uncommon technique by displaying statistical intrabar  Lower Timeframe (LTF)  values on the chart.
🔶  USAGE 
  
🔹  Middle 50% Boxes 
By showing the middle 50% intrabar values through a box, we can more easily see where the intrabar activity is mainly situated.
The middle 50% intrabar values are referred to from here on as  Interquartile range  (IQR). 
In this example, the successive IQRs form a channel where the price eventually breaks out.
  
Disproportionately distributed values can give insights which can be used to find potential support/resistance areas.
  
IQR gaps can give valuable information as well. Potentially, the price can return to these gaps.
  
Seeing the IQR areas against regular candles gives an alternative image of the underlying price movements.
  
🔹  Highest volume Price level 
The script displays the price level with the highest volume situated, dependable on the user's source setting. Setting the source at 'close' will only display intrabar close values; the same goes for high, low, ... 
As seen in the above example, the volume levels can aid in finding support/resistance.
🔹  Median 
The location of the median off all intrabar values is displayed as a coloured dot: green when the close price is higher than the opening price and red if otherwise. The median can give valuable insights into price movements.
  
🔹  Outliers 
Medium (white dots) and extreme (white X) outliers, in combination with the IQR box, can help identify potential areas of interest.
  
🔹  Volume Delta 
  
When there is a discrepancy between the delta volume and direction of the candle, this will be displayed as follows:
 
 Green candle: when the sum of the volume of red intrabars is higher than the sum of the volume of green intrabars, the candle will be coloured orange.
 Red candle: when the sum of the volume of green intrabars is higher than the sum of the volume of red intrabars, the candle will be coloured blue.
 
🔹  Highlight Boxplot only 
Probably the easiest way to display boxplot only is by changing the  Bar's style  to  Bars .
  
🔶  DETAILS 
All intrabar values (Lower TimeFrame - LTF) are sorted and evaluated. Values can be  close ,  high ,  low , ... by selecting this in  Settings  ( source ).
The middle 50% of all values are displayed as a box; this contains the values between percentile 25 (p25) and percentile 75 (p75). The value of percentile rank 75 means 75% of all values are lower. The value of percentile rank 25 means 25% of all values are lower, or 75% is higher.
  
The difference between p75 and p25 is also known as  Interquartile range  (IQR) 
 IQR  is used to check for outliers. 
  
Wiki:  Boxplot ,  Interquartile range
 
 
 Extreme high: maximum value, higher than  p75 + IQR*3 
 Max outlier high: maximum value, higher than  p75 + IQR*1.5  but lower than  p75 + IQR*3 
 Max: maximum value, lower than  p75 + IQR*1.5 
 Min: minimum value, higher than  p25 - IQR*1.5 
 Min outlier low: minimum value, lower than  p25 - IQR*1.5  but higher than  p25 - IQR*3 
 Extreme low: minimum value, lower than  p25 - IQR*3 
 
  
Max and min must not be interpreted with the current candle high/low.
🔹  Example: Length of chart-puppets 
The following example can make it easier to digest. Forty  "chart-puppets"  are sorted by their length.
  
 
 The p25 value is   97
 The p50 value is 120
 The p75 value is 149
 
 
 75% of all  "chart-puppets"  are smaller than p75, and 25% is larger than p75.
 50% of all  "chart-puppets"  are smaller than p50, and 50% is larger than p50 (= median).
 25% of all  "chart-puppets"  are smaller than p25, and 75% is larger than p25.
 
IQR = 149 - 97 = 52
Extreme outlier limit max: p75 + IQR*3 = 149 + 52*3 = 305
Mild outlier limit max: p75 + IQR*1.5 = 149 + 52*1.5 = 227
Mild outlier limit min: p25 - IQR*1.5 = 97 - 52*1.5 = 19
Extreme outlier limit min: p25 - IQR*3 = 97 - 52*3 = -59
In this example there are no outliers to be found, all values are located between  p25 - IQR*1.5  (19) and  p75 + IQR*1.5.  (227)
🔹  Source settings 
Note that results are dependable on the chosen source (settings). When, for example,  close  is chosen as the source, only intrabar  close  prices are included. This means a  low  or  high  can stretch further then the min or max.
  
Here we can see different results with different source settings
  
🔹  LTF settings 
When 'Auto' is enabled (Settings, LTF), the LTF will be the nearest possible x times smaller TF than the current TF. When 'Premium' is disabled, the minimum TF will always be 1 minute to ensure TradingView plans lower than Premium don't get an error.
Examples with current  Daily  TF (when Premium is enabled):
 
 500 : 3 minute LTF
 1500 (default): 1 minute LTF
 5000: 30 seconds LTF (1 minute if Premium is disabled)
 
🔶  SETTINGS 
 
 Source: Set source at close, high, low,...
 
🔹  LTF 
 
 LTF: LTF setting
 Auto + multiple: Adjusts the initial set LTF
 Premium: Enable when your TradingView plan is Premium or higher
 
🔹  Intrabar Delta : Colors, dependable on different circumstances.
 
 Up: Price goes up, with more bullish than bearish intrabar volume.
 Up-: Price goes up, with more bearish than bullish intrabar volume.
 Down: Price goes down, with more bearish than bullish intrabar volume.
 Down+: Price goes down, with more bullish than bearish intrabar volume.
 
🔹  Table 
 
 Show table: Show details at the top right corner
 Show TF: Show LTF at the bottom right corner
 Text color/table size
 
See  DETAILS  for more information
Market Structure (Intrabar) [LuxAlgo]The  Market Structure (Intrabar)  indicator is designed to automatically detect and highlight real-time intrabar market structures, a core component of the Smart Money Concepts methodology.
 🔶 USAGE 
  
The proposed indicator gives a detailed picture of the most recent candle lower timeframe trends, highlighting market structures within them. 
This can be particularly useful to assess the price dynamic within the most recent candle. For example, we can see how pronounced a trend is by the number of opposite bullish/bearish market structures formed within the candle.
Users can select the intrabar timeframe of interest from the "Intrabar Timeframe" setting, using a timeframe significantly lower than the chart timeframe will return more intrabar candles and potentially more market structures.
 🔹 Dashboard 
  
Users have access to a dashboard returning useful statistics such as the number of formed CHoCH's and BOS's from the intrabar prices. These can be indicative of how predominant a trend is within the intrabar data or if there exist multiple trends.
 🔶 DETAILS 
  
Market structures allow determining trend continuations as well as trend reversals in the market through two distinct structures:
 🔹 Change of Character (CHoCH) 
A change of character (CHoCH) refers to a shift in the market behavior of a security that is driven by changes in the underlying supply and demand dynamics. CHoCH's are indicative of confirmed reversals.
 🔹 Break of Structure (BoS) 
The break of structure (BoS) refers to the point at which a key level of support or resistance is broken. BOS's are indicative of confirmed trend continuations.
 🔶 SETTINGS 
 🔹Inside the Bar Market Structure 
 
 Intrabar Timeframe: Lower timeframe setting option, if set to 'Auto' the script will determine the lower timeframe based on the chart timeframe.   
 Intrabar Market Structure, Length: Toggles the visibility of the break of structures and change of characters. Length defines the detection length of the swing levels.
 Intrabar Swing Levels: Toggles the visibility of the swing levels, including a color customization option for highs and lows.
 Intrabar Statistics: Toggles the visibility of the dashboard. Some further statistical details are presented in the tooltips of the table cells
 
 🔹 General 
 
 Market Structure Colors: Color customization option for the break of structure and change of character lines and labels.
 Intrabar Candle Colors: Color customization option for intrabar candles.
 Intrabar Candles Horizontal Offset: Adjusting the intrabar candles horizontal position
 Dashboard: Dashboard position and size customization option 
 
 🔶 LIMITATIONS 
Please note that seconds-based intervals are available for premium and professional plan holders, which implies that the seconds-based intervals usage of the indicator may not be available for all users depending on their subscription plan. 
 🔶 RELATED SCRIPTS 
 Smart-Money-Concepts 
 ICT-Concepts
Intrabar Analyzer [Kioseff Trading]Hello!
This indicator (Intrabar Analyzer) presents intrabar data in various derivative forms.
 On-Chart Features 
 
 Traditional price data down to 1 min.
 Heikin-Ashi price data down to 1 min.
 Kagi price data down to 1 min.
 Point & Figure price data down to 1 min.
 Renko price data down to 1 min.
 Linebreak price data down to 1 min.
 LinReg channel
 SMA
 EMA
 ALMA
 Echomorphic Average (A @kaigouthro special!)
 HMA
 RMA
 WMA
 VWMA
 VWAP
 SWMA
 SAR
 Supertrend
 On-Chart Features 
 
 Price x Volume graph
 Intrabar technical rating
 Positive volume index
 Negative volume index
 Price volume trend
 RSI
 %k
 ROC
 MFI
 MFC
 OBV
 CCI
 BBW
 CMO
 COG
 KCW
 MOM
 RANGE
 %r
Let's look at the objects populated by the indicator!
  
The image above shows what data correlates to the populated graphs!
Let's dial in on the  price x volume  graph.
  
The image above provides an example/explanation of the price x volume graph. All data is sourced from a lower timeframe (configurable - default = 1 minute).
Colors are configurable; the plot characters are configurable.
  
The numbers above show an alternative view of the price x volume graph!
 Price graph 
The price graph can populate 6 variations of price data: traditional, heikin-ashi, renko, point & figure, line break, and kagi.
The subsequent images will show all available forms of price data, in addition to a randomly selected, on-chart technical indicator!
 Kagi + LinReg 
  
 Traditional + EMA 
  
 Renko + SAR 
  
 Point & Figure + ALMA 
  
 Heikin-Ashi + Supertrend 
  
 Line Break + VWAP 
  
You can display up to three indicators concomitantly - all calculated using intrabar data! 
  
Lastly, the indicator displays the TradingView calculated technical rating for the intrabar.
The technical ratings are multiplied by x100 and oriented left & right of the price box. Left values are negative; right values are positive. The "0" value is not shown; therefore, if the technical rating isn't highlighted then the rating is "0". 
  
The image above shows the technical rating system in action (:
That's it!
This was a fun project and I'm certainly willing to add more - let me know if there's anything you'd like included.
Additionally, a future feature involves compatibility with any custom indicator! Stay tuned; thank you for checking this out (:
Thank you to @kaigouthro, TradingView and @PineCoders for providing some cool libraries to play with! 
Realtime Volume Analysis ToolbarThis script displays an intrabar volume analysis in realtime
displayed data is the following
 
  Total volume
  Up volume
  Down volume
  Delta
  Buyers %
 
More options will be added in the future, at least customization of the colors.
Volume Bull & BearHello Trader,
thanks to the new request.security_lower_tf()-function we are able to calculate intrabar volume. So here is my approach.
Please be aware, that the selected resolution should always be smaller than the selected chart timeframe.
You can find the exact values for bullish and bearish volume in the data window.
Hope it helps some of you :)
FunctionIntrabarCrossValueLibrary   "FunctionIntrabarCrossValue" 
 intrabar_cross_value(a, b, step)  Find the minimum difference of a intrabar cross and return its median value.
  Parameters:
     a : float, series a.
     b : float, series b.
     step : float, step to iterate x axis, default=0.01
  Returns: float
Tick Stream with Tick-Matching AnalysisThis is a simple live tick-chart with optional tick-matching.
 
Stream Live ticks
Set Matching conditions (price difference, volume or both)
Tick lines will increase in width when there's a match.
Optionally plot labels with volume and price change information.
Well-documented source code for pine nuts.
Volume Profile: Intra-bar VolumeThis indicator was developed as part of a free blog post tutorial on the Backtest-Rookies website for detailed code commentary, head over there. 
 Scope 
The indicator shall attempt to do the following:
 
  Look at a lower time-frame. E.g 5 minutes when on a 1-hour chart.
  Create a function to loop through through candles and make an assessment.
  If the candle it closed up, the volume will be categorized as buying volume. Conversely, if it closed down, the volume will be categorized as selling volume
  The function will then be passed to the security() function to run on a lower timeframe.
  All buying volume and selling volume from the lower time-frame shall be summed and displayed on the main chart.
 
 Important Note 
This indicator will not give you genuine buying or selling volume. It simply follows the assumption that if price closed up, there must have been more buyers than sellers and if it closed down we assume the opposite.
 Usage 
In order to use this indicator, users will need to calculate how many lower time-frame bars are contained in the time-frame on the main chart. So for example, the default settings are configured for the indicator to be run on the 1H chart. As a result, we need to set the "Bars on Lower Timeframe" input to 12. This is because there are 12 x 5-minute bars in 60 minutes.











