[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Re: Retrieving first bars date in CBT


  • Date: Sun, 17 Jan 2010 23:34:45 +0100
  • From: "Markus Witzler" <funnybiz@xxxxxx>
  • Subject: Re: [amibroker] Re: Retrieving first bars date in CBT

PureBytes Links

Trading Reference Links



Mike,
 
I may have found a way:
 
I just inserted

a = DateNum();

if ( i == 0)

StaticVarSet("first_bars_date",a[0]);

in the CBT for loop. I then can set "i" to any bar number I want and have it displayed with trade.addcustommetric in the trade list.

Thanks though!!!

Markus

 
 
----- Original Message -----
Sent: Sunday, January 17, 2010 8:46 PM
Subject: Re: [amibroker] Re: Retrieving first bars date in CBT

 

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 -----
From: Mike
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

--- In amibroker@xxxxxxxxxps.com, "Markus Witzler" <funnybiz@xxx> wrote:
>
> 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



__________ Information from ESET Smart Security, version of virus signature database 4668 (20091207) __________

The message was checked by ESET Smart Security.

http://www.eset.com


__________ Information from ESET Smart Security, version of virus signature database 4668 (20091207) __________

The message was checked by ESET Smart Security.

http://www.eset.com


__._,_.___


**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___