PureBytes Links
Trading Reference Links
|
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@xxxxxxxxxxxxxxx, "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)) > > ... >
__._,_.___
**** 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/
__,_._,___
|