Hello Mike,
   
  the site from which diownload DebeugView frewware 
  seems to be down.
   
  So, I have no way of seeing trace output at this 
  point.
   
  I tried to display it in Exploration mode, but I 
  couldn´t figure out how to format 
  addcolumn(Date_first_portfolio_bar,??????);
   
  To be able to display the date of any bar under 
  backtest, can´t I somehow use the (corrected) code (i.e. loop) since _I 
  may need to dispplay a couple of dates in my code??
   
  Thanks
   
  Markus
   
   
  
    ----- Original Message ----- 
    
    
    Sent: Friday, January 15, 2010 8:47 
    PM
    Subject: [amibroker] Re: Retrieving 
    first bars date in CBT
    
  
    
    
    SetCustomBacktestProc( 
    "" 
    ); 
if ( Status( "action" ) == actionPortfolio ) 
{ 
    
    StaticVarSet( 
    "Date_first_portfolio_bar", 
    Status("rangefromdate") ); 
    
    bo = GetBacktesterObject(); 
    
    bo.PreProcess(); 
    
     for ( bar = 
    0; bar < BarCount; bar++ ) 
    
    { 
    
        ...; 
    
    } 
    
    bo.PostProcess(); 
    
     _TRACE( 
    "Date of first bar: " + StaticVarGet( "Date_first_portfolio_bar" ) ); 
} 
    
    
Mike
    
>
> Hello,
> 
> I need to retrieve the first 
    bar´s date (neither the first signal´s nor the first trade´s) and store it 
    as a static variable for computation of a custom metric 
    (bo.addcustommetric) in a later step.
> 
> I figured it´s 
    the following, but supposedly, on can´t use datenum() in CBT? I only found 
    properties for retrieving bar´s date within signal or trade lists!
> 
    
> Thanks 
> 
> Markus
> 
> - - - - - - - - 
    
> 
> SetCustomBacktestProc("");
> 
> if 
    (Status("action") == actionPortfolio)
> 
> {
> 
    
> bo = GetBacktesterObject(); // Get backtester object
> 
    
> bo.PreProcess(); // Do pre-processing
> 
> 
    bo.cash=bo.initialEquity=1000000; 
> 
> Heat=0.1;
> 
    
> ATRmultiplier=5;
> 
> 
> 
> for (i = 
    0; i < BarCount; i++) // Loop through all bars
> 
> 
> 
    { if (i=0)
> 
> 
    StaticVarSet("Date_first_portfolio_bar", DateNum(i));
> 
    
> for (sig = bo.GetFirstSignal(i); sig; sig = 
    bo.GetNextSignal(i))
> 
> ...
>
     
__________ Information from ESET Smart Security, 
    version of virus signature database 4668 (20091207) __________
The 
    message was checked by ESET Smart Security.
http://www.eset.com