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

How to init var values prior to CurrentBar = 1?



PureBytes Links

Trading Reference Links

Hello,

Suppose I want to average C e.g. value1 = Average(C, 20).  With
CurrentBar = 1 this works as I expect.

Suppose instead I want to copy C into a variable and average that e.g.

Value1 = C;
value2 = Average(Value1, 20);

(The reason I want to do this is to compute an average on a
transformation of C).

The problem is that this won't produce the results I expect until
CurrentBar = 20 because (using CurrentBar = 1 as reference) Value[20]
through Value[1] aren't initialized with C[20] through C[1] but
instead 0.

Does anyone have thoughts on how I can initialize these portions of
Value1?

Thanks in advance.

Regards,
Brendan