Hello,

You need to call ProcessTradeSignals.

BTW: it is easier to just define custom commission table (AA->Settings 
"Commission table: Define...") 
that includes slippage than wresting with code.

Best regards,
Tomasz Janeczko
amibroker.com
  ----- Original Message ----- 
  From: ozzyapeman 
  To: [email protected] 
  Sent: Thursday, March 19, 2009 2:31 AM
  Subject: [amibroker] Re: Simple slippage implemented in CBT generates COM 
error


  Okay on #1, I realize that the COM error was due to the bit of legacy code:  
SetCustomBacktestProc( "" );

  However, the slippage code seems to have no effect whatsoever on the backtest 
trade report.

  What might I be doing wrong?



  --- In [email protected], "ozzyapeman" <zoopf...@...> wrote:
  >
  > Hello, hoping someone can help on this. I am using ApplyStop, which does
  > not have a slippage factor. I'm trying to avoid using a BarCount loop to
  > implement slippage on exits and instead am trying to modify the signal
  > list of the CBT to implement slippage, before the backtester engine
  > processes the trades.
  > 
  > But I am running into two problems, namely:
  > 
  > 
  > 1. Get error COM method/function 'GetFirstSignal' call failed, on the
  > for loop line, even though that line and prior ones were copied and
  > pasted direct from the reference guide.
  > 
  > 
  > 2. More of a question at this point: What if my calculation of ExitTrue
  > price is below the Low, or above the High of the bar? Will the
  > backtester engine simply ignore that signal? Or is there some way I can
  > filter out that possibility directly in the code below?
  > 
  > 
  > 
  > In this example, Slippage = 0.0002 elsewhere in my code, backtesting on
  > Forex:
  > 
  > 
  > SetCustomBacktestProc( "" );
  > 
  > if ( Status( "action" ) == actionPortfolio )
  > {
  > bo = GetBacktesterObject();
  > 
  > for( sig = bo.GetFirstSignal(); sig; sig = bo.GetNextSignal() )
  > {
  > if( sig.IsExit() )
  > {
  > if ( sig.IsLong() ) // Exit Long
  > {
  > ExitTrue = sig.Price - Slippage;
  > sig.Price = ExitTrue;
  > }
  > 
  > else // Exit Short
  > {
  > ExitTrue = sig.Price + Slippage;
  > sig.Price = ExitTrue;
  > }
  > 
  > }
  > }
  > }
  >



  

Reply via email to