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

[amibroker] Simple Look-ahead checker



PureBytes Links

Trading Reference Links

Hello here is some simple code I use to verify my system's code. It uses the
Param() to remove bars from the end of your data array. As you remove data
from the end of your chart you can observe whether trade signals/indicators
behave properly, for example, if arrows disappear prematurily your code is
looking ahead.

Herman.

Z = -1e10;
LB =LastValue(BarIndex());
RM = Param("RemoveBars",0,0,100,1);
O = IIf(BarIndex()>=(LB-RM),Z,O);
H = IIf(BarIndex()>=(LB-RM),Z,H);
L = IIf(BarIndex()>=(LB-RM),Z,L);
C = IIf(BarIndex()>=(LB-RM),Z,C);

// Steve Karnish's StoRSI as posted on the list earlier
// example only: substitute your own system's code
StochRsi=EMA((RSI(8)-LLV(RSI(8),8))/(HHV(RSI(8),8)-LLV(RSI(8),8)),3)*100;
Buy=Cross(17,StochRsi) AND Ref(MA(C,21),-1) < MA(C,21);;
Sell=Cross(StochRsi,83);
Short=Cross(StochRsi,83) AND Ref(MA(C,21),-1) > MA(C,21);
Cover=Cross(17,StochRsi);

Plot(C,"Close",2,1);
PlotShapes(IIf(Buy,shapeUpArrow,IIf(Short,shapeDownArrow,shapeNone)),
IIf(Buy,colorBrightGreen,IIf(Short,colorRed,colorBlack)));


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Make Money Online Auctions! Make $500.00 or We Will Give You Thirty Dollars for Trying!
http://us.click.yahoo.com/yMx78A/fNtFAA/i5gGAA/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/