SI
SI
discoversearch

We've detected that you're using an ad content blocking browser plug-in or feature. Ads provide a critical source of revenue to the continued operation of Silicon Investor.  We ask that you disable ad blocking while on Silicon Investor in the best interests of our community.  If you are not using an ad blocker but are still receiving this message, make sure your browser's tracking protection is set to the 'standard' level.
Strategies & Market Trends : TA-Quotes Plus

 Public ReplyPrvt ReplyMark as Last ReadFilePrevious 10Next 10PreviousNext  
To: Shinin' Times who wrote (9688)6/24/1999 2:29:00 PM
From: Bob Jagow  Read Replies (1) of 11149
 
Looks useful, Fred.
Since I rashly promised, here are a couple that I use.
Both are set up so that you won't need a separate back-test
version; the first one is useful if you want to scan for rare hits
[over n days] -- use the 2nd one to see the outcome for a single
day. -Bob
----
// Back Test Template
//Only accepts the first hit
// Note that nesting does little for speed in recent QP builds
integer i, bar, last, BestBar, MaxIndLen, MinPr, MaxPr, MinVol;
float BestCl, BestPct;
//input = "30k+vol.lst"; // comment out 1st 3 ifs if handled here
issuetype common;
MinPr:= 5; MaxPr:= 150; // Set these *************
MinVol := 100000; // Set this *************
MaxIndLen:= 89; // Longest indicator period *************
first:= -120; // Set to >= last to disable loop *************
output = "DE-MACD-120.lst"; // Set this *************
last:= -20; // bars to settle *************
daystoload = 2200;
DaysRequired = MaxIndLen + 50 - first;
// comment out these 2 lines if there are no EMA-based indicators
if first >= last then last:= first; endif; //to disable the for loop
// i.e., first:= -20 just tests 20 bars ago and first:=0 disables BTesting
for bar = first to last do
if close(bar) > MinPr then
if close(bar) < MaxPr then
if MovAvg(bar, 30, vol) > MinVol then
if Sic != 6726 then // exclude closed-end funds
// Add rest of conditions here
print symbol:-5,",",date(bar),",",close(bar):7:3;
if bar != 0 then //measure performance
BestCl:= max(0, bar+1, cl); //from next bar to bar 0
BestPct:= 100*(BestCl -close(bar))/close(bar);
for i = bar+1 to 0 do //find first max then exit the loop
if close(i) >= BestCl then
BestDay:= i;
i:= 0;
endif;
next i;
print",",date(BestDay),",",close(BestDay):7:3,",",BestPct:5:3;
endif; //bar
println",",sic; // add desired here for excel/Perl postprocessing
endif; endif; endif; // can comment out 1st 3 ifs and this line, see above
endif; endif; endif; endif;
next bar;
----
//fixed-day back test template
// page through the hits with the cursor on tbar
//input = "100k.lst"; // comment out 1st 3 ifs if handled here
issuetype common;
integer i, tbar, BestDay, IndLen, MinPr, MinVol, MaxPr;
float BestCl, BestPct;
MinPr:= 2; MaxPr:= 150; // Set these *************
MinVol := 30000; // Set this *************
IndLen:= 89; // Longest indicator period *************
tbar:= -50; // set to 0 or to -nn to backtest *************
output = "this scan-50.lst"; // edit tbar *************
daystoload = 1000 - tbar;
DaysRequired = IndLen + 50 -tbar; // Newer issues will be skipped
if close(tbar) > MinPr then
if close(tbar) < MaxPr then
if MovAvg(tbar, 30, vol) > MinVol then
if Sic != 6726 then // exclude closed ends
// rest
print symbol:-5,",",close(tbar):7:3,",",date(tbar);
if tbar != 0 then //measure performance
BestCl:= max(0, tbar+1, cl); //from next day to day 0
BestPct:= 100*(BestCl -close(tbar))/close(tbar);
for i = tbar+1 to 0 do //find first max then exit the loop
if close(i) >= BestCl then
BestDay:= i;
i:= 0;
endif;
next i;
print",",close(BestDay):7:3,",",date(BestDay),",",BestPct:5:3;
endif; //tbar
println",",sic; // add desired here for excel/perl postprocessing
endif; endif; endif; // can comment out 1st 3 ifs and this line, see above
endif; endif; endif; endif;
Report TOU ViolationShare This Post
 Public ReplyPrvt ReplyMark as Last ReadFilePrevious 10Next 10PreviousNext