Does anyone have an indicator which will display the current time frame on a label?

kingkunta

New member
Hi I use 1,2,3,5,10,15m TFs very often and would like to know if anyone has an idea of an indicator to just display it in the corner? thanks in advance!
 
Solution
HTML:
def agg = GetAggregationPeriod() ;
AddLabel(yes,
        if  agg == AggregationPeriod.DAY then "Day" else
        if  agg == AggregationPeriod.WEEK then "Week" else
        if  agg == AggregationPeriod.HOUR then "Hour" else
        if  agg == AggregationPeriod.THIRTY_MIN then "30 mins" else
        if  agg == AggregationPeriod.FIFTEEN_MIN then "15 mins" else
        if  agg == AggregationPeriod.TEN_MIN then "10 mins" else
        if  agg == AggregationPeriod.FIVE_MIN then "5 mins" else
        if  agg == AggregationPeriod.THREE_MIN then "3 mins" else
        if  agg == AggregationPeriod.TWO_MIN then "2 mins" else
        if  agg == AggregationPeriod.MIN then "1 min" else "add your agg", Color.CYAN);

Florida

New member
HTML:
def agg = GetAggregationPeriod() ;
AddLabel(yes,
        if  agg == AggregationPeriod.DAY then "Day" else
        if  agg == AggregationPeriod.WEEK then "Week" else
        if  agg == AggregationPeriod.HOUR then "Hour" else
        if  agg == AggregationPeriod.THIRTY_MIN then "30 mins" else
        if  agg == AggregationPeriod.FIFTEEN_MIN then "15 mins" else
        if  agg == AggregationPeriod.TEN_MIN then "10 mins" else
        if  agg == AggregationPeriod.FIVE_MIN then "5 mins" else
        if  agg == AggregationPeriod.THREE_MIN then "3 mins" else
        if  agg == AggregationPeriod.TWO_MIN then "2 mins" else
        if  agg == AggregationPeriod.MIN then "1 min" else "add your agg", Color.CYAN);
 
Solution

kingkunta

New member
TY SO MUCH!
HTML:
def agg = GetAggregationPeriod() ;
AddLabel(yes,
        if  agg == AggregationPeriod.DAY then "Day" else
        if  agg == AggregationPeriod.WEEK then "Week" else
        if  agg == AggregationPeriod.HOUR then "Hour" else
        if  agg == AggregationPeriod.THIRTY_MIN then "30 mins" else
        if  agg == AggregationPeriod.FIFTEEN_MIN then "15 mins" else
        if  agg == AggregationPeriod.TEN_MIN then "10 mins" else
        if  agg == AggregationPeriod.FIVE_MIN then "5 mins" else
        if  agg == AggregationPeriod.THREE_MIN then "3 mins" else
        if  agg == AggregationPeriod.TWO_MIN then "2 mins" else
        if  agg == AggregationPeriod.MIN then "1 min" else "add your agg", Color.CYAN);
 

SleepyZ

Well-known member
VIP
Lifetime
Hi I use 1,2,3,5,10,15m TFs very often and would like to know if anyone has an idea of an indicator to just display it in the corner? thanks in advance!

Here is another

Ruby:
def agg1 = GetAggregationPeriod();
AddLabel(1, if agg1 == 31536000000
               then "Y" else
            if agg1 == 7776000000
               then "Q" else
            if agg1 == 2592000000
               then "M" else
            if agg1 == 604800000
               then "W" else
            if agg1 >= 84400000 and agg1 < 604800000
               then agg1 / 60000 / 1440 + "D"  else
            if agg1 >= 3600000 and agg1 < 84400000
               then agg1 / 60000 / 60 + "H"
            else agg1 / 60000 + "m", Color.YELLOW);
 

Williasmsmd19

New member
# Global Market Opens and Closes
# Vertical lines mark all open and closes
# Horizontal lines mark US, AUD opens and closes
# ThinkScript Chat Room Group
# Added Close / Open Lines for US and AUD

declare hide_on_daily;

