Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Hi Gary
Try this. I've increased the number of plots to 25 and added a three-sided frame. All plots start at the right side of the chart (last bar). It's not practical to link the "zero" level of the volume bars to the left side of a chart display unless it's bar 1. Some earlier versions of "VBP" allowed plots to be moved to different points on a chart or scaled to a percentage of the longest volume bar. However the code to do that uses a lot of space and has been dicarded in favour of increasing the number of volume bars.
More bells and whisles may be able to be added by linking this formula to a second one, but then it becomes a little clumsy to use.
Feedback would be appreciated (particularly if it's a little more encouraging than "it doesn't work"). This is a work-in-progress so don't be too harsh - improvements can be made if they're realistic. BTW, it should work on any periodicity but has not been tested other than on EOD.
Roy
MetaStock Tips & Tools
{Volume By Price 25}
{©2006 Roy Larsen, www.metastocktips.com}
d:=Input("Bars to Include",1,9999,100);
n:=Input("Scaling Factor",1,99,5);
k:=Input("Plot Frame?",0,1,1);
y:=Cum(1);f:=LastValue(y);z:=f-1=y;
d:=LastValue(If(d>=f,f-1,d));a:=(f-d<y)*(y>1);
g:=a*V;b:=LastValue(Cum(g));
q:=LastValue(HighestSince(1,a=0,C));
r:=LastValue(LowestSince(1,a=0,C));
i:=(q-r)/25;u:=r+i*.5;m:=n*d/b;
x:=LastValue(Cum((C<(r+i))*g));ValueWhen(1,f-x*m<y,u);
x:=LastValue(Cum((C>=(r+i))*(C<(r+i*2))*g));ValueWhen(1,f-x*m<y,u+i);
x:=LastValue(Cum((C>=(r+i*2))*(C<(r+i*3))*g));ValueWhen(1,f-x*m<y,u+i*2);
x:=LastValue(Cum((C>=(r+i*3))*(C<(r+i*4))*g));ValueWhen(1,f-x*m<y,u+i*3);
x:=LastValue(Cum((C>=(r+i*4))*(C<(r+i*5))*g));ValueWhen(1,f-x*m<y,u+i*4);
x:=LastValue(Cum((C>=(r+i*5))*(C<(r+i*6))*g));ValueWhen(1,f-x*m<y,u+i*5);
x:=LastValue(Cum((C>=(r+i*6))*(C<(r+i*7))*g));ValueWhen(1,f-x*m<y,u+i*6);
x:=LastValue(Cum((C>=(r+i*7))*(C<(r+i*8))*g));ValueWhen(1,f-x*m<y,u+i*7);
x:=LastValue(Cum((C>=(r+i*8))*(C<(r+i*9))*g));ValueWhen(1,f-x*m<y,u+i*8);
x:=LastValue(Cum((C>=(r+i*9))*(C<(r+i*10))*g));
ValueWhen(1,f-x*m<y,u+i*9);
x:=LastValue(Cum((C>=(r+i*10))*(C<(r+i*11))*g));
ValueWhen(1,f-x*m<y,u+i*10);
x:=LastValue(Cum((C>=(r+i*11))*(C<(r+i*12))*g));
ValueWhen(1,f-x*m<y,u+i*11);
x:=LastValue(Cum((C>=(r+i*12))*(C<(r+i*13))*g));
ValueWhen(1,f-x*m<y,u+i*12);
x:=LastValue(Cum((C>=(r+i*13))*(C<(r+i*14))*g));
ValueWhen(1,f-x*m<y,u+i*13);
x:=LastValue(Cum((C>=(r+i*14))*(C<(r+i*15))*g));
ValueWhen(1,f-x*m<y,u+i*14);
x:=LastValue(Cum((C>=(r+i*15))*(C<(r+i*16))*g));
ValueWhen(1,f-x*m<y,u+i*15);
x:=LastValue(Cum((C>=(r+i*16))*(C<(r+i*17))*g));
ValueWhen(1,f-x*m<y,u+i*16);
x:=LastValue(Cum((C>=(r+i*17))*(C<(r+i*18))*g));
ValueWhen(1,f-x*m<y,u+i*17);
x:=LastValue(Cum((C>=(r+i*18))*(C<(r+i*19))*g));
ValueWhen(1,f-x*m<y,u+i*18);
x:=LastValue(Cum((C>=(r+i*19))*(C<(r+i*20))*g));
ValueWhen(1,f-x*m<y,u+i*19);
x:=LastValue(Cum((C>=(r+i*20))*(C<(r+i*21))*g));
ValueWhen(1,f-x*m<y,u+i*20);
x:=LastValue(Cum((C>=(r+i*21))*(C<(r+i*22))*g));
ValueWhen(1,f-x*m<y,u+i*21);
x:=LastValue(Cum((C>=(r+i*22))*(C<(r+i*23))*g));
ValueWhen(1,f-x*m<y,u+i*22);
x:=LastValue(Cum((C>=(r+i*23))*(C<(r+i*24))*g));
ValueWhen(1,f-x*m<y,u+i*23);
x:=LastValue(Cum((C>=(r+i*24))*(C<(r+i*25))*g));
ValueWhen(1,f-Int(x*m)=y,u+i*24);
x:=(f-d=y)*k;ValueWhen(1,x,q);ValueWhen(1,Alert(x,2),If(x,q,r));
|