1min Hi, Low, Open for FUTURES trading

NyteNyte

New member
Hello all. I am trying to get a custom script made for ThinkorSwim. I have attached a photo of what I would like.

I am trying to create a simple script that labels and creates a horizontal line for:
  • the OPEN
  • 1 min HI at OPEN
  • 1 min LO at OPEN

I would love to be able to change the time as well. So for instance, when looking at the image attached, /MCL opens at 6pm EST. The pic below shows I have the HI and the LO for 6:01 marked out. I would love to be able to change that to 9:30AM EST as well.

Thank you to anybody who can help fulfill this request or to anybody who can point me in the direction of a similar script.
HAPPY TRADING!!!



7fhTIG2.png
 
Solution
Hello all. I am trying to get a custom script made for ThinkorSwim. I have attached a photo of what I would like.

I am trying to create a simple script that labels and creates a horizontal line for:
  • the OPEN
  • 1 min HI at OPEN
  • 1 min LO at OPEN

I would love to be able to change the time as well. So for instance, when looking at the image attached, /MCL opens at 6pm EST. The pic below shows I have the HI and the LO for 6:01 marked out. I would love to be able to change that to 9:30AM EST as well.

Thank you to anybody who can help fulfill this request or to anybody who can point me in the direction of a similar script.
HAPPY TRADING!!!



7fhTIG2.png

This should find the time input or...
Hello all. I am trying to get a custom script made for ThinkorSwim. I have attached a photo of what I would like.

I am trying to create a simple script that labels and creates a horizontal line for:
  • the OPEN
  • 1 min HI at OPEN
  • 1 min LO at OPEN

I would love to be able to change the time as well. So for instance, when looking at the image attached, /MCL opens at 6pm EST. The pic below shows I have the HI and the LO for 6:01 marked out. I would love to be able to change that to 9:30AM EST as well.

Thank you to anybody who can help fulfill this request or to anybody who can point me in the direction of a similar script.
HAPPY TRADING!!!



7fhTIG2.png

This should find the time input or the closest time, if the time input is not on the chart.
It will plot the Open, High, Low, Close of the time input
Optional verticalline and movable bubbles are included
Should work on stocks and futures

Code:
#OHLC_Time_Hour_Minutes_Bubble

input time = 1800;

#Find time closest to time input if that time does not exist on chart
def cond  = SecondsFromTime(time)[1] < 0 and SecondsFromTime(time) >= 0;
def stock = TickValue() == .01;

#Find values at cond
def otime = if cond then open else otime[1];
def ctime = if cond then close else ctime[1];
def htime = if cond then high else htime[1];
def ltime = if cond then low else ltime[1];

plot opentime  = otime;
plot closetime = ctime;
plot hightime  = htime;
plot lowtime   = ltime;

opentime.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
closetime.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
hightime.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
lowtime.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

DefineGlobalColor("H", Color.GREEN);
DefineGlobalColor("L", Color.RED);
DefineGlobalColor("O", Color.WHITE);
DefineGlobalColor("C", Color.YELLOW);

opentime.SetDefaultColor(GlobalColor("O"));
closetime.SetDefaultColor(GlobalColor("C"));
hightime.SetDefaultColor(GlobalColor("H"));
lowtime.SetDefaultColor(GlobalColor("L"));

#Find time (hours and minutes) closest to time input

#Time zone
input timezone = {default "ET", "CT", "MT",  "PT"};

def starthour  = (if timezone == timezone."ET" then 9
   else if timezone == timezone."CT" then 8
   else if timezone == timezone."MT" then 7
   else 6);

def hour    = Floor(((starthour * 60 + (if TickValue() == 10 then 0 else 30)) + (GetTime() - RegularTradingStart(GetYYYYMMDD())) / 60000) / 60);
def minutes = (GetTime() - RegularTradingStart(GetYYYYMMDD())) / 60000 - ((hour - starthour) * 60 + 30) + 60;
def bn = BarNumber();
#def bartime = if cond then bn else bartime[1];
def hrtime  = if cond then (if !stock and hour < 0 then (24 + hour) else hour) else hrtime[1];
def mintime = if cond then minutes else mintime[1];
#addchartBubble(1, low, hour+"\n"+hrtime, color.gray, no);
#Bubbles
input last_bubble = yes;
input bar_bubble  = yes;

input bubblemover = 2;
def b  = bubblemover;
def b1 = b + 1;
def mover = IsNaN(close[bubblemover]) and !IsNaN(close[bubblemover + 1]);

#Last Bubbles in Right Expansion

AddChartBubble(last_bubble and mover, opentime, hrtime + ":" + (if (if TickValue() == 10 then (mintime - 30) else mintime) < 10 then "0" else "") + (if TickValue() == 10 then (mintime - 30) else mintime) + "Open - " + opentime, GlobalColor("O"), if closetime > opentime then no else yes);
AddChartBubble(last_bubble and mover, closetime, hrtime + ":" + (if (if TickValue() == 10 then (mintime - 30) else mintime) < 10 then "0" else "") + (if TickValue() == 10 then (mintime - 30) else mintime) + "Close - " + closetime, GlobalColor("C"), if closetime > opentime then yes else no);
AddChartBubble(last_bubble and mover, hightime, hrtime + ":" + (if (if TickValue() == 10 then (mintime - 30) else mintime) < 10 then "0" else "") + (if TickValue() == 10 then (mintime - 30) else mintime) + "High - " + hightime, GlobalColor("H"));
AddChartBubble(last_bubble and mover, lowtime, hrtime + ":" + (if (if TickValue() == 10 then (mintime - 30) else mintime) < 10 then "0" else "") + (if TickValue() == 10 then (mintime - 30) else mintime) + "Low - " + lowtime, GlobalColor("L"), no);

#Bubble at bar where time closest to time input occured
AddChartBubble(bar_bubble and cond, low, hrtime + ":"  + (if (if TickValue() == 10 and minutes >= 30 then (minutes - 30) else minutes) < 10 then "0" else "") + (if TickValue() == 10 and minutes >= 30 then (minutes - 30) else minutes), Color.WHITE, no);

input verticalline = yes;
AddVerticalLine(verticalline and cond, " ", stroke = Curve.FIRM);

#
 
Solution

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
272 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