PureBytes Links
Trading Reference Links
|
TO MMQP ( your name?)
This is how I think you mean to calculate
Value4
Value4 =( 4*Value3 +
3*Ref(Value3,-1) + 2*Ref(Value3,-2)+
Ref(Value3,-3))/10;
and the way I debugged this was by adding the
following AddColumns at the end of your program to see what were the
intermediate results you were developing. In your case Value4
was empty... If I don't get the answers I expect, this is how I start
after first reviewing how to use the coded AFL functions. There are ways
to use the index [i] but this is not the way
Hope this helps
JOE
Filter
=1;
AddColumn (RVI,"RVI");
AddColumn (RVISig,"RVISig");
AddColumn (Value3,"Val3");
AddColumn (Value4,"Val4");
----- Original Message -----
Sent: Wednesday, September 07, 2005 8:43
AM
Subject: [amibroker] John Ehler's
Relative Vigor Index.
Hi, I tried to implemement John Ehler's RVI, stoRVI and
FisherRVI, however the arrays always resulting EMPTY. Can someone
help? TIA
FIG 8.8 Pg 84
/* Relative Vigour Index from TASC
01/02 */
SetBarsRequired(200, 0);
//period = 14; Period =
Param("Period", 10, 1, 250, 1); // window should be half of dominant cycle
length stoLen = Period; // Param("stoLen", 8, 1, 50, 1); // window should
be half of dominant cycle length
value1 = ( ( Close - Open ) + ( 2 *
Ref( Close - Open, -1) ) + ( 2 * Ref( Close - Open, -2) ) + Ref( Close -
Open, -3) ) / 6; value2 = ( ( High - Low ) + ( 2 * Ref( High - Low, -1) ) +
( 2 * Ref( High - Low, -2) ) + Ref( High - Low, -3) ) /
6;
num = Sum( value1, period ); denom = Sum( value2,
period );
RVI = IIf( denom != 0, num / denom,
0); RVISig = ( RVI + 2 * Ref( RVI, -1) + 2 * Ref( RVI, -2) + Ref( RVI,
-3) ) / 6;
MinRVI = LLV(RVI,stoLen); MaxRVI =
HHV(RVI,stoLen);
Value3 = IIf(MaxRVI != MinRVI, (RVI - MinRVI) /
(MaxRVI - MinRVI), 0); Value4 = (4*Value3 + 3*Value3[1] + 2*Value3[2] +
Value3[3]) / 10; // weighted averages.
Value5 = 2*(Value4 -
0.5);
FisherStoRVI = 0.5 * log((1+1.98*(Value4 -
0.5))/(1-1.98*(Value4 - 0.5)));
Plot(RVI , "Ehlers RVI(" +
Period + ")", colorBlue, styleLine); Plot(Ref(RVI,-1), "Ehlers RVI-Trig",
colorRed, styleLine);
Plot(Value5, "Ehlers stoRVI(" + stoLen + ")",
colorViolet, styleLine
+ styleOwnScale); Plot(0.96*(Ref(Value5,-1)+0.02), "Ehlers StoRVI
triggers" , colorBrown, styleLine +
styleOwnScale);
Plot(FisherStoRVI , "Ehlers Fisher stoRVI", colorTeal,
styleLine + styleOwnScale); Plot(0.96*(Ref(FisherStoRVI ,-1)+0.02),
"Ehlers Fisher StoRVI triggers" , colorViolet, styleLine +
styleOwnScale);
Plot(0,"",colorLightGrey,styleLine);
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
YAHOO! GROUPS LINKS
|
|