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

Re: How to keep a value in a variable over consecutive bars?



PureBytes Links

Trading Reference Links

Abhijit:

>Is there a way to set a variable in a bar and have access to it from a
>subsequent bar? I do not wish to have the variable to be a series.

All variables are series variables in EasyLanguage, except in Simple
functions.  All these series variables retain their value from one
bar to the next.

>As far as I understand, a variable, defined
>as var: something(0) woud get reset to 0 every bar.

No, it gets initialized to zero on the first bar.  After that it's
whatever you define it.

>I do not want a series as only the value is important to me in a
>subsequent bar, not the bar where I calculated this.

If your variable resides in a strategy, series function, or any kind of
indicator, you don't have a choice, the variable will be a series.  You
needn't do anything.  The variable will retain its value.  Or you could
reference something[2] to get the value 2 bars ago.

-- 
  ,|___    Alex Matulich -- alex@xxxxxxxxxxxxxx
 // +__>   Director of Research and Development
 //  \ 
 // __)    Unicorn Research Corporation -- http://unicorn.us.com