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

Notification

Icon
Error

Options
Go to last post Go to first unread
gorachand  
#1 Posted : Thursday, October 31, 2013 7:24:43 AM(UTC)
gorachand

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 2/19/2012(UTC)
Posts: 106

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Sometimes when I write a code in the explorer and run the exploration ---the rejects column shows
"Results of the formula not defined on calculation date"---Why does this appear? Can someone explain?

Regards,

Dr.Chatterjee
MS Support  
#2 Posted : Monday, November 4, 2013 10:21:44 AM(UTC)
MS Support

Rank: Advanced Member

Groups: Moderators, Registered, Registered Users, Subscribers
Joined: 10/8/2010(UTC)
Posts: 1,960

Thanks: 92 times
Was thanked: 155 time(s) in 150 post(s)
The majority of the time, this message simply means one of the formula conditions has never been found in the data being tested.

You can try increasing the data being loaded into the Explorer to see if it changes the results at all. Typically you should be able to treat this as a normal filter rejection.
mstt  
#3 Posted : Tuesday, November 5, 2013 7:39:06 PM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Hi Dr Chatterjee

How can this happen? Suppose you include a ValueWhen() function in the Explorer but the condition/event you're looking for (and expecting) does not occur within the limited amount of data you have loaded, then the ValueWhen() function cannot return a legitimate value, hence the N/A result. Loading more data is one way to get around some of these situations.

OR-ing the EXPRESSION parameter of ValueWhen() with that parameter returning a "now-valid-status count of 1 bar" (a transition from N/A) can also reduce the number of N/A results caused by ValueWhen().

Here are "before and after" examples showing a problem ValueWhen() followed by a modified version.

{Example 1}
Param:=Cross(Stoch(14,5),95);
ValueWhen(1,Param,C);

{Example 2}
Param:=Cross(Stoch(14,5),95);
Init:=Cum(IsDefined(Param))=1;
ValueWhen(1,Init OR Param, If(Init,0,C));

The first example will generate an indeterminate N/A period while the second example only requires 21 bars to generate an initial zero or price result. While this approach might not solve your exact problem it does offer a way of eliminating N/A exploration results that are generated by ValueWhen().

Roy

gorachand  
#4 Posted : Thursday, November 7, 2013 7:22:01 AM(UTC)
gorachand

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 2/19/2012(UTC)
Posts: 106

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)

Dear Roy,

I was trying to write an exploration for Countdown buy C the idea being to buy when Countdown buy C =1
I had written

Fml( "TD Count Down Buy C") =1 in the filter column but the filter keeps on rejecting 100% of the securities with the message "Results of the formula not defined on calculation date"

The background for the exploration is listed below:=



I have 3 indicators



TD Count Down Buy C:

If(Fml( "TD Count Down Buy A" )>=14 AND CLOSE>Ref(HIGH,-2),1,0)


TD Count Down Buy A:

Cum(If(CLOSE<Ref(CLOSE,-2),1,0))-ValueWhen(1,Ref( Fml( "<TD - SetUp-buy>" ), 1)=1, Cum(If(CLOSE<Ref(CLOSE,-2),1,0)))



TD - SetUp-buy:

TD1:=If(CLOSE<Ref(CLOSE,-4),1,0);

TD2:=If(TD1=1 AND Ref(TD1,-1)=1 AND Ref(TD1,-2)=1 AND Ref(TD1,-3)=1 AND Ref(TD1,-4)=1 AND Ref(TD1,-5)=1 AND Ref(TD1,-6)=1 AND Ref(TD1,-7)=1 AND Ref(TD1,-8)=1, 1,0);

TD3:=if(Ref(c,-9)>=Ref(c,-13),1,0); {>= may be changed in >}

TD4:=if(TD2=1 and TD3=1,1,0);

TD5:=if(high>=Ref(LLV(Low,5),-3),1,0);

D8:=if(ref(TD4,1)=1 and TD5=1,1,0);

D9:=if(TD4=1 and TD5=1 and ref(D8,-1)<>1,1,0);

