Mark out ranges until end of day

letsfingo

New member
I am looking at a futures charts and would like to see the RTH hours range highlighted in a rectangle from the high to the low, for every day except the current day. Can someone help?

I made an attempt but this does not work:

Highlight Full Regular Trading Hours (RTH) Session
input RTHStartTime = 0930; # 9:30 ET
input RTHEndTime = 1600; # 16:00 ET
 
Last edited by a moderator:
I am looking at a futures charts and would like to see the RTH hours range highlighted in a rectangle from the high to the low, for every day except the current day. Can someone help?

I made an attempt but this does not work:

# Highlight Full Regular Trading Hours (RTH) Session

input RTHStartTime = 0930; # 9:30 ET
input RTHEndTime = 1600; # 16:00 ET

def withinRTH =
SecondsFromTime(RTHStartTime) >= 0 and
SecondsTillTime(RTHEndTime) > 0;

def newDay = GetDay() != GetDay()[1];

# Get highest high and lowest low for the entire RTH session
def todayHigh = if withinRTH then HighestAll(high, GetDay()) else Double.NaN;
def todayLow = if withinRTH then LowestAll(low, GetDay()) else Double.NaN;

# Skip current day
def lastDate = HighestAll(GetYYYYMMDD());
def isCurrentDay = GetYYYYMMDD() == lastDate;

def plotHigh = if withinRTH and !isCurrentDay then todayHigh else Double.NaN;
def plotLow = if withinRTH and !isCurrentDay then todayLow else Double.NaN;

plot HighLine = plotHigh;
HighLine.SetDefaultColor(Color.GREEN);

plot LowLine = plotLow;
LowLine.SetDefaultColor(Color.RED);

AddCloud(plotHigh, plotLow, Color.LIGHT_GRAY, Color.LIGHT_GRAY);
Click to expand...

reply to 364

if you want futures, why are you using normal trading hours?
a futures day is 6pm to 5pm. it spans over midnight.
https://tastytrade.com/futures/futures-market-hours/

this shows 3 trading periods. adjust it as needed hilolines_08
https://usethinkscript.com/threads/average-daily-range-indicator-for-thinkorswim.244/#post-66296

this shows 1 period hiloline_07
https://usethinkscript.com/threads/...rkets-for-thinkorswim.14520/page-3#post-58176

-----------------------------


# Highlight Full Regular Trading Hours (RTH) Session
input RTHStartTime = 0930; # 9:30 ET
input RTHEndTime = 1600; # 16:00 ET
futures data is 6pm to 5pm, not 9:30 to 5
def withinRTH =
SecondsFromTime(RTHStartTime) >= 0 and
SecondsTillTime(RTHEndTime) > 0;
def newDay = GetDay() != GetDay()[1];
# Get highest high and lowest low for the entire RTH session
def todayHigh = if withinRTH then HighestAll(high, GetDay()) else Double.NaN;
def todayLow = if withinRTH then LowestAll(low, GetDay()) else Double.NaN;
highestall() only has 1 parameter, not 2.
you would need a different formula within highestall() that defines only 1 period, not multiple days
# Skip current day
def lastDate = HighestAll(GetYYYYMMDD());
def isCurrentDay = GetYYYYMMDD() == lastDate;
if expansion area is visible, this will show a date in the future with no price data
HighestAll(GetYYYYMMDD());
alt,
def lastday = getday() == getlastday();
https://toslc.thinkorswim.com/center/reference/thinkScript/Functions/Date---Time/GetLastDay
def plotHigh = if withinRTH and !isCurrentDay then todayHigh else Double.NaN;
def plotLow = if withinRTH and !isCurrentDay then todayLow else Double.NaN;
plot HighLine = plotHigh;
HighLine.SetDefaultColor(Color.GREEN);
plot LowLine = plotLow;
LowLine.SetDefaultColor(Color.RED);
AddCloud(plotHigh, plotLow, Color.LIGHT_GRAY, Color.LIGHT_GRAY);
 
Last edited by a moderator:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

I look at futures and I would like to mark out the high and low of several different time ranges. They should be marked by a horizontal price level that extends until the end of the futures day.

Time ranges:
18:00 to 3:00
3:00 to 9:30
9:30 to 11
12 to 13
13 to 16

Can someone please assist?
 
Last edited by a moderator:

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
613 Online
Create Post

Similar threads

Similar threads

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.
Back
Top