PureBytes Links
Trading Reference Links
|
--- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxx> wrote:
>
> You are overwriting the variable index with the 2nd line so the first is
> forgotten.
> You could try using a loopp for this or combine inot one function
like this
>
> index=IIf( Year() == 2005 AND Month() == 6 AND Day()>=17 AND
Day()<24,1,
> IIf( Year() == 2005 AND Month() == 6 AND Day()>=24,2,-1));
>
> as an aside you could save yourself a lot of typing by using datenum()
> eg
> di = datenum();
> index=IIf( di>=1050617 and di<1050624, 1, IIf( di>=1050624, 2, -1 ));
>
>
> --
> Cheers
> Graham
> AB-Write >< Professional AFL Writing Service
> Yes, I write AFL code to your requirements
> http://e-wire.net.au/~eb_kavan/ab_write.htm
>
>
> On 17/09/06, ninkiga <ninkiga@xxx> wrote:
> >
> > 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
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
Graham,
Thanks very much. Based on your astute observations, I finally got the
system to work.
|