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

[amibroker] AFL question



PureBytes Links

Trading Reference Links

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);



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Rent DVDs Online - Over 14,500 titles.
No Late Fees & Free Shipping.
Try Netflix for FREE!
http://us.click.yahoo.com/vhSowB/XP.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/