Editors' picksOPEN-SOURCE SCRIPT

Waindrops [Makit0]

Updated
█ OVERALL

Plot waindrops (custom volume profiles) on user defined periods, for each period you get high and low, it slices each period in half to get independent vwap, volume profile and the volume traded per price at each half.
It works on intraday charts only, up to 720m (12H). It can plot balanced or unbalanced waindrops, and volume profiles up to 24H sessions.
As example you can setup unbalanced periods to get independent volume profiles for the overnight and cash sessions on the futures market, or 24H periods to get the full session volume profile of EURUSD

The purpose of this indicator is twofold:
1 — from a Chartist point of view, to have an indicator which displays the volume in a more readable way
2 — from a Pine Coder point of view, to have an example of use for two very powerful tools on Pine Script:
   • the recently updated drawing limit to 500 (from 50)
   • the recently ability to use drawings arrays (lines and labels)

If you are new to Pine Script and you are learning how to code, I hope you read all the code and comments on this indicator, all is designed for you,
the variables and functions names, the sometimes too big explanations, the overall structure of the code, all is intended as an example on how to code
in Pine Script a specific indicator from a very good specification in form of white paper

If you wanna learn Pine Script form scratch just start HERE
In case you have any kind of problem with Pine Script please use some of the awesome resources at our disposal: USRMAN, REFMAN, AWESOMENESS, MAGIC


█ FEATURES

Waindrops are a different way of seeing the volume and price plotted in a chart, its a volume profile indicator where you can see the volume of each price level
plotted as a vertical histogram for each half of a custom period. By default the period is 60 so it plots an independent volume profile each 30m

You can think of each waindrop as an user defined candlestick or bar with four key values:
 • high of the period
 • low of the period
 • left vwap (volume weighted average price of the first half period)
 • right vwap (volume weighted average price of the second half period)

The waindrop can have 3 different colors (configurable by the user):
 • GREEN: when the right vwap is higher than the left vwap (bullish sentiment )
 • RED: when the right vwap is lower than the left vwap (bearish sentiment )
 • BLUE: when the right vwap is equal than the left vwap ( neutral sentiment )

KEY FEATURES
 • Help menu
 • Custom periods
 • Central bars
 • Left/Right VWAPs
 • Custom central bars and vwaps: color and pixels
 • Highly configurable volume histogram: execution window, ticks, pixels, color, update frequency and fine tuning the neutral meaning
 • Volume labels with custom size and color
 • Tracking price dot to be able to see the current price when you hide your default candlesticks or bars


█ SETTINGS

Click here or set any impar period to see the HELP INFO: show the HELP INFO, if it is activated the indicator will not plot
PERIOD SIZE (max 2880 min): waindrop size in minutes, default 60, max 2880 to allow the first half of a 48H period as a full session volume profile
BARS: show the central and vwap bars, default true
  Central bars: show the central bars, default true
  VWAP bars: show the left and right vwap bars, default true
  Bars pixels: width of the bars in pixels, default 2
  Bars color mode: bars color behavior
   • BARS: gets the color from the 'Bars color' option on the settings panel
   • HISTOGRAM: gets the color from the Bearish/Bullish/Neutral Histogram color options from the settings panel
  Bars color: color for the central and vwap bars, default white
HISTOGRAM show the volume histogram, default true
  Execution window (x24H): last 24H periods where the volume funcionality will be plotted, default 5
  Ticks per bar (max 50): width in ticks of each histogram bar, default 2
  Updates per period: number of times the histogram will update
   • ONE: update at the last bar of the period
   • TWO: update at the last bar of each half period
   • FOUR: slice the period in 4 quarters and updates at the last bar of each of them
   • EACH BAR: updates at the close of each bar
  Pixels per bar: width in pixels of each histogram bar, default 4
  Neutral Treshold (ticks): delta in ticks between left and right vwaps to identify a waindrop as neutral, default 0
  Bearish Histogram color: histogram color when right vwap is lower than left vwap, default red
  Bullish Histogram color: histogram color when right vwap is higher than left vwap, default green
  Neutral Histogram color: histogram color when the delta between right and left vwaps is equal or lower than the Neutral treshold, default blue
VOLUME LABELS: show volume labels
  Volume labels color: color for the volume labels, default white
  Volume Labels size: text size for the volume labels, choose between AUTO, TINY, SMALL, NORMAL or LARGE, default TINY
TRACK PRICE: show a yellow ball tracking the last price, default true


█ LIMITS

This indicator only works on intraday charts (minutes only) up to 12H (720m), the lower chart timeframe you can use is 1m
This indicator needs price, time and volume to work, it will not work on an index (there is no volume), the execution will not be allowed
The histogram (volume profile) can be plotted on 24H sessions as limit but you can plot several 24H sessions


█ ERRORS AND PERFORMANCE

Depending on the choosed settings, the script performance will be highly affected and it will experience errors
Two of the more common errors it can throw are:
 • Calculation takes too long to execute
 • Loop takes too long
The indicator performance is highly related to the underlying volatility (tick wise), the script takes each candlestick or bar and for each tick in it stores the price and volume, if the ticker in your chart has thousands and thousands of ticks per bar the indicator will throw an error for sure, it can not calculate in time such amount of ticks.
What all of that means? Simply put, this will throw error on the BITCOIN pair BTCUSD (high volatility with tick size 0.01) because it has too many ticks per bar, but lucky you it will work just fine on the futures contract BTC1! (tick size 5) because it has a lot less ticks per bar
There are some options you can fine tune to boost the script performance, the more demanding option in terms of resources consumption is Updates per period, by default is maxed out so lowering this setting will improve the performance in a high way.
If you wanna know more about how to improve the script performance, read the HELP INFO accessible from the settings panel


█ HOW-TO SETUP

The basic parameters to adjust are Period size, Ticks per bar and Pixels per bar
 • Period size is the main setting, defines the waindrop size, to get a better looking histogram set bigger period and smaller chart timeframe
 • Ticks per bar is the tricky one, adjust it differently for each underlying (ticker) volatility wise, for some you will need a low value, for others a high one.
   To get a more accurate histogram set it as lower as you can (min value is 1)
 • Pixels per bar allows you to adjust the width of each histogram bar, with it you can adjust the blank space between them or allow overlaping
You must play with these three parameters until you obtain the desired histogram: smoother, sharper, etc...

These are some of the different kind of charts you can setup thru the settings:
 • Balanced Waindrops (default): charts with waindrops where the two halfs are of same size.
   This is the default chart, just select a period (30m, 60m, 120m, 240m, pick your poison), adjust the histogram ticks and pixels and watch
 • Unbalanced Waindrops: chart with waindrops where the two halfs are of different sizes.
   Do you trade futures and want to plot a waindrop with the first half for the overnight session and the second half for the cash session? you got it;
   just adjust the period to 1860 for any CME ticker (like ES1! for example) adjust the histogram ticks and pixels and watch
 • Full Session Volume Profile: chart with waindrops where only the first half plots.
   Do you use Volume profile to analize the market? Lucky you, now you can trick this one to plot it, just try a period of 780 on SPY, 2760 on ES1!, or 2880 on EURUSD
   remember to adjust the histogram ticks and pixels for each underlying
 • Only Bars: charts with only central and vwap bars plotted, simply deactivate the histogram and volume labels
 • Only Histogram: charts with only the histogram plotted (volume profile charts), simply deactivate the bars and volume labels
 • Only Volume: charts with only the raw volume numbers plotted, simply deactivate the bars and histogram

If you wanna know more about custom full session periods for different asset classes, read the HELP INFO accessible from the settings panel

EXAMPLES

Full Session Volume Profile on MES 5m chart: snapshot

Full Session Unbalanced Waindrop on MNQ 2m chart (left side Overnight session, right side Cash Session): snapshot

The following examples will have the exact same charts but on four different tickers representing a futures contract, a forex pair, an etf and a stock.
We are doing this to be able to see the different parameters we need for plotting the same kind of chart on different assets
The chart composition is as follows:
 • Left side: Volume Labels chart (period 10)
 • Upper Right side: Waindrops (period 60)
 • Lower Right side: Full Session Volume Profile
The first example will specify the main parameters, the rest of the charts will have only the differences

snapshot
MES:
 • Left: Period size: 10, Bars: uncheck, Histogram: uncheck, Execution window: 1, Ticks per bar: 2, Updates per period: EACH BAR,
   Pixels per bar: 4, Volume labels: check, Track price: check
 • Upper Right: Period size: 60, Bars: check, Bars color mode: HISTOGRAM, Histogram: check, Execution window: 2, Ticks per bar: 2,
   Updates per period: EACH BAR, Pixels per bar: 4, Volume labels: uncheck, Track price: check
 • Lower Right: Period size: 2760, Bars: uncheck, Histogram: check, Execution window: 1, Ticks per bar: 1, Updates per period: EACH BAR,
   Pixels per bar: 2, Volume labels: uncheck, Track price: check

snapshot
EURUSD:
 • Upper Right: Ticks per bar: 10
 • Lower Right: Period size: 2880, Ticks per bar: 1, Pixels per bar: 1

snapshot
SPY:
 • Left: Ticks per bar: 3
 • Upper Right: Ticks per bar: 5, Pixels per bar: 3
 • Lower Right: Period size: 780, Ticks per bar: 2, Pixels per bar: 2

snapshot
AAPL:
 • Left: Ticks per bar: 2
 • Upper Right: Ticks per bar: 6, Pixels per bar: 3
 • Lower Right: Period size: 780, Ticks per bar: 1, Pixels per bar: 2


█ THANKS TO

PineCoders for all they do, all the tools and help they provide and their involvement in making a better community
scarf for the idea of coding a waindrops like indicator, I did not know something like that existed at all
All the Pine Coders, Pine Pros and Pine Wizards, people who share their work and knowledge for the sake of it and helping others, I'm very grateful indeed
I'm learning at each step of the way from you all, thanks for this awesome community;
Opensource and shared knowledge: this is the way! (said with canned voice from inside my helmet :D)


█ NOTE

This description was formatted following THIS guidelines

═════════════════════════════════════════════════════════════════════════

I sincerely hope you enjoy reading and using this work as much as I enjoyed developing it :D

GOOD LUCK AND HAPPY TRADING!
Release Notes
version update
v0.66b
 • Fixed minor typos
 • Updated publication metadata
 • Updated execution condition and HELP INFO (message and positioning)
   From

   To

   And from
   To
 • Updated LIMITS section, added the following:
   This indicator needs price, time and volume to work, it will not work on an index (there is no volume), the execution will not be allowed
 • Updated ERRORS AND PERFORMANCE section, added the following:
   The indicator performance is highly related to the underlying volatility (tick wise), the script takes each candlestick or bar and for each tick in it stores the price and volume, if the ticker in your chart has thousands and thousands of ticks per bar the indicator will throw an error for sure, it can not calculate in time such amount of ticks.
   What all of that means? Simply put, this will throw error on the BITCOIN pair BTCUSD (high volatility with tick size 0.01) because it has too many ticks per bar, but lucky you it will work just fine on the futures contract BTC1! (tick size 5) because it has a lot less ticks per bar

v0.67b
 • Updated indicator's name to Waindrops
 • Updated all references inside code
mtfprofileVolume IndicatorVolume ProfileVolumewaindrops

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer