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: Monty Lenard who wrote (11044)1/28/2001 7:43:44 PM
From: MechanicalMethod  Read Replies (1) of 12039
 
adaptive average pseudo code, incomplete.

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

if c > c[1] then cSlope = 1; {+slope}
if c < c[1] then cSlope = -1; {-slope}

AdaptAvg = average(c,len);{old val of len}
if adaptAvg > adaptAvg[1] then avgSlope = 1; {+slope}
if adaptAvg < adaptAvg[1] then avgSlope = -1; {-slope}

if len > 3 and len < 21 then begin
if cSlope > 0 and avgSlope < 0 then len = len - 1; {speedup avg}
if cSlope < 0 and avgSlope > 0 then len = len + 1; {slows avg}
end; {price and avg diverging}

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

plot1(average(c,8),”avg8”);{for comparison}
plot2(adaptAvg,”adaptAvg”);

~~~~~~~~~~~~~~~~
A separate indicator formatted as histogram tracks the value of len as it adjusts.

plot1(len,"len"); {this shows len stuck at 21 bug}
~~~~~~~~~~~~~~~~~~~
unresolved: store adaptAvg for each bar in array then average array values using each new adaptive length. Currently instead of averaging values that result from multiple parameters it changes parameter but doesn’t store result. Recalculations use new len on entire price series {bug}.

Theory: there are good reasons to speedup an avg besides correcting divergence between avg and price. One that comes to mind is only adapt when an additional condition is met such as price and avg must be crossed [convoluted] before slope divergence triggers a parameter adjustment. I’m not clear on that at the moment but have worked it and it’s straightforward, just slips my mind at the moment.

Decent beginning although it goes to len 21 and stays there I think without further adapting {a bug}. My intent is to use this with other than simple avg’s. First I need to get the values from each bar into an array so each new bar calculates on price but only adds the most recent value to the array which is my price proxie.

Mechanical Method
Report TOU ViolationShare This Post
 Public ReplyPrvt ReplyMark as Last ReadFilePrevious 10Next 10PreviousNext