Countdown to bar close in ThinkorSwim?


Hey guys. I've been using tick charts and I like that it tells you how many ticks have passed in the formation of a new 1k tick candle (you can count how many are left until a new candle forms). In the attached screenshot, it says 960, that means 960 trades/ticks have been made in that candle (meaning 40 remain to fully form that candle, and then a new candle will be formed with another 1k ticks/trades).

I want to do that with the 5m chart (time chart, not tick).
Is there an indicator that could tell me the remaining minutes and seconds until the formation of a new 5m candle? A countdown for the formation of 5 minute candles. Thank you!

Last edited by a moderator:


Staff member
I don't think there is a timer for when the current bar is closing. However, you can use the clock at the top left-hand corner. That's what I've been using to check for the remaining time before the next candle starts forming.



Active member
2019 Donor
@anycolour There is a countdown in Ninja, but no real countdown in TOS. That said, there is a code that will make a "ding" sound when a time-based candle closes.

input Interval_In_Minutes = 15;

def MinutesGoneBy = SecondsFromTime(15) / 60;

def IntervalPast = Round(((MinutesGoneBy / Interval_In_Minutes) / 100));

def IntervalGoneBy = if IntervalPast > IntervalPast[1] then 1 else 0;

Alert(IntervalGoneBy == 1, " ", Alert.BAR, Sound.Chimes);

If you want a really flexible countdown for multi. time frames, I use this. Set it up once and forget it.
It even speaks. I have it set to say, 15-minutes, 1-hour, 1st hour, etc.



Can someone create a label that count down in 5 minutes intervals and resets after every 5 minute completion? (i.e. 5:00m; 4:30s;4:00m; 3:30s......)


Active member
2019 Donor
Like the title says, is there any such indicator avaliable? For example a chart label with countdown or some other visual way of knowing how much time is left before the current candle closes.

Would be really useful to have.


Active member
2019 Donor
Hi @john3 , i downloaded this application and was wondering if there is a way to have a countdown for a specific timeframe so that it continues to loop this countdown once the candle has closed?
For example, if i use the 5min timeframe i would like the countdown clock to start from 05:00 and go back until candle closes and then automatically restart this countdown again and again. Is this the way you have it setup?


there has to be a way to do this. i have multiple scripts which give time, but nothing like a timer.

here is a time at bar, but im going to spend some time developing a timer

#5:24 Mobius: # Time at bar

# Mobius
# V01

def agg = getAggregationPeriod();
def barT = agg / 1000 / 60;
def t = getTime();
def RTHstart = RegularTradingStart(getYYYYMMDD());
def sumMin = if getTime() crosses above RTHstart
             then 30
             else if getTime() > RTHstart
                  then sumMin[1] + barT
                  else sumMin[1];
def time = if t crosses above RTHstart
           then 930
           else if t crosses  RTHstart
           then 2000
           else if getDay() != getDay()[1]
           then 0         
           else if t % agg == 0 and sumMin % 60 != 0
                then time[1] + barT
                else if t % agg == 0 and sumMin % 60 == 0
                     then time[1] + 42
                     else time[1];
addLabel(1, "N.Y. time at begining of current bar: " + AsPrice(time));

# Elapsed Time During RTH
# Mobius
# Chat Room Request

input StartTime = 0930;
input EndTime = 1600;
input BenchTime = AggregationPeriod.min;

def period = BenchTime / 1000 / 60;
##def agg = getAggregationPeriod();
def Active = SecondsFromTime(StartTime) >=0 and
             SecondsTillTime(EndTime) >= 0;
def now = if Active and !Active[1]
          then 1
          else if Active
          then now[1] + 1
          else now[1];
def elapsed = now * agg;     
def durationInHours = elapsed / BenchTime;
AddLabel(1, "In " + period + " Min Time Period = " + durationInHours, color.white);
Last edited by a moderator:

Similar threads