| 
 PureBytes Links 
Trading Reference Links 
 | 
Title: Message
 its 
indeed quite tricky Graham,  I am not sure if you turnoff and on padding 
within AFL, if it is possible, you could use optimize to have 2 runs, the 1st 
run with padding selected to obtain value for XAOFB, and the second time with 
padding turn off to obtain LQ. I looked but could not find how AA turns it 
off. 
Without that, One could use param to run it 2 times 
with out changing the code itself. 
----------------------------- 
XAOFB =  ParamDate("Startdate", 
"2004-08-31");
run =  Param("run", 
0, 0, 1, 1); // run 1 is to obtain the XAOFB date
XAOPer =  100;
if  (run ) {
XAOFB =  LastValue(Ref(DateNum(),-100));
} 
Per =  BarsSince( 
Cross( DateNum(), XAOFB ) ) + 1;
LQ =  LastValue(Per)/XAOPer;
Filter=LQ >  0.95;
WhenDate =  ValueWhen( 
BarIndex()==(BarCount-101), DateNum() );
WhenBars =  BarsSince( 
Cross(DateNum(), WhenDate) );
AddColumn ( WhenDate, "date ?", 1 
);
AddColumn ( WhenBars, "bars=100 ?", 
1 ); 
AddColumn ( LQ, "LQ");
AddColumn (XAOFB, "XAOFB");
AddColumn (XAOPer, "XAOPer");
AddColumn (Per, "Per"); 
  
  
-----Original Message----- From: 
Graham [mailto:kavemanperth@xxxxxxxxx]  Sent: Sunday, 23 January 2005 
10:52 AM To: amibroker@xxxxxxxxxxxxxxx Subject: [amibroker] 
Counting the bars
 
  
I want to run and exploration over 
  the past 100 bars of actual market days in an unpadded database. However is 
  does not seem to be as easy as I thought to do it is a single step. If I do 
  it straight off I get different first dates for tickers as some days are 
  not traded. but if I reference it to padding to a reference ticker, eg an 
  index, then every ticker has the same number of bars in the reports whether 
  they traded all the time or not. Essentially I want to explore for 
  tickers that have trade more than 95% of the past 100 market days. I can 
  do it in 2 steps by finding the date of 100 days ago in the index, then 
  manually put this date into my explorations
  Step 1, explore on 
  index XAOPer = 100; XAOFB = ValueWhen( BarIndex()==(BarCount-1-XAOper), 
  DateNum() ); Filter=1; AddColumn( XAOFB, "datenum", 1 );
  Step 
  2 XAOFB = 1040831; // manually enter from previous explore results Per = 
  BarsSince( Cross( DateNum(), XAOFB ) ) + 1; LQ = ( LastValue(Per)/XAOPer ) 
  > 0.95;
 
  With this code I have tried the AA settings to pad and 
  not pad, but does not give me the right results as explained 
  above
  WhenDate = ValueWhen( BarIndex()==(BarCount-101), DateNum() 
  ); WhenBars = BarsSince( Cross(DateNum(), WhenDate) 
  ); Filter=1; AddColumn( WhenDate, "date ?", 1 ); AddColumn( WhenBars, 
  "bars=100 ?", 1 ); 
 
 
 
  Hoping someone can help
 
  -- 
   Cheers Graham http://e-wire.net.au/~eb_kavan/
 
  Check 
  AmiBroker web page at: http://www.amibroker.com/
  Check 
  group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  
  
  
Check AmiBroker web page at: 
http://www.amibroker.com/ 
 
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
  
 
 
Yahoo! Groups Links 
  |