Hello. I want to do backtesting with a system that selects stocks from
a particular watchlist depending on the date, but I cannot get it to
work properly. Here's the pertinent part of my code:

index=IIf( Year() == 2005 AND Month() ==  6 AND Day()>=17 AND
Day()<24,1,-1);

index=IIf( Year() == 2005 AND Month() ==  6 AND Day()>=24,2,-1);  

Buy = index > 0 and InWatchList(index);

So if the date is between 2005-6-17 and 2005-6-24, index should be 1,
otherwise -1. And if the date is on or after 2005-6-24, index should
be 2, otherwise -1.

The problem is that I get the error that the fucntion expects a
different argument type. The error goes away if I use LastValue for index:

Buy = index > 0 and InWatchList(LastValue(index));

However, the above seems to result in only stocks being selected from
Watchlist(2), and never Watchlist(1).

How do I correct this? Thanks in advance.








Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

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:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to