StockFetcher Forums · Filter Exchange · Help with formula for Price by volume<< >>Post Follow-up
cherdze
1 posts
msg #40738
Ignore cherdze
modified
1/27/2006 3:33:59 PM

For details about this indicator check http://www.stockcharts.com/education/IndicatorAnalysis/indic_PBV.htm

Has this been done before with SF? I looked around and didn't find anything.
I was able to find the following formula on the web. Can anyone help translate the following metastock script into SF. I am basically after the longest horizontal bar (i.e. price at which volume is maximum) to nail price cross of support or resistance.
/********************************
D:=Input("Periods, 0=Full Chart",0,2000,100);
D:=LastValue(If(D=0,LastValue(Cum(1)-1),D));
N:=Input("% Scaling in Box, 1=None",1,100,50);
F:=LastValue(Cum(1));
A:=F-D < Cum(1); {window period}
B:=LastValue(Cum(If(A,V,0))); {window volume}
Q:=LastValue(HighestSince(1,A=0,C));
R:=LastValue(LowestSince(1,A=0,C));
I:=(Q-R)/12; {range increment}
{accumulated volume for each price range}
X1:=LastValue(Cum(If(C<(R+I) AND A,V,0))/B);
X2:=LastValue(Cum(If(C>=(R+I) AND C<(R+I*2) AND A,V,0))/B);
X3:=LastValue(Cum(If(C>=(R+I*2) AND C<(R+I*3) AND A,V,0))/B);
X4:=LastValue(Cum(If(C>=(R+I*3) AND C<(R+I*4) AND A,V,0))/B);
X5:=LastValue(Cum(If(C>=(R+I*4) AND C<(R+I*5) AND A,V,0))/B);
X6:=LastValue(Cum(If(C>=(R+I*5) AND C<(R+I*6) AND A,V,0))/B);
X7:=LastValue(Cum(If(C>=(R+I*6) AND C<(R+I*7) AND A,V,0))/B);
X8:=LastValue(Cum(If(C>=(R+I*7) AND C<(R+I*8) AND A,V,0))/B);
X9:=LastValue(Cum(If(C>=(R+I*8) AND C<(R+I*9) AND A,V,0))/B);
X10:=LastValue(Cum(If(C>=(R+I*9) AND C<(R+I*10) AND A,V,0))/B);
X11:=LastValue(Cum(If(C>=(R+I*10) AND C<(R+I*11) AND A,V,0))/B);
X12:=LastValue(Cum(If(C>=(R+I*11) AND A,V,0))/B);
B:=Max(Max(X1,X2),Max(X3,X4));
B:=Max(Max(B,X5),Max(X6,X7));
B:=Max(Max(B,X8),Max(X9,X10));
B:=Max(B,Max(X11,X12));
B:=If(N=1,N,B*100)/N; {set window % usage}
{top of window, HHV for period}
ValueWhen(1,F-D=Cum(1),Q);
{proportion of volume for each price range}
ValueWhen(1,F-Int(X12*D/B)=Cum(1),R+I*11.5);
ValueWhen(1,F-Int(X11*D/B)=Cum(1),R+I*10.5);
ValueWhen(1,F-Int(X10*D/B)=Cum(1),R+I*9.5);
ValueWhen(1,F-Int(X9*D/B)=Cum(1),R+I*8.5);
ValueWhen(1,F-Int(X8*D/B)=Cum(1),R+I*7.5);
ValueWhen(1,F-Int(X7*D/B)=Cum(1),R+I*6.5);
ValueWhen(1,F-Int(X6*D/B)=Cum(1),R+I*5.5);
ValueWhen(1,F-Int(X5*D/B)=Cum(1),R+I*4.5);
ValueWhen(1,F-Int(X4*D/B)=Cum(1),R+I*3.5);
ValueWhen(1,F-Int(X3*D/B)=Cum(1),R+I*2.5);
ValueWhen(1,F-Int(X2*D/B)=Cum(1),R+I*1.5);
ValueWhen(1,F-Int(X1*D/B)=Cum(1),R+I*0.5);
{left and bottom of window, LLV for period}
ValueWhen(1,F-D<=Cum(1) AND F-D>Cum(1)-2,If(A,R,Q));
*********************************/



StockFetcher Forums · Filter Exchange · Help with formula for Price by volume<< >>Post Follow-up

*** Disclaimer *** StockFetcher.com does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. StockFetcher.com does not recommend particular securities. StockFetcher.com, Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.


Copyright 2022 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.