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

RE: Moving Averages



PureBytes Links

Trading Reference Links

  Bob Fulks wrote:

>At 9:08 AM -0700 9/15/02, Gary Funck wrote:
> >
> >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>
>
>
>There are different versions of XAverage in different versions of
>TradeStation so it can be confusing.
>
>
>But you are correct that series functions are executed on every bar
>no matter what, but simple functions are executed only when called.
>So in your example above the statement:
>
>
>    if C > xaverage(C, L3) then buy at market;
>
>
>would not be executed on every bar (if your XAverage is a simple function).
>
>
>But the behavior would be the same in both the system and the
>indicator so is not likely to be the cause of the original problem.
>
>
>Bob Fulks


Why do you say the behavior would be the same in both the system and 
indicator? If I understand this correctly the reason it is not being called 
on every bar in the system is because it is within an "IF" statement. But 
the code to plot the indicator would not be conditional.

Thanks

Steve