PureBytes Links
Trading Reference Links
|
To Nicholas, Wander, David, Lionel, Bob, et al:
To All looking at my U1 problem, let me restate the code, since I took the
easy way out and really cut it down to simplify it.
Basically this is the U1 function:
If Mnumb = 0
U1 = prev U1
Else
If C_Bar > 0
U1 = ((prev U1 * C1) + Mnumb)/(C1+1)
Else
U1 = (prev U1 * C1)/(C1+1)
Endif
Endif
This is a slight abbreviation of the U1 code. As you can see, the thought
behind the code is as follows: If some number (Mnumb) is equal to 0 then U1
= prev U1 otherwise if the C_bar > 0, U1 is a modified moving average. If
C_bar is <= 0, U1 is slightly less than it would be if C_bar > 0. U1, U2,
D1 and D2 are four components that make up the majority of our short term
and long term momentum calculations.
There's no problem in TAS, but I was hoping to eliminate running two
different programs.
Based on what Bob and wander say, I'm going to add the code to MS tonight
and give it a whirl. I'll post my results as to whether it works. Have to
wait for the 9 year old to get to bed. Still sick with a high fever.
That's going on 11 days now and nobody knows what the heck is happening.
Today we did the blood work. Checking for everything under the sun
including Hep A, parasites, Epstein-Barr and Mono, and a bunch of others 3rd
world disorders. Ain't living in So. CA wonderful?
Regards
Guy
-----Original Message-----
From: owner-metastock@xxxxxxxxxxxxx [mailto:owner-metastock@xxxxxxxxxxxxx]
On Behalf Of David McAdoo
Sent: Tuesday, June 29, 1999 12:04 PM
To: metastock@xxxxxxxxxxxxx
Subject: Re: Variables
Thanks Bob for the info on TAS...I am enlightened! :>)
Maybe Guy has something he'd rather say, but let me take a crack at it:
He wants to calculate a value, call it U1.
It involves 5 other variables/functions called A-E, plus yesterday's value
of U1.
IF (A > B) then
U1 = (C * D) + yesterday's U1
ELSE
U1 = (C * D) + E.
END IF
In other words, for 1 condition his calculation includes yesterday's U1,
otherwise he just makes a straight calculation. Basically this is a
recursive or iterative equation.
I don't know whether variables A,B,C,D, and E are strictly from today's
calculations or from yesterday's, but he was asking about whether MS had
the ability to keep values around in variables between scans.
Hope I didn't step on anyone's toes trying to explain this!
Dave McAdoo
Colorado Springs, CO
================
----- Original Message -----
From: Bob Jagow <bjagow@xxxxxxx>
To: <metastock@xxxxxxxxxxxxx>
Sent: Tuesday, June 29, 1999 9:44 AM
Subject: RE: Variables
> Guy,
> I can't help because I have a problem visualizing what you are trying to
do
> from
> ---
> Today's U1 := IF A > B
> then
> (C * D) + Prev U1
> ELSE
> (C * D) + E
> ENDIF
> ---
> I know you worry about theft of the Holy Grail, but could you could
> divulge [or make up] some a little more concrete?
>
> Bob
> bjagow@xxxxxxx <mailto:bjagow@xxxxxxx>
>
>
> -----Original Message-----
> From: owner-metastock@xxxxxxxxxxxxx
> [mailto:owner-metastock@xxxxxxxxxxxxx]On Behalf Of Guy Tann
> Sent: Monday, June 28, 1999 10:57 PM
> To: metastock@xxxxxxxxxxxxx
> Subject: RE: Variables
>
>
> Lionel
>
> It's hard to believe that a package such as MetaStock doesn't have the
> capability to save something as simple as 10 variables at the end of each
> day's calculation and pass them to the next day for use. Would really
> simplify my programming, to say the least. The more I look at it, the
> closer I get to working on that Downloader/Excel interface.
>
> Guy
>
>
> -----Original Message-----
> From: owner-metastock@xxxxxxxxxxxxx [mailto:owner-metastock@xxxxxxxxxxxxx]
> On Behalf Of Lionel Issen
> Sent: Monday, June 28, 1999 9:43 PM
> To: metastock@xxxxxxxxxxxxx
> Subject: Re: Variables
>
> Guy:
>
> You cannot do in Metastock what youcan easily do in TAS.
>
> Lionel Issen
> ----- Original Message -----
> From: Guy Tann <grt@xxxxxxxxxxxx>
> To: Metastock <metastock@xxxxxxxxxxxxx>
> Sent: Monday, June 28, 1999 5:17 PM
> Subject: Variables
>
>
> > To All:
> >
> > OK, I dragged out the MetaStock manual and have read all about
variables.
> > On the surface, I question whether or not I'll be able to accomplish in
> > MetaStock what I do in TAS.
> >
> > Here's what I need to do:
> >
> > 1- I have 4 intermediate indicators which I use to calculate my short
> term
> > and long term momentums. In order to work within MS for DOS, I
developed
> an
> > approximation for this calculation that works pretty good, however it
> > doesn't replace the original calculations. For these original
> calculations,
> > I need to use TAS.
> > 2- What I need to do is save the results from the previous day's
> calculation
> > for these 4 indicators. I don't believe that the PREV function will
> work,
> > in so far as my calculations would be circular in nature, without these
4
> > variables.
> > 3- Is there any way in MetaStock to set up a simple set of buckets that
I
> > could use in my calculations? I need a place to store 4 intermediate
> totals
> > and be able to use them the next day. In TAS, it effectively builds
> arrays
> > of each variable and you can reference any one of them, any number of
> days
> > back.
> >
> > An example of what I'm talking about is:
> >
> > Today's U1 := IF A > B
> > then
> > (C * D) + Prev U1
> > ELSE
> > (C * D) + E
> > ENDIF
> >
> > Since U1 Prev is dependent upon the previous day's values of A and B,
> unless
> > MS provides a bucket somewhere to hold the value of the previous day's
> U1,
> > the system will have to go into a loop in order to calculate today's U1,
> > thereby recalculating U1 to the nth each day. I hope this makes sense.
> >
> > Correct me if I'm wrong, but I didn't see mention of independent
> variables
> > being available. All variable references I saw, referred to variables
> that
> > were calculated and used on the same day. Granted, since I don't know
> how
> > MS will perform my calculations, I have to assume that this feature
isn't
> > there.
> >
> > If anybody could point to a place in the MS manual, I'd appreciate it.
> >
> > Thanks
> >
> >
> > Guy Tann
> > grt@xxxxxxxxxxxx
> >
> >
>
>
>
|