help to show line on 15 minutes chart

Enzo

New member
VIP
am trying to show close line on a15 and 5 minutes chart i don't know much about coding trying to copy and paste did this and only works on a 5 minutes what need to do to show on 15 minutes also thank you

input aggregationPeriod = AggregationPeriod.DAY;

input showOnlyLastPeriod = no;

def yclose = if secondsfromTime(1655) == 0
then close
else yclose[1];
def bn = barnumber();
def ybar = if secondsfromTime(1655) == 0
then bn
else double.nan;

plot pclose = if showonlylastPeriod and bn < highestall(ybar)
then double.nan
else yclose;
pclose.setpaintingStrategy(paintingStrategy.HORIZONTAL);
 
Enzo,
Is this what you are looking for? It was provided by BenTen linked Here.


Code:
# Previous Day Closing Price (PCL)
input aggregationPeriod = AggregationPeriod.DAY;
def close = close(period = aggregationPeriod)[1];
plot previous_close = close;
 
am trying to show close line on a15 and 5 minutes chart i don't know much about coding trying to copy and paste did this and only works on a 5 minutes what need to do to show on 15 minutes also thank you

input aggregationPeriod = AggregationPeriod.DAY;

input showOnlyLastPeriod = no;

def yclose = if secondsfromTime(1655) == 0
then close
else yclose[1];
def bn = barnumber();
def ybar = if secondsfromTime(1655) == 0
then bn
else double.nan;

plot pclose = if showonlylastPeriod and bn < highestall(ybar)
then double.nan
else yclose;
pclose.setpaintingStrategy(paintingStrategy.HORIZONTAL);

on a 15min chart, the time 1655 doesn't exist. 4:55 is skipped over.

change the 1655 to a different number, for different times
def ybar = if secondsfromTime(1655) == 0

60 - chart time = 60 - 15 = 45
(1645)


a better way, would be to use some code that finds the last bar of the day,
https://usethinkscript.com/threads/finding-the-first-and-last-bar-of-the-day-in-thinkorswim.526/
 
Enzo,
Is this what you are looking for? It was provided by BenTen linked Here.


Code:
# Previous Day Closing Price (PCL)
input aggregationPeriod = AggregationPeriod.DAY;
def close = close(period = aggregationPeriod)[1];
plot previous_close = close;
thanks for your reply what am trying to do is to be able to view closing price for ES on 5 minutes and 15 minutes chart closing time for TOS 15:55
also would like to view Gold 5 minutes and 15 minutes chart closing price 16:55 and don't know how to do it should make different script for different time ?
thank you
 
on a 15min chart, the time 1655 doesn't exist. 4:55 is skipped over.

change the 1655 to a different number, for different times
def ybar = if secondsfromTime(1655) == 0

60 - chart time = 60 - 15 = 45
(1645)


a better way, would be to use some code that finds the last bar of the day,
https://usethinkscript.com/threads/finding-the-first-and-last-bar-of-the-day-in-thinkorswim.526/
thank you just reply to Galtas explaining what i want to do if you can read also appriciate every one respond
 

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

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
251 Online
Create Post

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