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 -- Ignore unavailable to you. Want to Upgrade?


To: MechanicalMethod who wrote (11058)1/28/2001 10:28:09 PM
From: MechanicalMethod  Respond to of 12039
 
Another logic bug or at least it looked like it when I attempted to reduce redundancies to something less processor intensive and more visually intuitive. IOW, I saw a way to simplify it but then saw a bug and decided not tonight.

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

~~~~~~~~~~~
fix would be somewhat of a mirror image of the following concept but susbstitute the variables used above.

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 the len = len +1;
end;



To: MechanicalMethod who wrote (11058)8/22/2001 11:31:42 PM
From: David Loomis  Read Replies (2) | Respond to 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");



To: MechanicalMethod who wrote (11058)8/23/2001 12:49:38 PM
From: Carl Lawrence-Slater  Read Replies (1) | Respond to of 12039
 
Ok tell me more of your project ...

Your code looks like VB.. is it?

My Bio in case your interested .....

An ME as it seems you are but also a professional software developer .... C,C++ etc (even FORTRAN yes a dinosaur ...42 yrs old)

Learning TA, ~6 months. I am using TC2000 and writing PCFs that took the teacher a while to figure out..... good at TA not a programmer.