PureBytes Links
Trading Reference Links
|
This is a follow-on posting on time stamps.
Some of us program codes to test very short-term market dynamic
concepts. This requires the use of time stamps in seconds. In fact,
there have been quite a few postings requesting tick data with time
stamps in seconds.
Implementing historical tick data with time stamps in seconds seems easy
on the surface. However, it could be a major technical challenge, e.g.,
in the area of storage, network bandwidth, and intensive CPU demands for
both TradeStation server and client computers. This may not be realistic
in the near future.
Still there are solutions available to meet the requirement of time
stamps in seconds for real time analysis. One can use CodeTalker's
GetMachineTime DLL function to get computer time in seconds. However,
the one, that does not get mentioned much and is not obvious, is the
TradeTimeEx. In fact, that may be the one you want to use most to get
the Time and Sales data for analysis in an indicator.
Here is the EasyLanguage Dictionary Definition of TradeTimeEX:
A quote field that returns a numeric expression representing the Julian
time (accurate to the second) of the last time the symbol was updated.
Note Quote fields do not reference history. In Chart Analysis, they will
only plot a value from the current bar forward.
If you use default print format, you will get a number of two decimals
(e.g, 0.63). How can it be accurate to the second if it only has 2
decimals? However, if you use print(TradeTimeEX:10:8) ; you can see that
the decimals are there (e.g, 0.63098380) to be accurate to the second!
A nice enhancement in TradeStation 8.1 over 8.0 is that TS 8.1 allows
extensive use of quote fields in an indicator.
TradeTimeEx is related to HH:MM:SS in theory as follows:
Vars: HH(0), MM(0), SS(0), HHf(0), MMf(0), SSf(0), HHMMSS(0) ;
HHf = TradeTimeEx*24 ;
HH = IntPortion(HHf) ;
MMf = (HHf - HH)*60 ;
MM = IntPortion(MMf) ;
SS = (MMf - MM)*60 ;
HHMMSS = HH*10000 + MM*100 + SS ;
You can compute the HH, MM, SS, HHMMSS numbers using the following
built-in functions in TS 8.1:
Vars: HH(0), MM(0), SS(0), HHMMSS(0) ;
HH = HoursFromDateTime(TradeTimeEx) ;
MM = MinutesFromDateTime(TradeTimeEx) ;
SS = SecondsFromDateTime(TradeTimeEx) ;
HHMMSS = HH*10000 + MM*100 + SS ;
Combine "TradeTimeEx" with "Close" --- and that is your time stamps in
seconds in TS 8.1. And if you can add some code to record/read the type
of data you are interested on your computer, you may now test your
concepts of market dynamic in tick level with time stamps in seconds.
-- Harrison
|