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

[amibroker] Re: BUY and SELL signal on same bar cashflow problem


  • Date: Tue, 09 Mar 2010 01:06:34 -0000
  • From: "Mike" <sfclimbers@xxxxxxxxx>
  • Subject: [amibroker] Re: BUY and SELL signal on same bar cashflow problem

PureBytes Links

Trading Reference Links

If nothing else, you could handle it using low level custom backtester code.

Mike

--- In amibroker@xxxxxxxxxxxxxxx, "mbausys" <mbausys@xxx> wrote:
>
> Hi there,
> 
> I've faced an identical problem. Does anyone have an idea how to overcome this?
> 
> 
> Thanks,
> 
> Marius
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "markhoff" <markhoff@> wrote:
> >
> > 
> > Hi,
> > 
> > as a workaround it seems that I can cheat AB by setting:
> > SetTradeDelays(1,1,1,1);
> > This will move the closing trades to the next bar, but it will result
> > in a wrong reporting from the backtester, because now the "Exit Date"
> > for the trade is for instance no longer "day 3" in my example but "day
> > 4". I still hope anybody has a better idea how to solve this issue ...
> > 
> > Best regards,
> > Markus
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "markhoff" <markhoff@> wrote:
> > >
> > > Hi folks,
> > > 
> > > I have a problem with the backtester. I have a trading system which
> > > opens all positions on OPEN price and closes all positions CLOSE
> > > price. Maximum number of positions is set to 1. Now, if I might have
> > > the situation below:
> > > 
> > > Day             1          2          3          4          5
> > > Trade #1 (A) BUY@xxxxxxxxxxxxxxxx>SELL@xxxxx
> > > Trade #2 (B)                       BUY@xxxxxxxxxxxxxxxx>SELL@xxxxx
> > > 
> > > Trade #1 with symbol (A) has a SELL signal on day 3 and some other
> > > symbol (B) has a BUY signal on the same day, and this causes AmiBroker
> > > to make trade #2 also on day 3.
> > > But, in fact this is not possible because there is no
> > > cash available on day 3 to BUY@xxxx (because first I must SELL trade
> > > #1). Therefore, the correct behaviour would be to start trade #2 on
> > > day 4 after the other position for trade #1 was closed. It seems that
> > > AB always asumes that the cash for closing positions is available at
> > > the same bar to start new trades. Please see also the code below.
> > > 
> > > How can I force AB to consider that cash from a SELL@xxxxx is not
> > > available on the same bar?
> > > 
> > > Thanks in advance and best regards,
> > > Markus
> > > 
> > > //--- cut here ---
> > > Buy = Sell = Short = Cover = False;
> > > BuyPrice = SellPrice = ShortPrice = CoverPrice = 0;
> > > SetOption("MaxOpenPositions", 1);
> > > SetPositionSize(100, spsPercentOfEquity);
> > > SetTradeDelays(1,0,1,0);
> > > TradeDays = 3;
> > > BuyPrice = ShortPrice = Open;
> > > SellPrice = CoverPrice = Close;
> > > Buy = ExRemSpan(True, TradeDays);
> > > Sell = Ref(Buy, -TradeDays); 
> > > //--- cut here ---
> > >
> >
>




------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

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

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:
    amibroker-digest@xxxxxxxxxxxxxxx 
    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/