hi Jonathan,

it gave output to the statistics output window when I tested it. 

I am pretty new to CBI coding myself but I am starting to learn a little.  I 
just used the available documentation in Amibroker and some examples. 

Maybe I did not understand what you want to do. Where do you want to write the 
output to? To the AA window or to the Statistics report?  If you want to 
display test in the AA window your need to use:

bo.RawTextOutput( );

regards, Ed




  ----- Original Message ----- 
  From: Bozwood 
  To: [email protected] 
  Sent: Thursday, May 10, 2007 3:25 PM
  Subject: [amibroker] Re: backtester interface


  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 [email protected], "Edward Pottasch" <[EMAIL PROTECTED]>
  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: [email protected] 
  > 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());
  >



   

Reply via email to