--- In [email protected], "JD Fagan" <[EMAIL PROTECTED]> wrote: > > --- In [email protected], "JD Fagan" <jd.fagan@> wrote: > > > > --- In [email protected], "l_abarr" <l_abarr@> wrote: > > > > > > Hi, > > > > > > Does anyone know how to code William Blau's Tick Volume Indicator? > > > Blau defines TVI in this manner: > > > > > > TVI (r,s) = [Double EMA(upticks,r,s)-Double EMA(downticks,r,s)]/ > > > [Double EMA(upticks,r,s)+Double EMA(downticks,r,s)] > > > > > > I really appreciate help from anyone. I'm obviously poor at coding... > > > > > Wasn't sure what the r and s meant, but here's a shot with assumption > > that uptick is when rate of change since last bar is 0% or up and > > downtick is less than 0%: > > > > function tvi(array, periods) { > > upticks = Cum(ROC(array, 1) >= 0); > > downticks = Cum(ROC(array, 1) < 0); > > return (DEMA(upticks, periods) - DEMA(downticks, periods)) / > > (DEMA(upticks, periods) + DEMA(downticks, periods)); > > } > > > > //Example usage > > Plot(tvi(Close, 10), "Blau's TVI for Close", colorBlue, styleLine); > > Plot(tvi(Volume, 10), "Blau's TVI for Volume", colorGreen, styleLine); > > > This may be more what you wanted for upticks vs. downticks..it seems > to generate more oscillating type lines: > > upticks = Sum(ROC(array, 1) >= 0, periods); > downticks = Sum(ROC(array, 1) < 0, periods); > > JD > Thanks, JD! Appreciate the assistance.
The 'r' and 's' in Blau's formula refer to the two time periods for the double exponential smoothing. I've not subscribed to real-time data yet, but Blau recommends the TVI for intra-day trading. Blau says that some data vendors supply the number of upticks and downticks within each data bar: I don't know if E-Signal or any of the other Amibroker make this data available... Lorin
