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

[amibroker] Problem with BarsSince() & .BarsInTrade in custom backtester



PureBytes Links

Trading Reference Links

Hi,

I was programming the custom backtester to obtain trade delays.  It's 
a pretty simple version whereby I just grab the entry date and exit 
date, convert it to datenum format and just use /100 and the int() & 
frac() to obtain the dates and months and basically subtract the date 
and month values to obtain the actual number of days that the 
positions are being held.

The reason why I did this was because I thought that the BarsSince() 
function and the .BarsInTrade() property were based on the 'N-bars' 
shown on the Amibroker screen.  

Thus say I purchase a stock on the 26/09/2008 and all of a sudden on 
the 27/9/2008 it goes onto a trading halt till the 7/10/2008. (For 
interested parties this was PPX, PaperLinx on the ASX,  ASX should 
some slight volume on the 1/10/2008 but we will ignore this for now).

Therefore based on my assumption on the second paragraph,  if I have 
a TimeStop = BarsSince(Buy) > 3 to activate a Sell, then the system 
should exit the trade on the 9/10/2008.  Likewise with 
the .BarsInTrade() property in the backtester which shows a value of 
3 only on the 9/10/2008.

This all works fine when I use the Backtester on the single trade 
itself (Apply to Current Symbol).

However, the PROBLEM occurs when I start to use a filter (i.e. 
ASX200).  The backtester seems to realise that all the other symbols 
have the information from the 27/8/2008 to the 7/10/2008 (duration of 
the trading halt for PPX) and starts to apply the .BarsSince(Buy) on 
the missing data for PPX because of all the other symbols which have 
this information.  Thus, the TimeStop activates itself on the 
1/10/2008 because date-wise, this would be .BarsInTrade = 3.

I'm not sure if someone can help me with this issue or if it's a 
minor bug which I found.  Shouldn't Amibroker just base it's 
backtesting data on the N-bars available for that symbol and not 
reference data from other symbols??  I have not told it to Align or 
Pad data in anyway.

Please help!!






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

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