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

Notification

Icon
Error

Options
Go to last post Go to first unread
Derek Worswick  
#1 Posted : Tuesday, May 27, 2014 2:09:01 PM(UTC)
Derek Worswick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 8/11/2005(UTC)
Posts: 104

Hi,

Is it possible to shorten the attached code so that I can add more lines of code?

To run the formula in Metastock you need the “NEXUS DATE PLUGIN “ NexusDate DLL
Link below
Thank you in advance

Derek
--------------------------------------------------------

NEXUS DATE PLUGIN

http://www.tradernexus.com/nexusdate/ "> http://www.tradernexus.com/nexusdate/ untDown<=days OR Cum(1)=1;

signal:=signalZone*Alert(signalZone=0,2)

OR Cum(1)=1;

calRef:=If(signal,ValueWhen(1,signal,100),0);

signal;

days:=144;

calendar:=ExtFml("NexusDate.DaysOld");

countDown:=calendar-LastValue(calendar);

signalZone:=countDown<=days OR Cum(1)=1;

signal:=signalZone*Alert(signalZone=0,2)

OR Cum(1)=1;

calRef:=If(signal,ValueWhen(1,signal,100),0);

signal;

days:=233;

calendar:=ExtFml("NexusDate.DaysOld");

countDown:=calendar-LastValue(calendar);

signalZone:=countDown<=days OR Cum(1)=1;

signal:=signalZone*Alert(signalZone=0,2)

OR Cum(1)=1;

calRef:=If(signal,ValueWhen(1,signal,100),0);

signal;

days:=365;

calendar:=ExtFml("NexusDate.DaysOld");

countDown:=calendar-LastValue(calendar);

signalZone:=countDown<=days OR Cum(1)=1;

signal:=signalZone*Alert(signalZone=0,2)

OR Cum(1)=1;

calRef:=If(signal,ValueWhen(1,signal,100),0);

signal;

days:=377;

calendar:=ExtFml("NexusDate.DaysOld");

countDown:=calendar-LastValue(calendar);

signalZone:=countDown<=days OR Cum(1)=1;

signal:=signalZone*Alert(signalZone=0,2)

OR Cum(1)=1;

calRef:=If(signal,ValueWhen(1,signal,100),0);

signal;

days:=610;

calendar:=ExtFml("NexusDate.DaysOld");

countDown:=calendar-LastValue(calendar);

signalZone:=countDown<=days OR Cum(1)=1;

signal:=signalZone*Alert(signalZone=0,2)

OR Cum(1)=1;

calRef:=If(signal,ValueWhen(1,signal,100),0);

signal;

days:=987;

calendar:=ExtFml("NexusDate.DaysOld");

countDown:=calendar-LastValue(calendar);

signalZone:=countDown<=days OR Cum(1)=1;

signal:=signalZone*Alert(signalZone=0,2)

OR Cum(1)=1;

calRef:=If(signal,ValueWhen(1,signal,100),0);

signal;

days:=1597;

calendar:=ExtFml("NexusDate.DaysOld");

countDown:=calendar-LastValue(calendar);

signalZone:=countDown<=days OR Cum(1)=1;

signal:=signalZone*Alert(signalZone=0,2)

OR Cum(1)=1;

calRef:=If(signal,ValueWhen(1,signal,100),0);

signal;

days:=2584;

calendar:=ExtFml("NexusDate.DaysOld");

countDown:=calendar-LastValue(calendar);

signalZone:=countDown<=days OR Cum(1)=1;

signal:=signalZone*Alert(signalZone=0,2)

OR Cum(1)=1;

calRef:=If(signal,ValueWhen(1,signal,100),0);

signal; [/code]


mstt  
#2 Posted : Tuesday, May 27, 2014 6:10:26 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 Derek

There's a much simpler way of counting calendar days using the Life() function. Jose Silva came up with this tip several years ago and I've used it in three of the six Multi-Frame range of formulas (D, I and X series). At one point Jose had a "Day Counter" formula on his website - don't know if it's still there. Wabbit pointed me to public domain day counter that fills the same role for the slightly more demanding D+ and ID Multi-Frame series of indicators.

The Life() function counts down to day zero (N/A I think) on the 31st of December 2029 (or any other date prior to that) and it can be converted to an up-counter with very little effort. I siggest that you use it with the Rnd() function - Rnd(Life(291231)) - to eliminate the tiny fractional errors that MetaStock otherwise somehow introduces.

Email me if you don't have easy access to a D-series Multi-Frame formula and I'll send you something to work with.

Roy
Users browsing this topic
Guest (Hidden)
Similar Topics
Calendar days <-> bar periods utility (Advanced Coding Techniques)
by Jose 7/30/2006 4:43:19 AM(UTC)
Re: Calendar days <-> bar periods utility (Forum Feedback)
by crwinnr5 7/30/2006 4:18:12 AM(UTC)
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.