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

[amibroker] Re: backtester interface



PureBytes Links

Trading Reference Links

thanks for the reply. I'll give it a try.

Jonathan

--- In amibroker@xxxxxxxxxxxxxxx, "vlanschot" <vlanschot@xxx> wrote:
>
> It depends where you want to have it. If you use a detailed report, 
> you can add:
> 
> price = openpos.getprice(bar,"O");  
> bo.RawTextOutput("Open Price: " + price) ; 
> 
> In general, bo.addcustommetric("O",price) should be used at the end 
> of the BT-process for 1 particular value of an array (usually 
> LastValue. 
> 
> If your idea is to have each open reported for each of your open 
> trades (and I don't know the rest of your code), you could try to put 
> it this way, by changing it into:
> 
> price = openpos.getprice(bar,"O"); 
> openpos.addcustommetric("O",price);
> 
> You need to use this BEFORE you call postprocess.
> 
> PS
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "Bozwood" <bozwood@> wrote:
> >
> > Ed,
> > 
> > tried this last night and, for whatever reason, it didn't work. it 
> ran
> > ok, but no "open" metric was added to the backtester/optimization
> > report. any ideas? or, any advice on how you learned to program with
> > the backtester interface?
> > 
> > thanks,
> > 
> > Jonathan
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "Edward Pottasch" <empottasch@>
> > wrote:
> > >
> > > try this:
> > > 
> > > SetOption("UseCustomBacktestProc", True ); 
> > > 
> > > if(Status("action")== actionPortfolio) {
> > > 
> > >  bo = GetBacktesterObject();
> > >  bo.PreProcess();
> > > 
> > >  for( bar = 0; bar < BarCount; bar++ ) {
> > >  
> > >   bo.processtradesignals(bar);
> > > 
> > >   for( openpos = bo.GetFirstOpenPos(); openpos; openpos =
> > bo.GetNextOpenPos() ) {
> > >  
> > >    price = openpos.getprice(bar,"O");  
> > >    bo.addcustommetric("O",price);
> > >   
> > >   }
> > >   
> > >  }
> > >  bo.PostProcess();
> > >  
> > > }
> > > 
> > > rgds, Ed
> > > 
> > > 
> > >   ----- Original Message ----- 
> > >   From: Bozwood 
> > >   To: amibroker@xxxxxxxxxxxxxxx 
> > >   Sent: Sunday, May 06, 2007 4:11 PM
> > >   Subject: [amibroker] backtester interface
> > > 
> > > 
> > >   I am attempting to gain access to the price bar in order to make
> > >   calculations using open, close, etc. This is just a simplified 
> example
> > >   where I am trying to access the open and add it to the
> > >   backtester/optimizer output. I am likely doing multiple things 
> wrong
> > >   with the code, but I am sure what. Any help would be 
> appreciated.
> > > 
> > >   if(Status("action")== actionPortfolio)
> > >   {
> > >   bo = GetBacktesterObject();
> > >   bo.preprocess();
> > >   for(bar=0; bar<BarCount; bar++)
> > >   {
> > >   bo.processtradesignals(bar);
> > >   for(pos= bo.getfirstopenpos(); pos; pos= bo.getnextopenpos())
> > >   {
> > >   price= pos.getprice(bar,"o");
> > >   bo.addcustommetric("O",price);
> > >   }
> > >   }
> > >   bo.postprocess();
> > >   }
> > > 
> > >   SetTradeDelays( 1, 1, 1, 1 );
> > >   PositionSize = MarginDeposit;
> > > 
> > >   BuyPrice= Open;
> > >   SellPrice= Open;
> > > 
> > >   Buy= Cross(Signal(), MACD());
> > >   Sell= Cross(MACD(), Signal());
> > >
> >
>




Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

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

For other support material please check also:
http://www.amibroker.com/support.html
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/