hi I would like to ask if anyone knows how to put a daily lines separator (Monday-Tuesday-Wednesday- Thursday-Friday-Sunday) for futures Es and Gold
I don't know any think about coding appreciate if some one can point me out if there is one all ready done than you
Enzo
Code:declare lower; def d = GetDayOfWeek(GetYYYYMMDD()); def year = GetYear() - (Round(GetYYYYMMDD() / 1000000, 0) * 100); def Month = GetMonth(); def Day =...
hi I would like to ask if anyone knows how to put a daily lines separator (Monday-Tuesday-Wednesday- Thursday-Friday-Sunday) for futures Es and Gold
I don't know any think about coding appreciate if some one can point me out if there is one all ready done than you
Enzo
Code:declare lower; def d = GetDayOfWeek(GetYYYYMMDD()); def year = GetYear() - (Round(GetYYYYMMDD() / 1000000, 0) * 100); def Month = GetMonth(); def Day = GetDayOfMonth(GetYYYYMMDD()); input openingTime = 0000; def sec = SecondsFromTime(openingTime); def range = if sec == 0 then range[1] + 1 else range[1]; addverticalLine(sec==0,"Midnight",color.cyan, stroke = Curve.FIRM); input showdayofweek = yes; def rthstart = if d[1] == 5 and d == 1 then GetYYYYMMDD() != GetYYYYMMDD()[1] else sec==0 ;#GetTime() crosses above RegularTradingStart(GetYYYYMMDD()); def bubble = if rthstart then BarNumber() else bubble[1]; AddVerticalLine(BarNumber() == bubble, " ", Color.WHITE, stroke = Curve.FIRM); AddChartBubble(BarNumber() == bubble, 100, if showdayofweek then (if d[1] == 5 and d == 1 then "Sunday" else if d == 1 then "Monday" else if d == 2 then "Tuesday" else if d == 3 then "Wednesday" else if d == 4 then "Thursday" else if d == 5 then "Friday" else if d == 6 then "Saturday" else if d == 7 then "Sunday" else "") + "\n" + (if Month < 10 then "0" else "") + Month + "" + (if Day < 10 then "0" else "") + Day + "" + year else (if Month < 10 then "0" else "") + Month + "" + (if Day < 10 then "0" else "") + Day + "" + year, if close(period = AggregationPeriod.DAY) > open(period = AggregationPeriod.DAY) then Color.GREEN else Color.RED); plot line105 = 105; plot line100 = 100; plot line0 = 0; line105.SetDefaultColor(Color.BLACK); line100.SetDefaultColor(Color.BLACK); line0.SetDefaultColor(Color.BLACK);
i have one more question to ask if you would know how to create an horizontal line to show YC (Yesterday close ) for futures Gold and ES they close at 5pm thank you
Ruby:def yclose = if secondsfromTime(1600) == 0 then close else yclose[1]; plot pclose = yclose; pclose.setpaintingStrategy(paintingStrategy.HORIZONTAL);
def yclose = if secondsfromTime(1600) == 0
then close
else yclose[1];
input showOnlyLastPeriod = no;
plot pclose = yclose;
pclose.setpaintingStrategy(paintingStrategy.HORIZONTAL);
great thank you i try to add this line but is not working and i don't know yet to post picture can you tell me what is wrong wit this line trying to show only last period thanks for your help
Code:def yclose = if secondsfromTime(1600) == 0 then close else yclose[1]; input showOnlyLastPeriod = no; plot pclose = yclose; pclose.setpaintingStrategy(paintingStrategy.HORIZONTAL);
Ruby:def yclose = if secondsfromTime(1600) == 0 then close else yclose[1]; def bn = barnumber(); def ybar = if secondsfromTime(1600) == 0 then bn else double.nan; input showOnlyLastPeriod = no; plot pclose = if showonlylastPeriod and bn < highestall(ybar) then double.nan else yclose; pclose.setpaintingStrategy(paintingStrategy.HORIZONTAL);
Your post was moved here. As these scripts better further your quest.Any chance this
https://usethinkscript.com/threads/weekly-vertical-line.16045/
can be modified to show the day of the week everyday, and not just the first day of the week?
Would also really like it if I could change the time that the date appears. For instance, have it appear at the NY opening bell instead of at the turn of the new day.
Any chance this
https://usethinkscript.com/threads/weekly-vertical-line.16045/
can be modified to show the day of the week everyday, and not just the first day of the week?
Would also really like it if I could change the time that the date appears. For instance, have it appear at the NY opening bell instead of at the turn of the new day.
Code:#daily vertical line @ NY start time #Move this to upper panel, turn off chart settings/price axis/ uncheck enable left axis declare lower; input x_number = 2; input display_x_number = {default x, all}; input vertical_date = no; input bubbles = yes; input bubble_location = {default bottom, top}; def agg = GetAggregationPeriod() / 60000; def bn = BarNumber(); def starttime = if agg == 4 then 928 else if agg == 20 then 920 else if agg == 60 then 900 else if agg == 240 then 900 else 930; #Limit plot of vertical line and/or bubble to NY start time def xstartbn = if !IsNaN(close(period = AggregationPeriod.DAY)) then bn else 0; def start = if bn != xstartbn then Double.NaN else SecondsFromTime(starttime) == 0; #Count of start to be used in limiting display_x_number of verticl line and/or bubble def xnumber = if start then xnumber[1] + 1 else xnumber[1]; def year = (Round(GetYYYYMMDD() / 10000, 0)); def Month = GetMonth(); def Day = GetDayOfMonth(GetYYYYMMDD()); AddVerticalLine( if display_x_number == display_x_number.x then if HighestAll(xnumber) - x_number < xnumber then start else Double.NaN else start, if vertical_date then (if GetDayOfWeek(GetYYYYMMDD()) == 1 then "Monday" else if GetDayOfWeek(GetYYYYMMDD()) == 2 then "Tuesday" else if GetDayOfWeek(GetYYYYMMDD()) == 3 then "Wednesday" else if GetDayOfWeek(GetYYYYMMDD()) == 4 then "Thursday" else if GetDayOfWeek(GetYYYYMMDD()) == 5 then "Friday" else if GetDayOfWeek(GetYYYYMMDD()) == 7 then "Sunday" else "") + " " + Month + "/" + Day + "/" + AsPrice(year) else "" , Color.GRAY); #Location for for bubbles plot x100 = if start then 100 else Double.NaN; plot x0 = if start then 0 else Double.NaN; AddChartBubble(bubbles and if display_x_number == display_x_number.x then if HighestAll(xnumber) - x_number < xnumber then start else Double.NaN else start, (if bubble_location == bubble_location.top then x100 else x0), (if GetDayOfWeek(GetYYYYMMDD()) == 1 then "Monday" else if GetDayOfWeek(GetYYYYMMDD()) == 2 then "Tuesday" else if GetDayOfWeek(GetYYYYMMDD()) == 3 then "Wednesday" else if GetDayOfWeek(GetYYYYMMDD()) == 4 then "Thursday" else if GetDayOfWeek(GetYYYYMMDD()) == 5 then "Friday" else if GetDayOfWeek(GetYYYYMMDD()) == 7 then "Sunday" else "") + "\n" + Month + "/" + Day + "/" + AsPrice(year) , Color.GRAY, (if bubble_location == bubble_location.top then no else yes)); #
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
B | Daily High Low Lines +Bubbles | Questions | 2 | |
E | daily, weekly and monthly OHLC lines | Questions | 2 | |
C | 5 Vertical lines daily | Questions | 1 | |
H | Plot Daily High & Low Lines upon Trigger | Questions | 1 | |
T | plot 4 lines daily at a specific time | 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.