[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Moving Averages



PureBytes Links

Trading Reference Links



> -----Original Message-----
> From: Bob Fulks [mailto:bfulks@xxxxxxxxxxxx]
> Sent: Sunday, September 15, 2002 7:03 AM
> To: Charles Turner; Omega-List
> Subject: Re: Moving Averages
>
>
> At 9:05 PM -0500 9/14/02, Charles Turner wrote:
>
> >Is the moving average calculation different when it is used in a system
> >as compared to a chart? In other words, in TS 6, I have a simple system
> >that uses the function "average". When I visually compare the trades
> >generated to the display of the moving average line on a chart, the
> >system seems to be generating trades where none should be. Are these
> >calculations different? Is there a log of system calculations somewhere
> >that I can use to debug?
>
> The most common cause of this problem is that the MaxBarsBack setting
> is not the same in the system and in the indicator.
>
> Unless you change it, the default for a system is 50 bars and is
> AutoDetect for indicators.
[...]

I'm a little rusty on EL programming, but vaguely recall the following:

Something else to watch out for - the use of indicators or functions that
need to be called on every bar, but that are not, because of the way that
the logic of the system is constructed. If I recall correctly, xaverage is
one of those functions.

for example,
   if xaverage(C, L1) crosses above xaverage(C, L2) then begin
     if C > xaverage(C, L3) then buy at market;
   end;

the inner calculation of xaverage(C, L3) will not be executed on every bar,
and therefore will not yield the expected result.

PS: Bob/others, if I got this wrong, please correct the record. <g>