Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // LOVE JOY PEACE PATIENCE KINDNESS GOODNESS FAITHFULNESS GENTLENESS SELF-CONTROL
- // © JoshuaMcGowan
- //@version=4
- // Murat Notes: Calculate the volume from the core trading session opening 9.30-9.45 EST of the last 30 days. Build an average. This is the relative volume= RVol
- // Than look for the volume opening of the day. If it is 20% above the the Rvol it is a trending market. Means support and resistance levels rarely will hold. a break out or flush through resistance levels are quite probable.
- // in a range of +20%- -20% it is a normal trading day.
- // If opening volume is under 20% than it will probably be a ranging market (inside day, so inside last days volume area.)
- study("Thirteen Friends - Relative Volume", overlay = false, format = format.volume, max_bars_back = 5000)
- sessions = input(30, "Quantity of sessions back")
- timeSession = input("0930-0945", type = input.session)
- inSession = time(timeframe.period, timeSession)
- sessionBeginning = inSession and not inSession[1]
- f_avgBarsBetweenCondition(_cond) =>
- b = barssince(_cond)
- cumTotal = cum(b == 0 ? b[1] + 1 : 0)
- cumCount = cum(b == 0 ? 1 : 0)
- cumTotal / cumCount
- f_sum(src,p) => a = cum(src), a - a[max(p,0)]
- // Avg
- avgBarsBetweenSessions = f_avgBarsBetweenCondition(sessionBeginning)
- totVolume = f_sum(sessionBeginning ? volume : 0, sessions * avgBarsBetweenSessions + 1)
- totOccurrences = f_sum(sessionBeginning ? 1 : 0, sessions * avgBarsBetweenSessions + 1)
- avgVol = totVolume / totOccurrences
- plot(avgVol, "avgVol")
- plotchar(sessionBeginning, "sessionBeginning", "▲", location.top)
- plotchar(totVolume, "totVolume", "", location.top)
- plotchar(totOccurrences, "totOccurrences", "", location.top)
- plotchar(avgBarsBetweenSessions, "avgBarsBetweenSessions", "", location.top)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement