{ On Balance Volume Volatility v1.0 }{ Plot on own window
below price chart }{ ©Copyright 2004 Jose Silva }{
josesilva22@yahoo.com }
pds:=Input("Volatility StdDev periods",
2,2520,10);
choose:=Input("base Volatility on: OBV=1, Close=2",1,2,1);
plot:=Input("plot: Normal Vt=1, Split Up+Down Vt=2,
OBV=3",1,3,1);
x:=Stdev(If(choose=1,OBV(C),C),pds);
y:=Ref(x,-1);
ratio:=Min(x,y)/Max(x,y);
Vt:=Abs(If(x>y,2-ratio,ratio)-1)*100;
VtAvg:=Cum(Vt)/Cum(Vt>-1);
VtUp:=If(x>Ref(x,-1),Vt,0);
VtDw:=-If(x<Ref(x,-1),Vt,0);
If(plot=2,VtUp,If(plot=3,OBV(C),VtAvg));
If(plot=2,VtDw,If(plot=3,OBV(C),Vt))
OBV Volatility system
{ On Balance Volume Volatility system v1.0 }{ Enters Long on
high negative OVB Volatility }{ Exits Long on high positive OVB
Volatility }{ Plot on own window below price chart }{ ©Copyright
2004 Jose Silva }{ josesilva22@yahoo.com }
pds:=Input("Volatility StdDev periods",2,2520,252);
level:=Input("Threshold levels",0,100,0.5);
x:=Stdev(OBV(C),pds);
y:=Ref(x,-1);
ratio:=Min(x,y)/Max(x,y);
Vt:=Abs(If(x>y,2-ratio,ratio)-1)*100;
VtUp:=If(x>Ref(x,-1),Vt,0);
VtDw:=-If(x<Ref(x,-1),Vt,0);
In:=Cross(-level,VtDw);
Out:=Cross(VtUp,level);
delay:=Input("Entry and Exit delay",0,5,0);
plot:=Input("plot: entry/exit signals=1, trade
binary=2",1,2,1);
Init:=Cum(In+Out>-1)=1;
InInit:=Cum(In)=1;
flag:=Ref(BarsSince(Init OR In)
< BarsSince(Init OR Out)+InInit,-delay);
In1:=Cum(Cum(In))=1;
Out1:=Cum(Cum(Out))=1;
signals:=(InInit AND Alert(InInit=0,2)
OR flag AND Alert(flag=0,2))
-(flag=0 AND Alert(flag,2));
odd:=Cum(1)/2=Int(Cum(1)/2);
Ref(If(plot=1,In1,0),-delay);
-(plot=1 AND Ref(Out1 AND BarsSince(In1)
>=BarsSince(Out1),-delay));
If(plot=1,0,If(odd,flag,0));
If(plot=1,signals,flag)
(Go
Top) |