D10:=if(ref(TD4,-1)=1 and TD5=1 and ref(D8,-2)<>1 and ref(D9,-1)<>1,1,0);

D11:=if(ref(TD4,-2)=1 and TD5=1 and ref(D8,-3)<>1 and ref(D9,-2)<>1 and ref(D10,-1)<>1,1,0);

D12:=if(ref(TD4,-3)=1 and TD5=1 and ref(D8,-4)<>1 and ref(D9,-3)<>1 and ref(D10,-2)<>1 and ref(D11,-1)<>1,1,0);

D13:=if(ref(TD4,-4)=1 and TD5=1 and ref(D8,-5)<>1 and ref(D9,-4)<>1 and ref(D10,-3)<>1 and ref(D11,-2)<>1 and ref(D12,-1)<>1,1,0);

D14:=if(ref(TD4,-5)=1 and TD5=1 and ref(D8,-6)<>1 and ref(D9,-5)<>1 and ref(D10,-4)<>1 and ref(D11,-3)<>1 and ref(D12,-2)<>1 and ref(D13,-1)<>1,1,0);

D15:=if(ref(TD4,-6)=1 and TD5=1 and ref(D8,-7)<>1 and ref(D9,-6)<>1 and ref(D10,-5)<>1 and ref(D11,-4)<>1 and ref(D12,-3)<>1 and ref(D13,-2)<>1 and ref(D14,-1)<>1,1,0);

D16:=if(ref(TD4,-7)=1 and TD5=1 and ref(D8,-8)<>1 and ref(D9,-7)<>1 and ref(D10,-6)<>1 and ref(D11,-5)<>1 and ref(D12,-4)<>1 and ref(D13,-3)<>1 and ref(D14,-2)<>1 and ref(D15,-1)<>1,1,0);

D17:=if(ref(TD4,-8)=1 and TD5=1 and ref(D8,-9)<>1 and ref(D9,-8)<>1 and ref(D10,-7)<>1 and ref(D11,-6)<>1 and ref(D12,-5)<>1 and ref(D13,-4)<>1 and ref(D14,-3)<>1 and ref(D15,-2)<>1 and ref(D16,-1)<>1,1,0);

SetUp:=D8+D9+D10+D11+D12+D13+D14+D15+D16+D17;

SetUp

Regards,


Dr.Chatterjee




mstt  
#5 Posted : Thursday, November 7, 2013 9:42:03 AM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Hi Dr Chatterjee

There are three mistakes in your indicators that I can see, and each one of them is going to cause N/A results. Looking first at the "TD - SetUp-buy" indicator, the error is isn the line
D8:=If(Ref(TD4,1)=1 AND TD5=1,1,0);
The error is with the Ref() function having a parameter of +1 rather than -1. This forces the last bar of any data arry the formula is applied to to return N/A on the last data bar (the bar that is critical for the exploration Filter to function properly).

Secondly the "TD Count Down Buy A" indicator attempts to call the "TD - SetUp-buy" using the incorrect name of "<TD - SetUp-buy>". You must have ignored MetaStock when it reported this error.

The third error also appears in the "TD Count Down Buy A" indicator, another example of a forward looking Ref() function (+1 instead if -1) applied to the incorectly named indicator.
ValueWhen(1,Ref( Fml( "<TD - SetUp-buy>" ), 1)=1.

Roy

gorachand  
#6 Posted : Friday, November 8, 2013 11:15:09 PM(UTC)
gorachand

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 2/19/2012(UTC)
Posts: 106

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Works like a charm.Thanks a million Roy.

Regards,

Dr.Chatterjee


gorachand  
#7 Posted : Saturday, November 9, 2013 11:18:02 AM(UTC)
gorachand

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 2/19/2012(UTC)
Posts: 106

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Th TD Count Down Buy A coded as :-

Cum(If(CLOSE<Ref(CLOSE,-2),1,0))-ValueWhen(1,Ref( Fml( "TD - SetUp-buy" ), -1)=1, Cum(If(CLOSE<Ref(CLOSE,-2),1,0)))


does not plot as binary values---is that by design or error?

Regards,

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