The two screen shots below, are demonstrating the use of both indicators showing TickRate as the number of ticks per minute.
During Market Hours
After Market Hours
Fig. 2. Standard EL and OOEL Versions of TickRate Indicators Configured to Show Average Ticks Per Minute
The differences between TickRate and TickRate.OOEL, as configured above, is attributed to the fact that TickRate recalculates the TickRate each time a new tick is received and TickRate.OOEL updates the TickRate every second (Calc = 1).
Uses of the TickRate Indicator
- Assessing current relative liquidity of futures contracts that trade day and night
- Assessing current intraday liquidity of all stocks and futures contracts, as these vary substantially during the open sessionFor example, the volume or ticks of the opening and closing 30 minutes of the session is typically about 4 times greater than the volume or ticks during the midday “lunch” break. Using TickRate, a trader can quickly determine if midday liquidity is adequate for an anticipated trade
- Changes in the TickRate in resonse to news events will be visible to the trader sooner than wiating for the volume to print on minute bar charts.
Standard EasyLanguage Code
The time interval between each tick is calculated, and added to an elapsed time variable. This elapsed time variable is used to determine which element of a circular array the ticks will be added to. When the array is full, it will start refreshing old tick totals with new totals in a circular fashion. The circular array will be used to keep the total number of ticks in the last Length seconds. From this circular array, the average ticks per second is calculated. This result can be multiplied by a constant, Mult, to express the results in ticks per minute (Mult = 60), ticks per hour (Mult = 3600), etc.
Object Oriented Easylanguage Code
The Timer object is used to generate a signal to execute code every second. This signal increments the index of the circular array by 1 every second. The total ticks collected during the 1 second interval is then stored in CountArray[Index]. This circular array covers a time period of Length seconds. The total ticks collected over Length seconds is averaged to produce a ticks per second value. This result can be multiplied by constant Mult to express the results in ticks per minute, ticks per hour, etc.
The OOEL version is much more efficient than the standard EL coding because the timer generates a signal once each second. This eliminates the need to use more CPU intensive timers such as ELTicToc to calculate the interval between each tick. Instead, the OOEL version simply calculates a running total number of ticks that occured in the most recent second. When the timer fires once every second, this running total is placed in the appropriate circular array element and then reset to zero so it can start accumulating the number of ticks for the next second.
To compare the relative efficiency of the code, we have standard EL code that executes every tick such as:
being replaced by OOEL code that executes very tick:
- Eliminates CPU intensive timing calculations by replacing these with a Timer object event triggered once per second.
- Executes only two lines of trivial calculations with each tick compared to the more CPU intensive timing calculations of the standard code which calls function ELTicToc.
- Plots output only once every CalcSec, rather than each tick. (I use a CalcSec value of 3 to 5 seconds since it is not necessary to know the relative tick rate more frequently than that.)
Initially posted version: 03/13/2011
Latest Update: 03/13/2011
*.ELD FILES ARE COMPILED FOR ts 9.0
Users of earlier versions of TradeStation may compile the code from
the text files included in the above *.zip file.
The code may be visualized here: