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 : Technical Analysis - Beginners

 Public ReplyPrvt ReplyMark as Last ReadFilePrevious 10Next 10PreviousNext  
To: MechanicalMethod who wrote (11058)8/22/2001 11:31:42 PM
From: David Loomis  Read Replies (2) of 12039
 
I fixed a couple of typos that prevented the code from loading in TS200i here

Var: len(8), adaptAvg(0), cSlope(0), avgSlope(0);

if c > c[1] then cSlope = 1;
if c < c[1] then cSlope = -1;

adaptAvg = average(c,len); {len last bar}
if adaptAvg > adaptAvg[1] then avgSlope = 1;
if adaptAvg < adaptAvg[1] then avgSlope = -1;

if (c >adaptAvg and avgSlope<0) or (c<adaptAvg and avgSlope>0) then begin
if cSlope > 0 and len > 3 and len < 21 then len = len - 1;
if cSlope < 0 and len > 3 and len < 21 then len = len - 1;
end;

If len < 8 then begin
if c > adaptAvg and cSlope > 0 and avgSlope > 0 then len = len +1;
if c < adaptAvg and cSlope < 0 and avgSlope < 0 then len = len +1;
end;

adaptAvg = average(c,len); {updated len}

plot1(average(c,8),"avg8"); {for comparison}
plot2(adaptAvg,"adaptAvg");
Report TOU ViolationShare This Post
 Public ReplyPrvt ReplyMark as Last ReadFilePrevious 10Next 10PreviousNext