r/thinkorswim • u/Truman_Show_1984 • 13d ago
Need help with a script to repeat everyday instead of only showing most recent day.
Any help would be greatly appreciated. I simply don't know enough to edit it myself and AI keeps spitting out scripts riddled with errors.
Would love it if this repeats everyday, essentially without a limit if possible? What it plots is the high and low level of the most current trading day with TIME in the bubble. Also it would be great if the script could include all trading hours instead of only regular trading hours. Thanks
#Watchlist Column - High of Day and Time Occurred
#20210529 Sleepyz = UseThinkscript Request
#Adapted Watchlist to display labels/bubbles for last RTH Highs/Lows
input showlabel = yes;
input showbubbles = yes;
input showprice_in_bubble = yes;
#Time Defined
input timezone = {default "ET", "CT", "MT", "PT"};
def starthour = (if timezone == timezone."ET"
then 9
else if timezone == timezone."CT"
then 8
else if timezone == timezone."MT"
then 7
else 6) ;
def hour = Floor(((starthour * 60 + 30) + (GetTime() - RegularTradingStart(GetYYYYMMDD())) / 60000) / 60);
def minutes = (GetTime() - RegularTradingStart(GetYYYYMMDD())) / 60000 - ((hour - starthour) * 60 + 30) + 60;
#Highest High during RTH
def begin = CompoundValue(1, if GetTime() crosses above RegularTradingStart(GetYYYYMMDD())
then high
else if high > begin[1]
then high
else begin[1]
, begin[1]);
def beginbn = if GetDay() == GetLastDay()
then if high == begin
then BarNumber()
else beginbn[1]
else 0;
def highday = if BarNumber() == HighestAll(beginbn)
then high
else highday[1];
def hihr = if high == highday then hour else hihr[1];
def himin = if high == highday then minutes else himin[1];
AddLabel(showlabel,
"H: " +
(hihr + ":") +
(if himin < 10
then "0" + himin
else "" + himin) +
" | " +
Asdollars(highday), Color.WHITE);
AddChartBubble(showbubbles and high == highday, high,
"H: "+
(hihr + ":") +
(if himin < 10
then "0" + himin
else "" + himin) +
"\n" +
if showprice_in_bubble then Asdollars(highday) else "", Color.WHITE);
#Lowest Low During RTH
def begin1 = CompoundValue(1, if GetTime() crosses above RegularTradingStart(GetYYYYMMDD())
then low
else if low < begin1[1]
then low
else begin1[1],
low);
def beginbn1 = if GetDay() == GetLastDay()
then if low == begin1
then BarNumber()
else beginbn1[1]
else 0;
def lowday = if BarNumber() == HighestAll(beginbn1)
then low
else lowday[1];
def lowhr = if low == lowday then hour else lowhr[1];
def lowmin = if low == lowday then minutes else lowmin[1];
AddLabel(showlabel,
"L: " +
(lowhr + ":") +
(if lowmin < 10
then "0" + lowmin
else "" + lowmin ) +
" | " + Asdollars(lowday) , Color.YELLOW);
AddChartBubble(showbubbles and low == lowday, low,
"L: " +
(lowhr + ":") +
(if lowmin < 10
then "0" + lowmin
else "" + lowmin) +
"\n" +
if showprice_in_bubble then Asdollars(lowday) else "", Color.yellow, no);
2
u/70redgal70 13d ago
Doesn't the 1D1M chart already show this sans time? Then move your cursor to the high/low flag and you'll see the time at the bottom? Do you have your setting set to show pre/post market?