[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [EquisMetaStock Group] Volatility Quality Index



PureBytes Links

Trading Reference Links



Hi
 
 
Dividing anything by ATR(1) will cause a divide-by-zero errors sooner or later. You can get around this problem by using the modified formula below. In it the zero values are modified before being used as divisors.
 
Length1:=Input("Length 1",1,1000,9);
Length2:=Input("Length 1",1,1000,200);
 
A:=ValueWhen(1,ATR(1)<>0,ATR(1));
B:=ValueWhen(1,H-L<>0,H-L);
VQI:=If(ATR(1)<>0 AND (H-L)<>0,((C-Ref(C,-1)/A) +((C-O)/B))*0.5,PREV);
VQI:=Abs(VQI)*((C-Ref(C,-1)+(C-O))*0.5);
SumVQI:=Cum(VQI);
 
SumVQI; {Green}
Mov(SumVQI,Length1,S); {Red}
Mov(SumVQI,Length2,S); {Yellow}
 
Wabit's formula anticipates that ATR(1) might be equal to zero, as does the original, but it doesn't allow for the fact that, even when circumvented by an If() function, the divide-by-zero error will still be picked up and reported by MetaStock.
 
 
Roy
 
 
 
----- Original Message -----
Sent: Thursday, October 01, 2009 11:02 PM
Subject: [EquisMetaStock Group] Volatility Quality Index

 

Hi all,

I am just wondering whether someone can help me to solve this problem?this indicator originated from trade station EL. here is the original code

======================================================================
Variables:
VQI(0),
SumVQI(0);

If TrueRange <> 0 and (High - Low) <> 0 Then
VQI = ((Close - Close[1]) / TrueRange + (Close - Open) / (High - Low)) * 0.5
Else
VQI=VQI[1];
VQI = AbsValue(VQI) * ((Close - Close[1] + (Close - Open)) * 0.5);
SumVQI = SumVQI + VQI;
Plot1(SumVQI,"");
Plot2(Average(SumVQI,9),"");
Plot3(Average(SumVQI,200),"");

======================================================================

Later, this indicator it was translated by Wabbit.Yet,the indicator is giving error message

Length1:=Input("Length 1",1,1000,9);
Length2:=Input("Length 1",1,1000,200);

VQI:=If(ATR(1)<>0 AND (H-L)<>0, ((C-Ref(C,-1)/ATR(1)) + ((C-O)/(H-L)))*0.5,PREV);
VQI:=Abs(VQI)*((C-Ref(C,-1)+(C-O))*0.5);
SumVQI:=Cum(VQI);

SumVQI; {Green}
Mov(SumVQI,Length1,S); {Red}
Mov(SumVQI,Length2,S); {Yellow}

======================================================================

Thank you



__________ NOD32 4474 (20091001) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com


__._,_.___


Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___