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

[amibroker] trades missed in backtest



PureBytes Links

Trading Reference Links


Hi all,

I've got a problem with a backtest I've been running.  It's a very
simple AFL code to set up (must be if I can do it) however I'm getting
a problem.

The system is designed to buy stock 'X' if it closes within a
specified range, and then sell it at the next day's open.  I have:

BuyPrice = Close ;
Sell = Ref (Open, 1) > 0.01 AND /*dummy variable to force next day
sell at open*/
SellPrice = Open ;

In settings, Buy Price is Close and Sell Price is Open.  All stops are
disabled.  In the Portfolio tab, max open positions is set to 1.

If I set "Allow Same Bar Exit (single bar trade) in the settings
window, then all the correct days are traded but at the wrong price. 
My buy price is correct but my sell price is the high of the purchase
date, not the open of the next day.

If I untick the "Allow Same Bar Exit" box, then the buy and sell
prices are correct but if the trade signal occurs two days in a row,
the system will not purchase the stock on the second day (I guess
Amibroker thinks I'm doing a short sell single bar trade instead of
two separate long trades).

Next I tried ticking "activate stops immediately" and this made no
dirrerence.

I get the feeling this is a really simple thing to fix but for some
reason it's been eluding me.

Any help appreciated.

Chris





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> 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/