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

Re: Moving Averages



PureBytes Links

Trading Reference Links

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.

AutoDetect causes the indicator to try values until it works so it
will not be the same as the system.

Make them both the same number and your problem will probably disappear.

But this is pointing out a possible second problem - initialization.
If the results are different, this means that you are still seeing
the effects of the initial bars in the calculations. You might not be
initializing the variables correctly.

One good way to check is to use lots of extra bars and prevent trades
until some date or number of bars have passed.

    if Date > 0101102 then...

    if CurrentBar > 100 then begin...

If this changes the trades, you have an initialization problem.

You can always add Print statements to the system to print the values
in the system at any bar.

Bob Fulks