PureBytes Links
Trading Reference Links
|
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@xxx> 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 ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
*********************
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
*********************************
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:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto: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/
|