Craig, A to Z gives a formula for a, but mine is better ;) 199.234.225.19 You get a and b by solving Eq1: a*N + b*Sx = Sy Eq2: a*Sx + b*Sxx = Sxy Recall that the divisor is the determinant of the left side and the numerators are the determinants with the right col replacing the var col. Hence div = N*Sxx - Sx^2, div*a = Sy*Sxx - Sxy*Sx, and div*b = N*Sxy -Sx*Sy.
A to Z calculates a by backsubst in the 1st equation, bu this propagates b's error into a.
Thanks for catching if lrflag != 0 then lrfalg:= 1; -- never, in my arrogance, bothered to check TSF :-(
Re "intuitively it seems the i:= bar -N*; should be just i:=-N* as all the previous loop sums started at 'first' originally.", you can verify that bar is needed by a calc of 10/23/98 with first = -10.
Don't understand "And is it possible to reduce them back to first with just one differential added to the previous sums without incrementally stepping them backward?"
Re "I haven't incorporated integral backtesting in many scans and that's where the logic is fuzziest.", start doing it ;) Just have to insert a little code after the normal println.
Don't think we should try to get Gary to shoehorn GET into r2.01 ;) -Bob --------------------- print symbol:-5,",",date(bar),",",close(bar):7:3; if first != 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; // print back test results println; --------------------- |