--- In [email protected], "l_abarr" <[EMAIL PROTECTED]> 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);