you still need to loop through the signals as I think you originally
had, not trades.
then have   bo.ProcessTradeSignals( bar );  after the signal loop
I was just trying to show the additional lines of code you needed to include


SetCustomBacktestProc("");

if ( Status( "action" ) == actionPortfolio )
{
  bo = GetBacktesterObject();
  bo.PreProcess(); // Initialize backtester

  for(bar=0; bar < BarCount; bar++)
  {
    for( sig = bo.GetFirstSignal(); sig; sig = bo.GetNextSignal() )
    {
      if( sig.IsExit() )
      {
       if ( sig.IsLong() ) ExitTrue  = sig.Price - Slippage;
       else   ExitTrue  = sig.Price + Slippage;
       sig.Price = ExitTrue;
     }
   }
   bo.ProcessTradeSignals( bar );
  }

 bo.PostProcess(); // Finalize backtester
}



-- 
Cheers
Graham Kav
AFL Writing Service
http://www.aflwriting.com

Reply via email to