Paul
The function you need to use is BarsSince as shown below.
Run this as an Explore against a Filter = family or ALL, and N last quotations
= 1 and you'll get all crosses that occurred over the
last ten bars.
// Filter= EMA(C,5) Cross EMA(C,10) within last 10 periods;
Cond1 = Cross(EMA(C,5),EMA(C,10));
Cond2 = BarsSince(Cond1);
Filter = Cond2 <= 10 AND Cond2>0;
AddColumn(Cond1,"Cross");
AddColumn(Cond2,"Bars Since Cross");
AddColumn(Filter,"Filter");
OR SET the filter as
Filter = Cond2 <= 10 AND Cond2>0 AND Status("LastBarinRange");
AND THE SCRIPT WILL BE A LITTLE MORE FORGIVING AS TO WHERE YOU SET THE DATE
RANGE
Hope this helps
Joe L.
----- Original Message -----
From: paulradge
To: [email protected]
Sent: Monday, November 26, 2007 11:41 PM
Subject: [amibroker] moving av cross over advice please
Hi,
i tried posting this via the yahoo web site but it never came
through so posting directly,,,,(just in case it doubles up)
i'm trying to build an exploration that looks for 2 moving av's to have
crossed over within the last number of periods,,,i can build one for cross
over today but i'd like to build one that has crossed over "within" the last
number of periods.
ie
filter= ema(c,5) cross ema(c,10) within last 10 periods;
any advice or direct help please,,,
regards
Paul