PureBytes Links
Trading Reference Links
|
Graham,
Thanks! I did mean 2 AM for the second time. I'm not getting any
errors now, but backtesting gives me a bunch of orders that are not
part of the system I'm trying to test. There should only be 1 order
each week, opened at 8 AM on Monday (either buy or sell based on
relative position to the 2 AM price). Those orders are correctly
executed in the back test, but there are many other orders opened on
multiple days of the week and at multiple times. Any idea what is
going on with that? Here is where I am on the AFL code right now:
James
Buy = ValueWhen(DayOfWeek()==1 AND Cross(TimeNum(),080000), C) >=
ValueWhen (DayOfWeek()==1 AND Cross(TimeNum(),020000), C);
Sell = DayOfWeek()==5 AND Cross(TimeNum(),203000);
Short = ValueWhen(DayOfWeek()==1 AND Cross(TimeNum(),080000), C)
<=ValueWhen (DayOfWeek()==1 AND Cross(TimeNum(),020000), C);
Cover = DayOfWeek()==5 AND Cross(TimeNum(),203000);
PositionSize=100000;
ApplyStop(0,2,0.01,True,False);
ApplyStop(1,2,0.01,True,False);
--- In amibroker@xxxxxxxxxxxxxxx, "Graham" <gkavanagh@xxxx> wrote:
> You just needed the array to be checked C, also if you do not have
a price
> at exactly the time nothing can be found, so I use the Cross for
that. Plus
> your second time was for 2am, thought you might mean 2pm
>
> Hope this works better
>
> Buy = ValueWhen(DayOfWeek()==1 AND Cross(TimeNum(),080000), C) >=
ValueWhen
> (DayOfWeek()==1 AND Cross(TimeNum(),140000), C);
>
> Sell = DayOfWeek()==5 AND Cross(TimeNum(),203000);
>
> Short = ValueWhen(DayOfWeek()==1 AND Cross(TimeNum(),080000), C)
<=ValueWhen
> (DayOfWeek()==1 AND Cross(TimeNum(),140000), C);
>
> Cover = (DayOfWeek()==5 AND Cross(TimeNum(),203000);
>
> PositionSize=100000;
>
> Short=Sell;
>
> ApplyStop(0,2,0.01,False,True);
>
> ApplyStop(1,2,0.01,False,True);
>
> Cheers,
> Graham
> http://groups.msn.com/ASXShareTrading
> http://groups.msn.com/FMSAustralia
>
> -----Original Message-----
> From: the_real_redleg [mailto:james.hall3@x...]
> Sent: Thursday, 30 October 2003 10:00 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] AFL question
>
>
> I'm trying to backtest a system where you make one trade every
week.
> The rules are that you check the price at 0200 on Monday against
the
> price at 0800 on Monday. If the later price is higher, buy. If the
> later price is lower, sell. Take profit and stop loss levels of
100
> pips. If the trade has not closed by the end of the week, then
close
> it.
>
> Here is my attempt at AFL code (not working). Greatly appreciate
any
> help in coding this for backtesting. You guys are great!
>
> James
>
> Buy = (ValueWhen(DayOfWeek()==1 AND TimeNum()==080000)>=ValueWhen
> (DayOfWeek()==1 AND TimeNum()==020000));
>
> Sell = (DayOfWeek()==5 AND TimeNum()==203000);
>
> Short = ValueWhen(DayOfWeek()==1 AND TimeNum()==080000)<=ValueWhen
> (DayOfWeek()==1 AND TimeNum()==020000);
>
> Cover = (DayOfWeek()==5 AND TimeNum()==203000);
>
> PositionSize=100000;
>
> Short=Sell;
>
> ApplyStop(0,2,0.01,False,True);
>
> ApplyStop(1,2,0.01,False,True);
>
>
>
>
> Send BUG REPORTS to bugs@xxxx
> Send SUGGESTIONS to suggest@xxxx
> -----------------------------------------
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> --------------------------------------------
> Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>
> Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Rent DVDs from home.
Over 14,500 titles. Free Shipping
& No Late Fees. Try Netflix for FREE!
http://us.click.yahoo.com/ybSovB/hP.FAA/3jkFAA/GHeqlB/TM
---------------------------------------------------------------------~->
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
|