PureBytes Links
Trading Reference Links
|
Hi Folks –
I'm learning backtesting methodology and AFL by trying to write a
simple system. The system will give me signals 5, 10, and 15 points
below the high of the day and above the low of the day. I'll run the
backtest on a 1-tick chart.
William Peters was kind enough to help me with code to plot this on a
chart:
TimeFrameSet(inDaily);
DayHigh = High;
DayLow = Low;
TimeFrameRestore();
DayHigh = TimeFrameExpand( DayHigh, inDaily, expandFirst);
DayHigh5 = TimeFrameExpand( DayHigh - 5, inDaily, expandFirst);
DayHigh10 = TimeFrameExpand( DayHigh - 10, inDaily, expandFirst);
DayLow = TimeFrameExpand( DayLow, inDaily, expandFirst);
DayLow5 = TimeFrameExpand( DayLow + 5, inDaily, expandFirst);
DayLow10 = TimeFrameExpand( DayLow + 10, inDaily, expandFirst);
Plot( Open, "Open", colorYellow, styleBar);
Plot( DayHigh, "DH", colorGreen , styleLine );
Plot( DayHigh5, "DH-5", colorGreen, styleBar );
Plot( DayHigh10, "DH-10", colorGreen, styleBar );
Plot( DayLow, "DL", colorRed, styleLine );
Plot( DayLow5, "DL+5", colorRed, styleBar );
Plot( DayLow10, "DL+10", colorRed, styleBar );
GraphXSpace = 5;
I finally realized that in using this in a backtest with buy/sell
signals like:
Buy = Open == DayHigh5;
Sell = Open == DayHigh5 + 3;
Short = Open == DayLow5;
Cover = Open == DayLow5 - 3;
that it doesn't work because the signal is looking at the high and
low for the entire day rather than the high and low of the day that
exists at the time of a particular bar (1-tick). For example, the
high and low of the day is different at 10:00am than it is at 2:00pm.
So what I need is a way of having each bar (1-tick) look at the
entire range of bars back to the beginning of the that bar's day and
see if it meets the signal conditions.
Can someone please point me to the functions that I might need to
make this work?
Thanks.
- Don
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|