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

Notification

Icon
Error

Options
Go to last post Go to first unread
exito100  
#1 Posted : Friday, November 6, 2009 10:40:27 PM(UTC)
exito100

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/2/2009(UTC)
Posts: 31

Is there a way to program in Metastock Formuar language a product of all e.g. closing values without a prev function?

product:=value1*value2*value3....*last value

for example as in:

product:=C*PREV;

is very slow.

In other words I am looking for the product equivalent of the cum() function.

I keep looking and trying.. but if someone figures this out earlier please post here! :)

Many thanks,

Klaus
wblam  
#2 Posted : Saturday, November 7, 2009 7:14:31 AM(UTC)
wblam

Rank:: Advanced Member

Groups: Registered, Registered Users
Joined: 11/25/2006(UTC)
Posts: 79

you may try:

exp(sum(log(close),lastvalue(cum(1))));

btw how much ram does your computer have?
exito100  
#3 Posted : Saturday, November 7, 2009 9:03:28 AM(UTC)
exito100

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/2/2009(UTC)
Posts: 31

Thanks wblam! Brilliant idea to use the sum of logs...! Should have thought of that earlier :) Too tired to test it now though. My notbook has only 256MB so that is certainly an issue I guess. Does anyone have an idea if extra ram can speed up these kind of calcluation significantly. Would doubling the Ram roughly double the speed? Thanks for the idea, Klaus
wblam  
#4 Posted : Saturday, November 7, 2009 6:11:15 PM(UTC)
wblam

Rank:: Advanced Member

Groups: Registered, Registered Users
Joined: 11/25/2006(UTC)
Posts: 79

Assume that close=10 and you load 200 days of data.
The answer will be 10 to the power of 200!
I do not think MS or your computer can handle it.
wblam  
#5 Posted : Saturday, November 7, 2009 6:25:40 PM(UTC)
wblam

Rank:: Advanced Member

Groups: Registered, Registered Users
Joined: 11/25/2006(UTC)
Posts: 79

Giorgos' answer in here is more correct:

http://tradersconsortium.com/community/index.php?showtopic=24533&pid=26963&st=0&#entry26963
exito100  
#6 Posted : Saturday, November 7, 2009 8:52:41 PM(UTC)
exito100

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/2/2009(UTC)
Posts: 31

Fortunately I don't really want to multiply closing prices every bar - this was just an example, of course. For what I need it, the above solution works fine with me.
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.