Shane,
I took a stab at the indicator, but I can’t
seem to get it to work right. The indicator displays sometimes, then becomes
zero as I move around my dataset. I’m not sure what’s
wrong. Maybe someone else can spot my error. The work in process code
is below.
Regards,
David
// RVI - Relative Volatility Index
/*
Taken from Stocks & Commodities, V. 11:6 (253-256): The
Relative
Volatility Index by Donald Dorsey
"The RVI is simply the relative strength index (RSI) with the
standard deviation over the past 10 days used in place of daily
price
change. Because most indicators use price change for their
calculations, we need a confirming indicator that uses a different
measurement to interpret market strength. The RVI measures the
direction of volatility on a scale of zero to 100. Readings above 50
indicate that the volatility as measured by the 10-Day standard
deviation of the closing prices is more to the upside. Readings below
50 indicate that the direction of volatility is to the downside.
The
initial testing indicates that the RVI can be used wherever you
might
use the RSI AND in the same way, but the specific purpose of this
Study is to measure the RVI's performance as a confirming
indicator."
The RVI was designed to measure the direction of volatility. It
calculates price strength by measuring volatility rather than
price
change.
*/
SetBarsRequired( 100000, 100000 );
dROC = ROC(C,1);
dStDev = StDev(C,10);
RVIdn = 0;
RVIup = 0;
PREVdn = 0;
PREVup = 0;
tmpDn = 0;
tmpUp = 0;
for (i=1; i<BarCount;
i++) {
// RVI down
PREVdn[i] = RVIdn[i-1];
if(dROC[i] < 0)
tmpDn[i]
= dStDev[i];
else
tmpDn[i]
= 0;
RVIdn[i] = ( PREVdn[i]*13 + tmpDn[i] )/14;
// RVI up
PREVup[i] = RVIup[i-1];
if(dROC[i] > 0)
tmpUp[i]
= dStDev[i];
else
tmpUp[i]
= 0;
RVIup[i] = ( PREVup[i]*13 + tmpUp[i] )/14;
}
RVI = (100 * RVIup) / (RVIup + RVIdn);
Plot( RVI, "RVI", ParamColor("RVI color", colorRed ), ParamStyle("RVI
style") );
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of bakermrms
Sent: 04/22/2007 5:20 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] RVI indicator
by Donald Dorsey
Hi
I wondered whether anybody had managed to code the RVI indicator
(relative volatility index) by Donald Dorsey for Ami and would be
willing to share?
Taken from Stocks & Commodities, V. 11:6 (253-256): The Relative
Volatility Index by Donald Dorsey
"The RVI is simply the relative strength index (RSI) with the
standard deviation over the past 10 days used in place of daily price
change. Because most indicators use price change for their
calculations, we need a confirming indicator that uses a different
measurement to interpret market strength. The RVI measures the
direction of volatility on a scale of zero to 100. Readings above 50
indicate that the volatility as measured by the 10-day standard
deviation of the closing prices is more to the upside. Readings below
50 indicate that the direction of volatility is to the downside. The
initial testing indicates that the RVI can be used wherever you might
use the RSI and in the same way, but the specific purpose of this
study is to measure the RVI's performance as a confirming indicator."
The RVI was designed to measure the direction of volatility. It
calculates price strength by measuring volatility rather than price
change.
All of the following formulas are required:
@RVI Down
((PREV*13)+If(ROC(C,1,%)<0,Stdev(C,10),0))/14
@RVI Up
((PREV*13)+If(ROC(C,1,%)>0,Stdev(C,10),0))/14
@RVI
(100*Fml("@RVI Up"))/(Fml("@RVI Up")+Fml("@RVI
Down"))
Many thanks for any help offered.
Cheers
Shane