Study request: vertical line every 5 minutes

jumanjiz

New member
VIP
Looking for a study that will put a vertical line in for every 5 minutes (at the close... so 8:30, 8:35, 8:40, etc.). So it plots them all. Only really need for the day but if that's too hard, then just every 5 minutes for whatever chart im on.

I'd be putting this on a 1 minute chart... obvious i guess.

thank you!!
 
Solution
Code:
declare upper;

input time_interval = 10;

def x = (getTime() % (60 * time_interval * 1000));

def boundary = if x < x[1] then 1 else 0;

def c = if boundary[1] == 1 then 1 else c[1] + 1;

addVerticalLine( boundary == 1, " " + c, color.black);

def vlo = if x < x[1] then open else vlo[1];
plot vertical_line_open = vlo;
vertical_line_open.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

Had this lying around from something I was working on.
Code:
declare upper;

input time_interval = 10;

def x = (getTime() % (60 * time_interval * 1000));

def boundary = if x < x[1] then 1 else 0;

def c = if boundary[1] == 1 then 1 else c[1] + 1;

addVerticalLine( boundary == 1, " " + c, color.black);

def vlo = if x < x[1] then open else vlo[1];
plot vertical_line_open = vlo;
vertical_line_open.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

Had this lying around from something I was working on.
 
Solution

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

Code:
declare upper;

input time_interval = 10;

def x = (getTime() % (60 * time_interval * 1000));

def boundary = if x < x[1] then 1 else 0;

def c = if boundary[1] == 1 then 1 else c[1] + 1;

addVerticalLine( boundary == 1, " " + c, color.black);

def vlo = if x < x[1] then open else vlo[1];
plot vertical_line_open = vlo;
vertical_line_open.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

Had this lying around from something I was working on.

Thanks so much.

Is there a way to do one so it only paints them going forward and not backwards (already happened). Include that as an option easy to turn on/off (or if that part not easy, then just going forward).
 
Thanks so much.

Is there a way to do one so it only paints them going forward and not backwards (already happened). Include that as an option easy to turn on/off (or if that part not easy, then just going forward).
I'm trying to imagine what that would look like... only printing them on the right side expansion area? The right-most candle is 'now' and so if you don't print them back in time, there isn't much to display... perhaps I'm missing something.

-mashume
 
I'm trying to imagine what that would look like... only printing them on the right side expansion area? The right-most candle is 'now' and so if you don't print them back in time, there isn't much to display... perhaps I'm missing something.

-mashume

Well to give more clarity. I do 90% of my analysis on the 5, but then trade on the 1. I like to execute around 5 min close/open.

The code above is nice for analysis and review, but for purposes of active trading, i really only need like the next 5 min close/open and maybe 2 more after it... but it would be constantly updating.

Maybe the "last" one so that as you come up on a new one it doesn't immediately "go away" when the next 5 minute candle opens, and the next 3.... that just keeps updating as each new 5 min candle opens. (so if its say 10:02 am, the vertical lines would be at 10:00, 10:05, 10:10 and 10:15.... if its 2:33, the vertical lines would be at 2:30, 2:35, 2:40 and 2:45).

Does that make sense?
 
Well to give more clarity. I do 90% of my analysis on the 5, but then trade on the 1. I like to execute around 5 min close/open.

The code above is nice for analysis and review, but for purposes of active trading, i really only need like the next 5 min close/open and maybe 2 more after it... but it would be constantly updating.

Maybe the "last" one so that as you come up on a new one it doesn't immediately "go away" when the next 5 minute candle opens, and the next 3.... that just keeps updating as each new 5 min candle opens. (so if its say 10:02 am, the vertical lines would be at 10:00, 10:05, 10:10 and 10:15.... if its 2:33, the vertical lines would be at 2:30, 2:35, 2:40 and 2:45).

Does that make sense?
Ah. This code does not do that. I'll think about it though.
-mashume
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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