[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question on calculation



PureBytes Links

Trading Reference Links

Guy's FAQs.................

Regards,
Ton Maas
ms-irb@xxxxxxxxxxxxxxxx
Dismiss the ".nospam" bit (including the dot) when replying.
Homepage  http://home.planet.nl/~anthmaas


----- Original Message ----- 
From: "Guy Tann" 
To: "Metastock User Group" <metastock-list@xxxxxxxxxxxxx>
Sent: woensdag 19 juli 2000 1:18
Subject: Question on calculation


> List,
> 
> Well I'm in the process of trying to move our Intermediate Term Signals into
> MetaStock and need a little help.
> 
> First, here are a few of my assumptions I made after reviewing the latest
> manual (v7.01).
> 
> 1. Variables go away after each day (we're EOD traders, so daily is our time
> frame).

Put in other words: Variables are always 'recalculated' each new day.

> 2. The only way you can reference a prior day's value is by using PREV or by
> plotting the indicator and using the "P" Data Array Identifier.

There are 2 ways to reference a prior period's value, but you must distinguise for
yourselves, if you want to make use of the total formula's value{eg the Function or
Custom Indicator} or part of that Function (part of formula's) value.

PREV
Using PREV you calculate a prior day's value for that Function(=Formula) or part
of that Function(=Formula) that you referencing using between braces ( ).

Ref(C,-1) or Ref(fml "Close",-1)
1st Ref will calculate the prior Close, based on the standard in MetaStock build-in
Price indicator, eg Close {Not listed+by default plotted with the Price indicator(=BaseSecurity)}.
2nd Ref will calculate the prior Close, now based on a custom created Close indicator, eg
Close {Listed among the set of Custom indicators}

This latter way of calculating the same intended prior period's value for that Function or part of
that Function's formula, is a workaround way that you can use to omit having to use the PREV Function.
Eg, create another now exact duplicate Function{=custom indicator, click Copy}, now give it a different
name, and reference this duplicate, and MetaStock will not return an error, which it will do should you've
referenced the original custom indicator {when for both using the FML Function call:
fml("indicator")}. 

> 3. The only way to reference the previous 20 values of an indicator is by
> using the "P" Data Array Identifier.

The "P" is dropped on the plotted indicator, eg a Chart has to be Open.
Irrelevant I believe for your system's way of calculating {unless you want to use the Close
or so of another Security}.

> 4. Plotting of indicators is irrelevant for our system, so I'm only
> interested in a programming solution.

See the workaround above.

> 
> Questions:
> 
> 1. Is there any way to build an array or list of variables that you can
> programmatically control?  For instance, I want to maintain the last 20
> values of a specific indicator and keep them for use on the next day.  At
> then end of each days processing, I would move X17 to X18, thereby dropping
> the previous X18.  X16 to X17, etc., thereby getting ready for the next days
> result, which I would store in X.

Yes. Create the Functions{=custom indicators}. See above workaround.
In your case, create 20 or so custom indicators, that all use the Ref Function, but
with using a regular interval, or create one(1) custom indicator that lets itselve
being referenced using a regular interval
{Eg Ref(fml("indicator",-1) , next would be Ref(fml("indicator",-2)}.

> 2. Is there any way that I can maintain multiple PREV values for an
> indicator?  What about PREV -1 and PREV -2?

See workaround above. Use the Ref Function in place of the PREV.
{it will speed up calculations}.

> 
> In our Intermediate Term System, we have an indicator we calculate whereby
> we maintain the last 18 results, always keeping the last 18 values available
> to us for calculations.  We use the first 6 for a short-term indicator, the
> second six for an intermediate-term indicator and the final six for a
> long-term indicator.

Use the workaround mentioned above.

> 
> I'm trying to avoid having to do much additional programming outside of
> MetaStock, if possible, so I would appreciate any assistance.  Does anyone
> know of an add-in that's available that would provide array or table
> capabilities to MetaStock?

True, it is kind of programming, but basic + simply programming:
eg, creating Functions{=custom indicators}. 

> 
> Thanks for any help.

Send mail privately if you need more info or assistance.

> 
> Guy
> 
> Paranoia...you only have to be right once to make it all worthwhile!
> 
> 
>