TradingView
RicardoSantos
17 maj 2019 18:10

Function - IRR 

U.S. Dollar / Russian RubleFOREX.com

Beskrivning

// || Function IRR
// || - infinite impulse response filter

Versionsinformation

Kommentarer
xel_arjona
Autoregressive or Infinite Impulse filters are quite dynamic and less computing intensive than Finite ones (Like Arithmetic Simple Moving Average). With this kind of algorithm one could calculate VWAP (As an approximation if not on tick make the recursion from tick by tick) from the entire series if the volume ratio [ volume / cum( volume ) ] is given as b0 and 1 - b0 as a1.
xel_arjona
@xel_arjona, don't know why, message messed up form my first message. As volume ratio I mean b0 = volume / cum( volume ) & a1 = 1 - b0 and there, you have blasting fast historic VWAP algo from pine. Initialization array could be declared in the function, like on my one pole version function, which is quite helpful for compressed timeseries like on tradingview. (Open is first in time than High & Low and they are than Close):

// One Pole Infinite Impulse Response
iir1p( init, a0, b0, a1 ) =>
filter = 0.0
filter := b0 * a0 + a1 * nz( filter[ 1 ], init )
ballofpaper
Nice ;)
Mer