Raindrops [Makit0]


Plot raindrops (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 raindrops, 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

This indicator is based on the raindrops white paper by Ruslan Lagutin from TrendSpider
I encourage you to go to the source and read the paper if you want a first hand explanation about the raindrops.

The purpouse 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 (see reference above)

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


Raindrops 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 raindrop 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 raindrop 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 )

 • 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


Click here or set any impar period to see the HELP INFO: show/hide the HELP INFO, if it is activated the indicator will not plot
PERIOD SIZE (max 2880 min): raindrop 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 raindrop 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


This indicator only works on intraday charts (minutes only) up to 12H (720m), the lower chart timeframe you can use is 1m
The histogram ( volume profile ) can be plotted on 24H sessions as limit but you can plot several 24H sessions


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
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


The basic parameters to adjust are Period size, Ticks per bar and Pixels per bar
 • Period size is the main setting, defines the raindrop 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 Raindrops (default): charts with raindrops 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 Raindrops: chart with raindrops where the two halfs are of different sizes.
   Do you trade futures and want to plot a raindrop 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 raindrops 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


Full Session Volume Profile on MES 1m chart:
Full Session Unbalanced Raindrop on MNQ 1m chart (left side Overnight session, right side Cash Session):
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: Raindrops (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

 • 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

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

 • 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

 • 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


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 raindrops 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)


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

Note di rilascio: version update
 • Fixed minor typos
 • Updated publication metadata
 • Updated execution condition and HELP INFO (message and positioning)
isPeriodOK = not i_showHelp and timeframe.isminutes == true and _timeframe_multiplier <= 720 and i_period % 2 == 0 and i_period % _timeframe_multiplier == 0
if not isPeriodOK
      "\nRaindrops [Makit0] v0.65beta"+
      "\nParameters not allowed!"+
if isPeriodOK
    halfPeriod = int(.5*i_period)
isIndex = syminfo.type == 'index'
isPeriodOK = timeframe.isminutes == true and _timeframe_multiplier <= 720 and i_period % 2 == 0 and i_period % _timeframe_multiplier == 0 
customHelpHeader = isIndex ? 'Ticker not allowed! It is an index, select a ticker with volume data.' : not isPeriodOK ? 'Parameters not allowed! Select a new period size and/or chart timeframe.' : 'HELP INFO'
isGoodToGo = not isIndex and not i_showHelp and isPeriodOK
if not isGoodToGo
      "\nRaindrops [Makit0] v0.66beta"+
if isGoodToGo
    halfPeriod = int(.5*i_period)
   And from
f_printHelp(_txt) => var _lbl = label.style_label_upper_right ...), label.set_xy(... highest(200)) ...
f_printHelp(_txt) => var _lbl = label.style_label_right ...), label.set_xy(... 0.5*(highest(300)+lowest(300))) ...
 • 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
Rimuovi dagli script preferiti Aggiungi agli script preferiti


+9 Rispondi
Beautiful piece of work, thank you for your hard work and for generously sharing it!
+5 Rispondi
Wonderfull job !
+4 Rispondi
Coindrops :)
+2 Rispondi
Just have to say this is such a well executed script. I'm simply amazed. Beautiful looking, excellent code, awesome ideas. I am impressed!
+2 Rispondi
Absolutely stunning. Wow!
+1 Rispondi
Bravo Mate!
Just beautifull!

Gr, JD.
This publication is now featured in our Editors' Picks: .
In the name of all TradingView traders, thank you for your valuable contribution to the TradingView community, and congrats!
+6 Rispondi
Home Screener azioni Screener forex Screener cripto Calendario economico Come funziona Caratteristiche Grafico Costi Invita un amico Regolamento Centro di supporto Soluzioni per broker & siti web Widget Librerie grafiche Libreria grafica leggera Blog & Novità Twitter
Profilo Impostazioni profilo Account e fatturazione Amici invitati Coin I miei ticket di supporto Centro di supporto Idee pubblicate Follower Seguiti Messaggi Privati Chat Esci