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

Notification

Icon
Error

Options
Go to last post Go to first unread
Kenny888  
#1 Posted : Wednesday, March 6, 2013 9:32:49 PM(UTC)
Kenny888

Rank: Newbie

Groups: Registered, Registered Users
Joined: 3/7/2013(UTC)
Posts: 1

Hi,

I have the formula here:

Sec1:=Security("00001",C ); {started on 1/1/2012}
If(IsDefined(sec1>mov(sec1,10,s)),1,0);
If(IsDefined(sec1>mov(sec1,10,s)),Cum(sec1>mov(sec1,10,s)),0);

The "If(IsDefined(sec1>mov(sec1,10,s)),1,0);" can return "0" when the date before "1/1/2012", however the "If(IsDefined(sec1>mov(sec1,10,s)),Cum(sec1>mov(sec1,10,s)),0);" can only return "null" when the date before "1/1/2012".

How can I get the "0" back in the second expression?Can anybody help?

Thank you in advance.
wabbit  
#2 Posted : Thursday, March 7, 2013 5:46:03 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
The IsDefined() function has been a disappointment since its inception, which is why improved versions are available in many external function libraries for MS. The simplest solution to remove the N/A is to use the free forum.dll, employing the sum function contained therein.

Code:

Sec1:=Security("00001",C ); {started on 1/1/2012}ma:=mov(sec1,10,s);

{plot}
extfml("forum.sum",ma,1);
Alternatively, you could use the moving average functions in the same library which don't return N/A values, instead they average the data available until the required data length is reached.



wabbit [:D]

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.