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

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


  • To: "Gary Fritz" <omegalist@xxxxxxxxxx>
  • Subject: Re: How to keep a value in a variable over consecutive bars?
  • From: "carrslem" <carrslem@xxxxxxx>
  • Date: Sat, 15 May 2004 10:41:14 -0700

PureBytes Links

Trading Reference Links

If I understood the original question correctly, as follows, then I disagree
with the answers given:

Is it possible to save an intra-bar value (a value which occurs at some
point after the start of a bar but before the end of that bar - for example,
the intra-bar high of some indicator where the indicator is updated on every
tick) in a variable?

Unless TS has been quietly changed since I first ran into this problem
several versions ago, the answer is "no".  I was going crazy trying to
figure out why my function was misbehaving.  By means of strategically
placed print statements, I was able to prove conclusively that the last
intra-bar value which I stored in my variable was mysteriously showing a
different value during the subsequent bar.

The initial reaction of the TS tech with whom I spoke was that this was,
indeed, a TS bug and would be reported.  But several days later I got a
callback and was told that, no, this was a "feature".  They consider the
"update on every tick" feature to be only an approximation of the end-of-bar
value and, therefore, do NOT retain such values beyond the close of the bar.
A further reason given was that retaining the intra-bar value would cause
results on "historical" data to differ from real-time results (because
calculations on historical data use only the OHLC bar data, not tick data).
Because I was not assigning the bar's closing value to the variable, it was
getting "restored" to something else - I believe it was the closing vakue of
the PREVIOUS bar, or something equally bizarre!

Regards,
Carroll


> 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.