Rain On Me PRO 2/3

This is the part 2 of Rain On Me PRO. It follow my two other indicators “Rain On Me” and “Rain On Me V2”. This version is called “PRO” because it is less “user-friendly” than my two previous versions. But the indicator load more faster, and it’s cleaner than ever! This indicator is separated into 3 parts. You can find all parts here in the “free indicators” menu or into my Tradingview profile in the « Scripts » section. Once the 3 parts together, the indicator is ready.

Rain On Me PRO 2/3 in action on GBP/USD Forex.

Screenshot taken from the Settings menu of Rain On Me PRO 2/3.

Here is the complete list of indicators present in this indicator :

  • Revisited Support and Resistance
  • MultiTimeFrame High/Low
  • VWAP by period (Day, Week, Month)

All indicators have their original default settings. You need to be able to readjust them depending on the market instrument you want to analyze. You have the possibility to put alerts which will notify you when an indicator gives a new signal. When placing an alert, be sure to choose the “once per bar” option each time you place an alert.

Rate this Indicator?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 1

No votes so far! Be the first to rate this Indicator.

5
(1)

Or copy / paste the source code into your pine editor :

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © RickSimpson
//@version=4

study(title="Rain On Me PRO 2/3", shorttitle='ROM PRO 2/3', overlay=true, max_bars_back=300, precision=2)

//Inputs

showsr   = input(defval=true,  title="Show Support/Resistance?")
showhl   = input(defval=true,  title="Show High/Low?")
showvwap = input(defval=false, title="Show VWAP?")

//Support/Resistance

//Settings

srhigh            = high
srlow             = low
srper             = 300
srsrsmcalcoothing = 0
srsmcalc          = srsrsmcalcoothing + 1
rl                = true
exp               = true
srmahigh          = ema(srhigh, srsmcalc)
srmalow           = ema(srlow,  srsmcalc)

//Calculation

gap = 2
if barstate.islast
    if srper > bar_index   - gap
        srper := bar_index - gap

hhh = 0.0
lll = 1000000000000.0

h2  = hhh
th2 = 0
l2  = lll
tl2 = 0
h1  = hhh
th1 = 0
l1  = lll
tl1 = 0

for i = srper + gap to gap

    h1 := max(h1, srmahigh[i])
    if h1 == srmahigh[i]
        th1 := i

    l1 := min(l1, srmalow[i])
    if l1 == srmalow[i]
        tl1 := i

for i = srper + gap to gap
    if i < min(tl1, th1 / 2)
        h2 := max(h2, srmahigh[i])
        if h2 == srmahigh[i]
            th2 := i
    if i < min(th1, tl1 / 2)
        l2 := min(l2, srmalow[i])
        if l2 == srmalow[i]
            tl2 := i

if th1 <= gap
    h1 := hhh
    th1 := 0
    for i = srper + gap to round(srper / 1.4669) + gap

        h1 := max(h1, srmahigh[i])
        if h1 == srmahigh[i]
            th1 := i
if tl1 <= gap
    l1 := lll
    tl1 := 0
    for i = srper + gap to round(srper / 1.4669) + gap

        l1 := min(l1, srmalow[i])
        if l1 == srmalow[i]
            tl1 := i

if th2 <= gap
    h2 := hhh
    th2 := 0
    for i = gap to round(srper / 2.9338) + gap

        h2 := max(h2, srmahigh[i])
        if h2 == srmahigh[i]
            th2 := i
if tl2 <= gap
    l2 := lll
    tl2 := 0
    for i = gap to round(srper / 2.9338) + gap

        l2 := min(l2, srmalow[i])
        if l2 == srmalow[i]
            tl2 := i
    
a1  = avg(h1, l1)
ta1 = round(avg(th1, tl1))
a2  = avg(h2, l2)
ta2 = round(avg(th2, tl2))

PLT(P1, P2, T1, T2) =>
    if exp
        t     = T1 - T2
        slope = (log10(P1) - log10(P2)) / (0 - t)
        y     = slope * T1 + log10(P1)
        pow(10, y)
    else
        ((P2 - P1) / (T1 - T2)) * T1 + P1

PLC  = barstate.islast
PLTh = PLC ? PLT(h1, h2, th1, th2) : na
PLTl = PLC ? PLT(l1, l2, tl1, tl2) : na
PLTa = PLC ? PLT(a1, a2, ta1, ta2) : na

sty = plot.style_circles
lin = 2

//Plotting

L(T1, H1, T2, H2, CLR, W, X) =>
    line.new(bar_index - max(T1, 0), H1, bar_index - max(T2, 0), H2, color=CLR, width=W, extend=X ? extend.both : extend.none)

