PureBytes Links
Trading Reference Links
|
Glynn,
I think you want something like this:
valuewhen( 1, Cross( Mov( CLOSE, 50, S ), Mov(
CLOSE, 200, S ) ), ref( mov( C, 200, S ) - mov( C, 50, S ), -1 )
)
for the prior day, and
valuewhen( 1, Cross( Mov( CLOSE, 50, S ), Mov(
CLOSE, 200, S ) ), ref( mov( C, 200, S ) - mov( C, 50, S ), -2 ) )for
the day before that.
(I didn't test those...)
ref( x, -n ) gives you the value of expression x n
periods ago, where n is a constant; e.g., for daily data, ref( mov( C,
200, S ), -1 ) is yesterday's value of a 200-day simple moving average of
the close. So, ref( C, -6 ) would give you the close 6 bars ago.
David
<BLOCKQUOTE
style="BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
----- Original Message -----
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black">From:
Glynn
Chamberlain
To: <A
href="mailto:metastock@xxxxxxxxxxxxx"
title=metastock@xxxxxxxxxxxxx>metastock@xxxxxxxxxxxxx
Sent: Wednesday, January 02, 2002 2:16
PM
Subject: Referencing X bars back
Hi there everyone,
I have been lurking on the list for the last few
months and found the list a wealth of information.
I now need some help with a formula for an
exploration I am fiddling with.
I have an Alert Exploration showing which shares
have had a 50 day Moving average cross above a 200 moving average. The Alert
shows how many days ago the last cross over occurred. The formula is as
follows:-
<FONT face=Arial
size=2>BarsSince(Cross(Mov(CLOSE,50,S),Mov(CLOSE,200,S)))
What I would now like to do is find out what the
numerical difference between the 200 and 50 day moving ave for both days
"before" the occurrence was.
So theoretically if the alert showed that the
crossover happened 12 days ago, Col B and Col C would show the Moving average
difference for 13 and 14 days previously.
Can someone help with the formula. I would really
appreciate it.
A last question. How would I write a formula
referencing x bars back. I.E. If I wanted to know the close of 6 bars ago, how
would I write this. I have searched like mad through the MS help, but just
cant seem to find it. I am sure it is a mental block.
Thanks for any help.
Many regards
Glynn
|