# +------------------------------------------------------------+
# | Example: Round to the nearest X |
# | Robert Payne |
# | https://funwiththinkscript.com |
# +------------------------------------------------------------+
input nearest_x = 5;
def daily_open = open(period = AggregationPeriod.DAY);
def round_to_nearest_x = Round(daily_open / nearest_x, 0) * nearest_x;
plot data = round_to_nearest_x;
data.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
i like post above is any chance you can adjust to see the line showing only for 1 day , THANKS
# price_near_day_open_01
# https://usethinkscript.com/threads/nearest-price-level-to-the-open.5757/
# Nearest Price Level to the Open
#+------------------------------------------------------------+
# | Example: Round to the nearest X |
# | Robert Payne |
# | https://funwiththinkscript.com |
# +------------------------------------------------------------+
def na = double.nan;
input nearest_x = 5;
def daily_open = open(period = AggregationPeriod.DAY);
def round_to_nearest_x = Round(daily_open / nearest_x, 0) * nearest_x;
# is last day the current day
def istoday = if GetLastDay() == GetDay() then 1 else 0;
input show_only_today = yes;
def days_enable = if show_only_today then istoday else 1;
plot data = if days_enable then round_to_nearest_x else na;
data.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
data.SetDefaultColor(Color.yellow);
#
# price_near_day_open_01
# [URL]https://usethinkscript.com/threads/nearest-price-level-to-the-open.5757/[/URL]
# Nearest Price Level to the Open
#+------------------------------------------------------------+
# | Example: Round to the nearest X |
# | Robert Payne |
# | [URL]https://funwiththinkscript.com[/URL] |
# +------------------------------------------------------------+
def na = double.nan;
input nearest_x = 5;
def daily_open = open(period = AggregationPeriod.DAY);
def round_to_nearest_x = Round(daily_open / nearest_x, 0) * nearest_x;
# is last day the current day
def istoday = if GetLastDay() == GetDay() then 1 else 0;
input show_only_today = yes;
def days_enable = if show_only_today then istoday else 1;
plot data = if days_enable then round_to_nearest_x else na;
data.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
data.SetDefaultColor(Color.white);
#end
I need help to add (addchartbubble) on program with name"Nearest" below: Thank you
# price_near_day_open_01
# https://usethinkscript.com/threads/nearest-price-level-to-the-open.5757/
# Nearest Price Level to the Open
#+------------------------------------------------------------+
# | Example: Round to the nearest X |
# | Robert Payne |
# | https://funwiththinkscript.com |
# +------------------------------------------------------------+
def na = double.nan;
input nearest_x = 5;
def daily_open = open(period = AggregationPeriod.DAY);
def round_to_nearest_x = Round(daily_open / nearest_x, 0) * nearest_x;
# is last day the current day
def istoday = if GetLastDay() == GetDay() then 1 else 0;
input show_only_today = yes;
def days_enable = if show_only_today then istoday else 1;
plot data = if days_enable then round_to_nearest_x else na;
data.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
data.SetDefaultColor(Color.white);
#end
Code:input showbubble = yes; input bubblemover = 2;#Moves bubbles sideways by # of bars input def b = bubblemover; def b1 = b + 1; AddChartBubble(showbubble and IsNaN(close[b]) and !IsNaN(close[b1]), data[b], "Nearest\n " + AsDollars(data[b]), Color.WHITE); #
I sorry to bother you again. Is that possible you can help me "addcharbubble" to the left hand side view, It's much easier for me to see (current is on right view). I got some other addchartbubble block it in front view.
Thank you so much again.
This is what I've been looking for (minus the line). Not sure why I didn't thk of this myself. Thank you!Ruby:# +------------------------------------------------------------+ # | Example: Round to the nearest X | # | Robert Payne | # | https://funwiththinkscript.com | # +------------------------------------------------------------+ input nearest_x = 5; def daily_open = open(period = AggregationPeriod.DAY); def round_to_nearest_x = Round(daily_open / nearest_x, 0) * nearest_x; plot data = round_to_nearest_x; data.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
View attachment 9657
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
K | get the delta of the nearest experation ATM option | Questions | 2 | |
G | Rounding ATR levels to the nearest quarter FUTURES help | Questions | 3 | |
C | Anyway to find nearest ITM option call for a given number | Questions | 6 | |
F | How to do a scan/filter for IV of nearest weekly options? | Questions | 4 | |
J | Candle price by cent | Questions | 2 |
Start a new thread and receive assistance from our community.
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.
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.