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.
|
|
|
|
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.