Plot raindrops (custom profiles) on user defined periods, for each period you get high and low, it slices each period in half to get independent , and the traded per price at each half.
It works on intraday charts only, up to 720m (12H). It can plot balanced or unbalanced raindrops, and profiles up to 24H sessions.
As example you can setup unbalanced periods to get independent profiles for the overnight and cash sessions on the market, or 24H periods to get the full session 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 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 and price plotted in a chart, its a indicator where you can see the 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 each 30m
You can think of each raindrop as an user defined or bar with four key values:
• high of the period
• low of the period
• left ( of the first half period)
• right ( of the second half period)
The raindrop can have 3 different colors (configurable by the user):
• GREEN: when the right is higher than the left ( sentiment )
• RED: when the right is lower than the left ( sentiment )
• BLUE: when the right is equal than the left ( neutral sentiment )
• Help menu
• Custom periods
• Central bars
• Left/Right VWAPs
• Custom central bars and vwaps: color and pixels
• Highly configurable histogram: execution window, ticks, pixels, color, update frequency and fine tuning the neutral meaning
• labels with custom size and color
• Tracking price dot to be able to see the current price when you hide your default 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
BARS: show the central and bars, default true
Central bars: show the central bars, default true
VWAP bars: show the left and right 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 / /Neutral Histogram color options from the settings panel
Bars color: color for the central and bars, default white
HISTOGRAM show the histogram, default true
Execution window (x24H): last 24H periods where the 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 is lower than left , default red
Bullish Histogram color: histogram color when right is higher than left , 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 labels
Volume labels color: color for the labels, default white
Volume Labels size: text size for the 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 ( ) 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
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 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) 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 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 ticker (like ES1! for example) adjust the histogram ticks and pixels and watch
• Full Session Profile: chart with raindrops where only the first half plots.
Do you use 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 bars plotted, simply deactivate the histogram and labels
• Only Histogram: charts with only the histogram plotted ( charts), simply deactivate the bars and labels
• Only Volume: charts with only the raw 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 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 contract, a forex pair, an 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: Labels chart (period 10)
• Upper Right side: Raindrops (period 60)
• Lower Right side: Full Session
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, 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, 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, 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
█ 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 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
GOOD LUCK AND HAPPY TRADING!
• 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 f_printHelp( ... "\nRaindrops [Makit0] v0.65beta"+ "\n"+ "\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 f_printHelp( ... "\nRaindrops [Makit0] v0.66beta"+ "\n"+ "\n"+customHelpHeader+ ... if isGoodToGo halfPeriod = int(.5*i_period) ...
f_printHelp(_txt) => var _lbl = label.new(... label.style_label_upper_right ...), label.set_xy(... highest(200)) ...
f_printHelp(_txt) => var _lbl = label.new(... label.style_label_right ...), label.set_xy(... 0.5*(highest(300)+lowest(300))) ...
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
In the name of all TradingView traders, thank you for your valuable contribution to the TradingView community, and congrats!