Plot Daily open on intraday charts for Futrues


Category:
0
0

I’m trying to plot each days daily open (8:30am) on 5 min intraday charts with a 5 day time frame.

I have the script below, however, it only plots the most recent open……is it even possible to do the above ?

input opentime = 0930;
input ORend = 0935;

def na = Double.NaN;
#
# Check if the opening range time is now
#
def ORActive = if GetLastDay() == GetDay() and SecondsFromTime(opentime) >= 0 and SecondsFromTime(ORend) <
0 then 1 else 0;
#
# Track the OR high and low
#
def OROpen = if ORActive then open else na;
def ORLow = if ORActive then low else na;

plot ORAO = if GetLastDay() != GetDay() then na else OROpen;
orao.SetDefaultColor(Color.blue);
orao.SetLineWeight(1);

 

Marked as spam
Posted by (Questions: 2, Answers: 0)
Asked on May 26, 2021 6:52 pm
339 views
0
Private answer

The "daily open" for futures, also known as the "cash session open" is 8:30 am Chicago time zone. That would be 9:30 am Eastern. Same exact moment the equities open for regular trade on the major US indexes. I wanted to make sure this was perfectly clear before providing my solution. If you intended to use this for something other than the 9:30 am Eastern regular session open then you need to restate your question more clearly and be sure to include those additional details.

Use the built-in chart study named: "DailyOpen"

This built-in chart study included with Thinkorswim uses a secondary aggregation period to read the cash session open for any instrument, regardless whether you are talking about futures or options contracts or regular stocks and ETF's.

You can adjust the "aggregation period" user input to whatever time frame you like, just so long as that time frame is equal to or greater than the time frame set on the chart (however it will not work at all on tick or range bar charts). If you want the line to plot for all sessions on the chart then you simply set the "show only last period" user input to "No".

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on May 26, 2021 8:16 pm