PureBytes Links
Trading Reference Links
|
Ages ago I questionend the duplication of various function and been
told its needed for systems < > indicators........so do not delete
any of them dupes, as they are not such.........
rgds hans
> OK, EL jocks, here's a question for you.
>
> When there are two versions of a function with the same name, one
> series and one simple, under what conditions is each one called when
> it is referenced by another function, indicator, etc?
>
> For example, below are the series and simple versions of TS's
> Summation function. It would seem to me that ideally you'd always
> want to use the simple function. It does not refer to prior versions
> of itself (i.e., is recalculated from scratch with every bar) and
> thus any errors will not be compounded. In that case, why not just
> delete the series version? When would the series version be
> necessary? When is it called, given that both functions have the
> same name?
>
> Of course, calculation times are greater for simple functions, but
> that is usually not a factor for most of the code that I write.
>
> Many thanks to anyone who can shed some light on this.
>
>
> Cheers,
>
> CAB VINTON
> cvinton@xxxxxxxxxxxxxx
>
> ++++++++++++++++++++++++
> Summation (Simple)
>
> input:Price(NumericSeries),Length(NumericSimple);
> var: Counter(0),Sum(0);
>
> Sum = 0;
> For Counter = 0 to Length-1
> begin
> Sum = Sum +Price[Counter];
> end;
> Summation = Sum;
>
> ++++++++++++++++++++++++
> Summation (Series)
> inputs : Price(NumericSeries),Length(NumericSimple);
> vars : Sum(0), Counter(0);
>
> if CurrentBar = 1
> then begin
> Sum = 0;
> for Counter = 0 to Length - 1
> begin
> Sum = Sum + Price[Counter];
> end;
> end
> else
> Sum = Sum[1]+Price-Price[Length];
>
> Summation = Sum;
>
~~~~~
....and bear in mind
that high reward does not come without its partner high risk !
|