input Plot_Verticle_Line = yes;
input Show_US = yes;
input Show_London = yes;
input Show_Sydney = yes;
input Show_Asian = yes; #HINT Show_Asian: IMPORTANT, BE SURE to adjust for part of year where USA goes to Daylight Savings but Asia remains on Standard time
input US_Open = 0930;
input US_Close = 1600;
input GBP_Open = 0300;
input GBP_Close = 1130;
input AUD_Open = 1800;
input AUD_Close = 0000;
input JPY_Open = 1900; #HINT JPY_Open: IMPORTANT, BE SURE to adjust for part of year where USA goes to Daylight Savings but Asia remains on Standard time
input JPY_Close = 0100; #HINT JPT_Close: IMPORTANT, BE SURE to adjust for part of year where USA goes to Daylight Savings but Asia remains on Standard time
input US_Bond_Close = 1500;
input Metals_Futures_Close = 1700;

#US
AddVerticalLine(secondsFromTime(US_Open)[1] < 0 && secondsFromTime(US_Open) >= 0 and
Plot_Verticle_Line and
Show_US, concat("US_Open", ""), Color.Green, curve.POINTS);
AddVerticalLine(secondsFromTime(US_Close)[1] < 0 && secondsFromTime(US_Close) >= 0 and
Plot_Verticle_Line and
Show_US, concat("US_Close", ""), Color.Green, curve.POINTS);
#AUD
def AUDopen = if secondsFromTime(AUD_Open)[1] < 0 &&
secondsFromTime(AUD_Open) >= 0
then barnumber()
else AUDopen[1];
def DataAUDopenLine = if barnumber()-1 == AudOpen
then if IsNaN(barnumber())
then HighestAll(open[1])
else open[1]
else DataAUDopenLine[1];

AddVerticalLine(secondsFromTime(AUD_Open)[1] < 0 &&
secondsFromTime(AUD_Open) >= 0 and
Plot_Verticle_Line and
Show_Sydney, concat("AUD_Open", " "), Color.Yellow, curve.POINTS);

def AUDclose = if secondsFromTime(AUD_Close)[1] < 0 &&
secondsFromTime(AUD_Close) >= 0
then barnumber()
else AUDclose[1];
def DataAUDcloseLine = if barnumber()-1 == Audclose
then if IsNaN(barnumber())
then HighestAll(close[1])
else close[1]
else DataAUDcloseLine[1];
AddVerticalLine(secondsFromTime(AUD_Close)[1]<0 && secondsFromTime(AUD_Close) >=0 and
Plot_Verticle_Line and
Show_Sydney, concat("AUD_Close",""),Color.Yellow, curve.POINTS);
# JPY
AddVerticalLine(secondsFromTime(JPY_Open)[1] < 0 &&
secondsFromTime(JPY_Open) >= 0 and
Plot_Verticle_Line and
Show_Asian, concat("JPY_Open", ""), Color.Red, curve.POINTS);

AddVerticalLine(secondsFromTime(JPY_Close)[1] < 0 &&
secondsFromTime(JPY_Close) >= 0 and
Plot_Verticle_Line and
Show_Asian, concat("JPY_Close", ""), Color.Red, curve.POINTS);
# GBP
AddVerticalLine(secondsFromTime(GBP_Open)[1] < 0 &&
secondsFromTime(GBP_Open) >= 0 and
Plot_Verticle_Line and
Show_London, concat("GBP_Open", ""), Color.Blue, curve.POINTS);

AddVerticalLine(secondsFromTime(GBP_Close)[1] < 0 &&
secondsFromTime(GBP_Close) >= 0 and
Plot_Verticle_Line and
Show_London, concat("GBP_Close", ""), Color.Blue, curve.POINTS);
# US Bond Close
AddVerticalLine(secondsFromTime(US_Bond_Close)[1] < 0 &&
secondsFromTime(US_Bond_Close) >= 0 and
Plot_Verticle_Line and
Show_London, concat("US_Bond_Close", ""), Color.Plum, curve.POINTS);
# Metals Futures Close
AddVerticalLine(secondsFromTime(Metals_Futures_Close)[1] < 0 &&
secondsFromTime(Metals_Futures_Close) >= 0 and
Plot_Verticle_Line and
Show_London, concat("Metal_Futs_Close", ""), Color.Orange, curve.POINTS);
# End Code
 

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Top