Hi there,

I've faced an identical problem. Does anyone have an idea how to overcome this?


Thanks,

Marius

--- In [email protected], "markhoff" <markh...@...> 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 [email protected], "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) b...@open------------>s...@close
> > Trade #2 (B)                       b...@open------------>s...@close
> > 
> > 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 b...@open (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 s...@close 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 ---
> >
>


Reply via email to