* To: <metastock@xxxxxxxxxxxxx>
* Subject: Re: Referencing X bars back
* From: "Roy Larsen" <rlarsen@xxxxxxxxxxxxxx>
* Date: Thu, 3 Jan 2002 13:43:09 +1300
* References: <OE36O5iP07zViC68xSp0000c11e@xxxxxxxxxxx>
* Reply-To: metastock@xxxxxxxxxxxxx
* Sender: owner-metastock@xxxxxxxxxxxxx Glynn
> 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.
{Exploration} | |
Referencing X Bars Back
ColumnA: B/Since
BarsSince(Cross(Mov(CLOSE,50,S),Mov(CLOSE,200,S)));
ColumnB: -2 Bars
Bars:=LastValue(BarsSince(Cross(Mov(CLOSE,50,S),Mov(CLOSE,200,S))));
Abs(LastValue(Ref(Mov(C,50,S),-Bars-2)- Ref(Mov(C,200,S),-Bars-2)));
ColumnC: -1 Bar
Bars:=LastValue(BarsSince(Cross(Mov(CLOSE,50,S),Mov(CLOSE,200,S))));
Abs(LastValue(Ref(Mov(C,50,S),-Bars-1)- Ref(Mov(C,200,S),-Bars-1)));
{Recommend you use minimum 500 bars, preferably more}
| |