Candle Closing Time Remaining for ThinkorSwim

lmk99

Member
VIP
Hi everyone,

This is a simple indicator but I thought someone might enjoy it. I made it by modifying Welkin's timer in his tick volume projection study.

The limitation is that (1) it has to use a tick chart and (2) the timer count only updates when a tick occurs (so it updates at a decent rate when something has high volume, like when scalping at high-velocities, but otherwise isn't useful). In other words, only works for trading high volume tickers.

I trade with 1min candles so I have it as lower section study that appears in its own cell, above my main chart, like so:

MSTd6fK.jpg


The bar is black at 0 seconds and turns completely white at approximately 60 seconds, using progressively lighter gradients of gray in between during the count to 60 seconds.

It's an easy way to see out of the corner of my eye how much time is left for the 1min candle to close, as long as the volume is high enough that the tick chart is updating constantly.

If you wanted to redo it for a different time interval, you could use this website to generate the gradients for any number of steps (e.g. 120 steps for a 2 minute candle period): http://www.perbang.dk/rgbgradient/

It's a little but tedious but not hard to update the number of steps to your desired number of seconds (or for larger periods such as 5min it might make sense to have the tick chart with the gradient only update once every 5-10 seconds).

Code:
#Seconds Elapsed up to 1min bar with color gradient counting effect by lmk99
#Code for the counter taken from Welkin's tick volume projection study
declare lower;
input aggregationInSeconds = 60;
def start = 0000;
def end = 1600;
#def min = Floor(SecondsFromTime(start) / aggregationInSeconds);
def till = SecondsTillTime(end) / aggregationInSeconds;
def secondselapsed = (AbsValue(till - Ceil(till)) * aggregationInSeconds);
#def secondsleft = aggregationInSeconds - secondselapsed;
def percntelapsed = Round(((secondselapsed / aggregationInSeconds) * 100), 0);

#Labels

AddLabel(1, "SECONDS UNTIL BAR CLOSE:                                                                                                                                                                                                                                                           " + secondselapsed + "/" + aggregationInSeconds + "   " + percntelapsed + "%", if (SecondsElapsed>=0 and SecondsElapsed<=1) then CreateColor(0, 0, 0)
else if SecondsElapsed==2 then CreateColor(4,4,4)
else if SecondsElapsed==3 then CreateColor(8,8,8)
else if SecondsElapsed==4 then CreateColor(12,12,12)
else if SecondsElapsed==5 then CreateColor(17,17,17)
else if SecondsElapsed==6 then CreateColor(21,21,21)
else if SecondsElapsed==7 then CreateColor(30,30,30)
else if SecondsElapsed==8 then CreateColor(34,34,34)
else if SecondsElapsed==9 then CreateColor(38,38,38)
else if SecondsElapsed==10 then CreateColor(43,43,43)
else if SecondsElapsed==11 then CreateColor(47,47,47)
else if SecondsElapsed==12 then CreateColor(51,51,51)
else if SecondsElapsed==13 then CreateColor(56,56,56)
else if SecondsElapsed==14 then CreateColor(60,60,60)
else if SecondsElapsed==15 then CreateColor(64,64,64)
else if SecondsElapsed==16 then CreateColor(69,69,69)
else if SecondsElapsed==17 then CreateColor(73,73,73)
else if SecondsElapsed==18 then CreateColor(77,77,77)
else if SecondsElapsed==19 then CreateColor(82,82,82)
else if SecondsElapsed==20 then CreateColor(86,86,86)
else if SecondsElapsed==21 then CreateColor(90,90,90)
else if SecondsElapsed==22 then CreateColor(95,95,95)
else if SecondsElapsed==23 then CreateColor(99,99,99)
else if SecondsElapsed==24 then CreateColor(103,103,103)
else if SecondsElapsed==25 then CreateColor(108,108,108)
else if SecondsElapsed==26 then CreateColor(112,112,112)
else if SecondsElapsed==27 then CreateColor(116,116,116)
else if SecondsElapsed==28 then CreateColor(121,121,121)
else if SecondsElapsed==29 then CreateColor(125,125,125)
else if SecondsElapsed==30 then CreateColor(129,129,129)
else if SecondsElapsed==31 then CreateColor(133,133,133)
else if SecondsElapsed==32 then CreateColor(138,138,138)
else if SecondsElapsed==33 then CreateColor(142,142,142)
else if SecondsElapsed==34 then CreateColor(146,146,146)
else if SecondsElapsed==35 then CreateColor(151,151,151)
else if SecondsElapsed==36 then CreateColor(155,155,155)
else if SecondsElapsed==38 then CreateColor(159,159,159)
else if SecondsElapsed==39 then CreateColor(164,164,164)
else if SecondsElapsed==40 then CreateColor(168,168,168)
else if SecondsElapsed==41 then CreateColor(172,172,172)
else if SecondsElapsed==42 then CreateColor(177,177,177)
else if SecondsElapsed==43 then CreateColor(181,181,181)
else if SecondsElapsed==44 then CreateColor(185,185,185)
else if SecondsElapsed==45 then CreateColor(190,190,190)
else if SecondsElapsed==46 then CreateColor(194,194,194)
else if SecondsElapsed==47 then CreateColor(198,198,198)
else if SecondsElapsed==48 then CreateColor(203,203,203)
else if SecondsElapsed==49 then CreateColor(207,207,207)
else if SecondsElapsed==50 then CreateColor(211,211,211)
else if SecondsElapsed==52 then CreateColor(216,216,216)
else if SecondsElapsed==53 then CreateColor(220,220,220)
else if SecondsElapsed==54 then CreateColor(224,224,224)
else if SecondsElapsed==55 then CreateColor(229,229,229)
else if SecondsElapsed==56 then CreateColor(233,233,233)
else if SecondsElapsed==57 then CreateColor(237,237,237)
else if SecondsElapsed==58 then CreateColor(242,242,242)
else if SecondsElapsed==59 then CreateColor(249,249,249)
else CreateColor(255, 255, 255));

Notwithstanding the aforementioned limitations, I thought someone else who does scalping of very high velocity moves (such as EVK this morning) might find it useful. Obviously Welkin's work, his timer that I repurposed for this, is the most significant part of the indicator.
 
Last edited by a moderator:

chiropteraphile

New member
VIP
Thanks for this... but it's not working for me. Timer doesn't keep time or change at all, and background is perma-black, no colour change.
 

Pclark

New member
@lmk99 Thanks for the code... Question. How did you manage to hide the chart and only have the label produced by the code in the screen? I want to reduce clutter and have only the 1 tick label for this code as you did.
 

Pclark

New member
Hello, does anybody know how to do this configuration as posted by lmk99 in the initial posted picture of this thread?

" I trade with 1min candles so I have it as lower section study that appears in its own cell, above my main chart, like so:"

We can only see the label without any chart! a nice set up to avoid a crowded screen
 

rad14733

Well-known member
VIP
Hello, does anybody know how to do this configuration as posted by lmk99 in the initial posted picture of this thread?

" I trade with 1min candles so I have it as lower section study that appears in its own cell, above my main chart, like so:"

We can only see the label without any chart! a nice set up to avoid a crowded screen

So where would you have this data displayed if not on a chart...??? Are you referring to using this concept in a Custom Watchlist Column...??? Almost anything can be coded yet not be plotted on a chart... Details... We need details... Share your vision without us having to pry it out of you... Your request sounds somewhat ambiguous, at least to me... Just sayin...
 

zeek

Active member
2019 Donor
Hello, does anybody know how to do this configuration as posted by lmk99 in the initial posted picture of this thread?

" I trade with 1min candles so I have it as lower section study that appears in its own cell, above my main chart, like so:"

We can only see the label without any chart! a nice set up to avoid a crowded screen

You can select not to show either the price graph or the volume graph in chart settings. Add the label study to either of those and disable the other one. Then you can just resize the window so that only the label at top is shown.
 

drive9

New member
I do get the permablack as well, granted I am testing it after hours and get the same result in OnDemand. @Pclark how did you get yours to work? or anyone :)
YJ6ax34.png
 

Similar threads

Top