PureBytes Links
Trading Reference Links
|
> >Variables are not set to their default values on each bar. They are
> >initialized to the value specified in the "Vars:" statement and retain
> >that value until reassigned a new value. That new value is retained until
> >again reassigned.
>
> I want a variable which I can set at the beginning of a system,
> and it should keep it's value until the code changes it (with a
> statement like if condition then var1=var1+1), however it should
> not be reinitialized by the "Vars:" statement on the next bar,
> instead it should retain the value assigned to it by the code in
> an earlier bar.
Read Bob's reply. EL *already* does what you want. The variable is
initialized to the value in the "Vars:" statement at the START of the
chart. Unless you explicitly change the variable with an assignment
like var1=var1+1, it WILL NOT CHANGE throughout the rest of the chart.
Why do you think it does? Are you seeing some unexpected behavior?
Gary
|