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

RE: Need Help on If Function....



PureBytes Links

Trading Reference Links

One can also plot an indicator that starts in the middle of your chart by
using the date functions.

neo

-----Original Message-----
From: owner-metastock@xxxxxxxxxxxxx
[mailto:owner-metastock@xxxxxxxxxxxxx]On Behalf Of Dave Nadeau
Sent: Sunday, December 24, 2000 10:34 AM
To: metastock@xxxxxxxxxxxxx
Subject: Re: Need Help on If Function....


Ong,

YES, you can plot an indicator that starts somewhere in the middle of your
chart.

To plot an indicator, Metastock will evaluate all variables within the
expression and won't plot anything until each one is defined
(i.e. "not null").  This can be an advantage or disadvantage, depending on
what you are trying to do.  You can see this in action by
plotting an indicator, say RSI(9) on a chart.  Look at bars 1-9.  There's no
graph of the RSI because MetaStock can't calculate
RSI(9) based on the data yet.

So, in this case, by using a function which is not defined until later in
the chart you can begin plotting an indicator anywhere you
like, depending on how you set the definition of your variables.

Here's an example:

CUSTOM INDICATOR

StartInd:=Cum(1)=50;
StartPt:=ValueWhen(1,StartInd<>0,1);
If(StartPt=1,RSI(9),0)

This example uses number of bars to set the starting point.  You can adjust
the "StartInd" to be equal to 150 or 300 or any value
you'd like.

Let's say you want to start the indicator when the close first crosses above
100:

StartInd:=If(Close>100,1,0);
StartPt:=ValueWhen(1,StartInd<>0,1);
If(StartPt=1,RSI(9),0)

Try these out on a plot, and you'll see that you can start your indicator
anywhere you'd like.

Dave Nadeau
Fort Collins, CO


Dave Nadeau
Fort Collins, CO



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com