logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
akift  
#1 Posted : Wednesday, April 28, 2010 10:19:34 AM(UTC)
akift

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 4/28/2010(UTC)
Posts: 3

Hi everybody, I am trying to write my "first" formula but I am having big troubles. I hope somebody can help here. What I want to do is quite simple (at least thats what I think): I want to plot how many bars ago the cumulative volume was lower than the some threshold which is calculated as = current cumulative volume - a_constant_value Constant:=300000000;{300 Million} CV:=Cum(V); Threshold:=CV-Constant; BarsSince(Cross(CV,Threshold)); I know the above formula doesnt work. And I probably know why it doesnt work:Since threshold is dependent on CV, CV can never cross threshold because threshold will always be recalculated and it will always be lower than CV. Is there any other way to do this? I will be very glad if anybody can help. Thanks. Akif,
vienna  
#2 Posted : Wednesday, April 28, 2010 11:05:08 AM(UTC)
vienna

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 12/14/2009(UTC)
Posts: 140
Location: Austria

you implemented your logic doubled..

try this:

Constant:=300000000;{300 Million}
CV:=Cum(V);
Threshold:=CV-Constant; { <- not needed}
BarsSince(Cross(CV,Constant));

Constant;
CV;
Threshold;
or this:
Constant:=300000000;{300 Million}
CV:=Cum(V);
Threshold:=CV-Constant;
BarsSince(Cross(Threshold,0));

Constant;
CV;
Threshold;

with cum in your formula it is also import for you - what your startdate is in your chart (changing the startdate will change everything)
akift  
#3 Posted : Wednesday, April 28, 2010 2:01:21 PM(UTC)
akift

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 4/28/2010(UTC)
Posts: 3

I think I couldnt express what I want. Your suggestion only finds out the point in time when the cumulative volume is greater than the constant. This is not what I want. I want to implement the indicator what Steve Woods is explaining in his Float Analysis book.So what i want is for every bar in the graph i want to plot the number of bars=> which shows how many bars back when the cumulative volume was less than the (cumulative volume of the "current bar" - constant). So to give an example lets think the constant value is 1 Million and bar[50] has cumulative volume=5 Million and cumulative volume for bar[40]=4 Million. I want to create a formula whichs shows at bar[50] the value of 10. Because 10 bars ago cumulative volume was 1 Million less(constant value less) Is there a way to do this? Thanks in advance. Akif,
vienna  
#4 Posted : Thursday, April 29, 2010 2:00:43 AM(UTC)
vienna

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 12/14/2009(UTC)
Posts: 140
Location: Austria

I try o explain my point of view - maybe we can clearify the formula..

accumlating the volume means that you add the volume of every bar to the cumulative volume of the bar before.

e.g.
bar 1:
Volume: 0.2Million, cum: 0.2Million
bar 2:
Volume: 0.3Million, cum: 0.5Million
bar 3:
Volume: 0.7Million, cum: 1.2Million
bar 4:
Volume: 0.4Million, cum: 1.6Million
bar 5:
Volume: 0.6M, cum: 2.2Million
bar 6:
Volume: 0.5M, cum: 2.7Million
bar 7:
Volume: 1.3M, cum: 4Million
and so on..

if your Constant = 1 Million then
Constant:=1000000;{1 Million}
CV:=Cum(V);
BarsSince(Cross(CV,Constant));
will deliver:
bar 1: nothing
bar 2: nothing
bar 3: nothing
bar 4: 1
bar 5: 2
bar 6: 3
bar 7: 4
and so on...


accumlating the volume means that the cumulative volume raises every bar and there is only one bar (bar 3 in the example above) in your chart where the cumulative volume crosses your constant ->
BarsSince(Cross(CV,Constant)) will only count up after this bar (till the end of the chart)


akift  
#5 Posted : Friday, April 30, 2010 10:49:40 AM(UTC)
akift

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 4/28/2010(UTC)
Posts: 3

Thank you that you gave an example. Just to explain it better think that constant value is not 1 million but 2 million. Think we are going backwards. We are at bar 7. We have cumulative volume 4 Million. Subtact the constant value from this 4-2=2million. Our target for bar 7 is to find out when the CV has crossed above 2 million. cv at bar 4 is 1.6million and at bar5 it is 2.2 million. So For 7 I want to see 2. which tells me 2 bars back (bar5) CV just crossed up the target volume for bar7. Continuing with the example for bar 6. CV is 2.7 million subract 2 million from this value we have 0.7 million as the target.when CV has crossed this value-> at bar 3(from 0.5 at bar2 to 1.2 at bar3) so for bar 6 I want to see 3 which tells me 3 bars back(bar3) CV has crossed up my target volume for bar6. I googled a little bit and on purebytes forum i think it is said it is impossible to do this in metastock. I think I selected a very hard one for my first indicator. But it looks very simple in logic and I already coded it for metatrader but it turns out it is not very possible for metastok. I would be really glad if you know a way to do this. Akif,
vienna  
#6 Posted : Monday, May 3, 2010 6:53:41 AM(UTC)
vienna

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 12/14/2009(UTC)
Posts: 140
Location: Austria

I'm today in a lot of stress, so i could only prepare a formula but can't check if it works correctly in the way you wanted. Maybe you can check it in metastocks on your special example (security) and see if it delivers correct results.

Constant:=10000000;{1 Million}
CV:=Cum(V);
x:=CV-Constant;
BarsSince(Cross(cv,LastValue(x+PREV-PREV)));

For your information about this crazy "+prev-prev" construct you can read the thread: http://forum.equis.com/forums/thread/13829.aspx

best
vienna

PS: really not a good (easy) example to start with metastocks formula ;-)
Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.