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

Re: Update every tick



PureBytes Links

Trading Reference Links

> This feature in TS2K will redraw indicators (and recalculate
> systems) on a chart with each new tick.  So even if you had a 30
> minute bar chart, your indicators (and systems) would still be
> updated with each tick. 

Update Every Tick (UET) applies only to indicators -- at least that's 
the way it works on TS4.  

System code runs ONLY at the close of the bar.  Systems check stop 
prices on every tick -- no UET setting is needed for that.

> My question is can any of this tick info info be captured on a
> chart even though the chart may be say 30 minute bars?  Or, is it
> strictly used for TS to just to redraw indicators 

If you set the UET option on an indicator, the info *IS* captured on 
the chart.  TS recalculates and redisplays the indicator values for 
each incoming tick.  Your indicator code gets executed on every tick, 
so you can do whatever you want in your code.  

HOWEVER be aware that TS "forgets" any variable changes you make 
within a bar, so that every tick within the bar starts out with the 
same variable values.  For example, try running this indicator on a 
1min bar:

vars: NTicks(0);
NTicks = NTicks + 1;
print(Date:6:0,Time:5:0,": NTicks = ",NTicks:0);
plot1(NTicks, "NTicks");

If you set the UET option, your Print Log (or whatever it is on TS2k) 
will show that the indicator did indeed run on every tick.  However 
the NTicks value DOES NOT change within the bar -- it resets to the 
start-of-bar value on each tick.

Why does TS do this bizarre behavior?  Believe it or not there's a 
good reason.  This way, the indicator plots the same values whether 
or not UET is set.  If it didn't do that, you'd see NTicks increment 
on 1 tick per bar when you apply it to historic data (since the 
indicator would run once per bar), then IF you had UET set, you'd see 
the indicator increment by some number >1 for any bars you received 
in realtime.  That would be VERY confusing and non-reproduceable.  By 
resetting all vars to the start-of-bar values, TS can run the 
indicator on each tick and still get the same results you'd get if 
UET was off.

If you want to "remember" the changes you make during the bar, you'll 
have to store your intermediate values *outside* TS, using PushPop or 
some other global-var utility.  However be aware that if you do this, 
you'll get different results depending on whether a bar was built in 
realtime with UET on, or not.

Gary