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

Re: [amibroker] Losing Trades in Custom Backtester



PureBytes Links

Trading Reference Links

hi,

would it be possible to get an additional example where:

1) entry signals (Buy / Short) are defined as usual (outside the custom backtest area) 
2) exit signals (Sell / Cover) are defined inside the custom backtester 
3) code can make use of redundant signals
4) redundant signals can be ranked
5) a backtest is possible on a portfolio level using a list of symbols 

this would allow one to do any backtest desired in my opinion. Or is Mark's suggestion the way to solve this?

thanks, Ed




  ----- Original Message ----- 
  From: Tomasz Janeczko 
  To: amibroker@xxxxxxxxxxxxxxx 
  Sent: Monday, August 07, 2006 10:59 PM
  Subject: Re: [amibroker] Losing Trades in Custom Backtester



  Hello,

  Answer is here: http://www.amibroker.com/kb/2006/04/24/using-redundant-signals-for-entries/


  Best regards,
  Tomasz Janeczko
  amibroker.com
    ----- Original Message ----- 
    From: C Alvarez 
    To: amibroker@xxxxxxxxxxxxxxx 
    Sent: Monday, August 07, 2006 10:04 PM
    Subject: [amibroker] Losing Trades in Custom Backtester


    I am using the Custom Backtester to iterate through the Signal list. Depending on some additional conditions that I only can know at this time, I might decide to skip a trade and set the PosSize = 0. This prevents the trade from happening, as I want.

    The problem is that if I remove a trade from the Signal list and then the Buy array has a buy for the next day, it is not showing up the Signal list. And at this time I might want to take the trade. Any suggestions on how I can do this?

    Here is the simplified code.

    Thanks,
    Cey


    SetCustomBacktestProc("");

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

            for(bar=0; bar<BarCount; bar++)
            {

                    for( sig = bo.GetFirstSignal(bar); sig; sig = bo.GetNextSignal(bar) )
                    {
                            if( sig.IsEntry())
                            {
                                    if (some_condition) // don't take trade
                                    {
                                            sig.PosSize = 0;
                                    }
                            }
                    }

            bo.ProcessTradeSignals(bar); // Process current bar's signals

            }

            bo.PostProcess();
    }