Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 2/24/2006(UTC) Posts: 24
|
how to find 30/20/15 day average volume
in maths, it would be
day1's volume + day2's volume + .... + day 30's volume / 30
in C++
it would be
for( n = 0 ; n <30 ; n++)
{ volume = ........
}
how about in metastock codes? i suppose it would be a recursive function
anyone can help me in getting x day's average volume?
thnx
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 10/12/2005(UTC) Posts: 141 Location: Brooklyn,NY
|
hanhao,
I would plot the 15ma;then the 20ma and then the 30ma.then go to your data window thats the one 2 icons to the left of your indicator window and it looks like a circle with crosshair in them,and open that and it will give you the values.
You could also go to the indicator window and hit the create new indicator and use this formula:
a:=Mov(C,15,S);
b:=Mov(C,20,S);
d:=Mov(C,30,S);
a;b;d
and point to it once plotted in its own window and it will give you the values of the ma's.
Don't use any variable that has a meaning already assigned to it such as O-open,C-close H-high etc.
Hope this helps.
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 3/19/2005(UTC) Posts: 2,995
Was thanked: 14 time(s) in 10 post(s)
|
x:=Input("Lookback periods [1-252]:",1,252,30);
Sum(V,x)/x
or
x:=Input("Lookback periods [1-252]:",1,252,30);
Mov(V,x,S)
|
|
|
|
Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 2/24/2006(UTC) Posts: 24
|
thnx guys, that's what i need
it's actually for my explorer
now, how about average money traded?
as in for a single day money traded would be (( HIGH + LOW )/2) * VOLUME
how about average money traded over 15 days?
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 3/19/2005(UTC) Posts: 2,995
Was thanked: 14 time(s) in 10 post(s)
|
Hanhao-
Check out the Formula Primer... it is mandatory reading if you want to program MS.
Try this (untested):
x:=Input("Lookback periods [1-252]:",1,252,30);
y:=(( HIGH + LOW )/2) * VOLUME
Sum(y,x)/x
|
|
|
|
Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 2/24/2006(UTC) Posts: 24
|
thnx for your help
here's what i did
y:=(( HIGH + LOW )/2) * V;
Sum(y,15)/15
i changed volume to V, hope no problems
|
|
|
|
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.