if showsr
    L1b = L(th1, h1, th2, h2, #2157f3, 1, true), line.delete(L1b[1])
    if rl
        L1a = L(th1, h1, th2, h2, #2157f3, 2, false), line.delete(L1a[1])
if showsr
    L2b = L(tl1, l1, tl2, l2, #2157f3, 1, true), line.delete(L2b[1])
    if rl
        L2a = L(tl1, l1, tl2, l2, #2157f3, 2, false), line.delete(L2a[1])
    
//High/Low

//Inputs

hlres = input(defval="D", title="High/Low Resolution", type=input.resolution)

//MTF Settings

hltf     = ""
hlpivlen = 1
hlsrc    = close > open ? high : low
hlconf   = timeframe.isintraday and timeframe.multiplier >= 1 ? 
   60 / timeframe.multiplier * 7 : 
   timeframe.isintraday and timeframe.multiplier < 60 ? 
   60 / timeframe.multiplier * 24 * 7 : 7
   
hlsec   = security(syminfo.tickerid, hltf,  sum(hlsrc, hlpivlen) / hlpivlen)
hlopen  = security(syminfo.tickerid, hlres, open,  barmerge.gaps_off, barmerge.lookahead_off)
hlh     = security(syminfo.tickerid, hlres, high,  barmerge.gaps_off, barmerge.lookahead_off)
hll     = security(syminfo.tickerid, hlres, low,   barmerge.gaps_off, barmerge.lookahead_off)
hlclose = security(syminfo.tickerid, hlres, close, barmerge.gaps_off, barmerge.lookahead_off)

//Settings

hlcolor = hlclose >= hlopen ? color.lime : color.red

//Plotting

plot(showhl and hlconf and hlh > hlclose ? hlh : na, color=hlcolor, title="High", style=plot.style_circles, linewidth=2, transp=60)
plot(showhl and hlconf and hll < hlclose ? hll : na, color=hlcolor, title="Low",  style=plot.style_circles, linewidth=2, transp=60)

//VWAP

//Inputs

vwapsrc = input(defval=hlc3,  title="VWAP Source", type=input.source)
vwapres = input(defval="Day", title="VWAP Period", type=input.string, options=["Day","Week","Month","Year"])

//Calculation

vwapdcalc = 86400000
vwapwcalc = 7
vwapdbt   = timeframe.isdwm ? time : time("D")

if na(vwapdbt)
    vwapdbt := nz(vwapdbt[1])
var _vwappst = time - time

vwapfmz(_vwapdow) => (_vwapdow + 5) % 7

vwapimt(_t) => hour(_t) == 0 and minute(_t) == 0
    
vwapisd(_t1, _t2) => dayofmonth(_t1) == dayofmonth(_t2) and month(_t1) == month(_t2) and year (_t1) == year (_t2)
  
vwapovt() => not (vwapimt(vwapdbt) or security(syminfo.tickerid, "D", vwapisd(time, time_close), lookahead=false))
	 
vwaptds(_t) =>
    _y = year(_t)
    _m = month(_t)
    _d = dayofmonth(_t)
    timestamp(_y, _m, _d, 0, 0)
    
vwapndb(_vperiod1, _vperiod2) =>
    _y1 = year(_vperiod1)
    _m1 = month(_vperiod1)
    _d1 = dayofmonth(_vperiod1)
    
    _y2 = year(_vperiod2)
    _m2 = month(_vperiod2)
    _d2 = dayofmonth(_vperiod2)
    
    _vdiff = abs(timestamp("GMT", _y1, _m1, _d1, 0, 0) - timestamp("GMT", _y2, _m2, _d2, 0, 0))
    _vdiff / vwapdcalc
    
vwaptd = vwapovt() ? vwaptds(vwapdbt + vwapdcalc) : vwaptds(vwapdbt)
	 
vwapinp() =>
    _visn = false
    if vwaptd != nz(vwaptd[1])
    
        if vwapres == "Day"
            _visn  := na(vwaptd[1]) or
					   vwaptd > vwaptd[1]
            
        if vwapres == "Week"
            _visn  := vwapfmz(dayofweek(_vwappst)) +
					   vwapndb(_vwappst, vwaptd) >=
					   vwapwcalc
            
        if vwapres == "Month"
            _visn  := month(_vwappst) != month(vwaptd) or
					   year (_vwappst) != year (vwaptd)
            
        if vwapres == "Year"
            _visn  := year(_vwappst) != year(vwaptd)
    _visn

vwapsumsrc         = float(na)
vwapsumvolume      = float(na)
vwapsumsrc        := nz(vwapsumsrc[1],    0)
vwapsumvolume     := nz(vwapsumvolume[1], 0)
if vwapinp()
    _vwappst      := vwaptd
    vwapsumsrc    := 0.0
    vwapsumvolume := 0.0
if not na(vwapsrc) and not na(volume)
    vwapsumsrc    := vwapsumsrc + vwapsrc * volume
    vwapsumvolume := vwapsumvolume + volume
visvwap            = vwapsumsrc / vwapsumvolume

//Settings

vdir      = (vwapsumvolume > vwapsrc) and (vwapsrc > visvwap) ? 1 : (vwapsumvolume > vwapsrc) and (vwapsrc < visvwap) ? -1 : 0
vwapfcalc = vdir == 1 ? color.green : vdir == -1 ? color.red : color.gray

//Background Color

bgcolor(showvwap ? vwapfcalc : na)

//Alerts

alertcondition(crossunder(vdir, -1), title="VWAP Sell", message='VWAP Sell')
alertcondition(crossover(vdir,   1), title="VWAP Buy",  message='VWAP Buy')

The content covered on this website is NOT investment advice and I am not a financial advisor.