| 
 PureBytes Links 
Trading Reference Links 
 | 
> 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 available in subsequent bars, without any added 
effort.  ALL variables have history (series) available.
> As far as I understand, a variable, defined as var: something(0)
> would get reset to 0 every bar.  
Nonono.  "var: something(0);" initializes the variable to 0 at 
the START OF THE CHART.  After that the variable only changes 
value when you change it.
Try this, for example:
var: BarNum(0);
BarNum = BarNum + 1;
plot1(BarNum, "BarNum);
So if you want the value of a variable as it was N bars ago, 
access it as BarNum[N].  N must be <= the MaxBarsBack setting for 
your study, since TS only retains the last MaxBarsBack bars of 
variable history.
But if you just want to remember the value as it was the last 
time you set it, just access the variable.  It will still have 
the value you set into it.
Gary
 
 |