Display previous day range in Ticks


Category:
0
0

Hi Pete,

Trying to create a script that will display the number of ticks in yesterdays RTH range in the watchlist.  I trade the bonds so RTH days range will always be from 720 am to 2pm CST.

Example.  In ZB (30 yr)  Yesterdays LOD was 132’10, and its HOD was 133’26.  This is a range of 48 ticks.

Desired outcome:  Watchlist displays a column titled YR (for yesterdays range) and the number of ticks in the RTH is displayed as a simple number. In this example 48.

Thanks for any help!

Marked as spam
Posted by (Questions: 7, Answers: 1)
Asked on September 13, 2022 1:56 am
45 views
0
Private answer

I can write the code for that but there will be circumstances in which the value is not completely accurate. For example yesterday was contract rollover and the watchlist is not reporting the same low of day as the chart. High of day is correct, but for some reason the low of day is not. And this on several futures contracts I tested.

So long as you are aware of these limitations, the following code is as accurate as we can get on Thinkorswim:

def range = high - low;
plot previousRangeTicks = range[1] * TickSize();

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on September 13, 2022 1:20 pm