PureBytes Links
Trading Reference Links
|
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@xxxxxxxxxxx]
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@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/
------------------------ 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/
|