plot line at specific time and date

bkbrown

New member
I got this indicator that plots a line at a specific time. Can someone help me edit it (or can it be edited) to anchor the line to a date? Right now, the indicator keeps plotting the line each day based on the input time, but I dont want it to start over each day, I want it to be anchored to the time as well as the date I enter. Can this be done?





#vertical line at a specific time

input startdate = 20220101;
Input time = 1200;
def starttime = secondsFromTime(time)==0;
def ext = if starttime then open else ext[1];
plot x = ext;

#AddVerticalLine(starttime, "Time = " + time , color = Color.Gray, stroke = Curve.POINTS);
#Vertical lines with the most flexibility/options

Input Percent_Range1 = .00125;

plot plotopenzoneH = X + (X * Percent_range1);
plot plotopenzoneL = X - (X * Percent_range1);

Input Percent_Range2 = .005;

plot plotSDhalfH = X + (X * Percent_range2);
plot plotSDhalfL = X - (X * Percent_range2);

Input Percent_Range3 = .01;

plot plotSD1H = X + (X * Percent_range3);
plot plotSD1L = X - (X * Percent_range3);

Input Percent_Range4 = .0075;

plot plotSDRH = X + (X * Percent_range4);
plot plotSDRL = X - (X * Percent_range4);

Input Percent_Range5 = .02;

plot plotSD2H = X + (X * Percent_range5);
plot plotSD2L = X - (X * Percent_range5);

Input Percent_Range6 = .015;

plot plotSD15H = X + (X * Percent_range6);
plot plotS15L = X - (X * Percent_range6);


Input Percent_Range7 = .03;

plot plotSD3H = X + (X * Percent_range7);
plot plotSD3L = X - (X * Percent_range7);


input bubblemover = 3;
def b = bubblemover;
def b1 = b + 1;


AddChartBubble(!IsNaN(close[b1]) and IsNaN(close), plotopenzoneH, "ALGO Tracking Zone ", Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close), plotopenzoneL, "ALGO Tracking Zone " , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close), plotSDhalfH, " Be smart Trader! Take some profits here " , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close), plotSDhalfL, " Be smart Trader! Take some profits here" , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close), plotSD1H, "Target#1 " , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close), plotSD1L, "Target#1 " , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close), plotSDRH, "!Reversal! ", Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close), plotSDRL, "!Reversal! " , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close), plotSD2H, "Target#2 " , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close), plotSD2L, "Target#2 " , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close), plotSD3H, "Take out STOPS here! (always look for H/L day to left!) " , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close), plotSD3L, "Take out STOPS here! (always look for H/L day to left!) " , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close), plotSD15H, "halfway " , Color.light_gray, no);


AddChartBubble(!IsNaN(close[b1]) and IsNaN(close), plotS15L, "halfway " , Color.light_gray, no);
AddLabel(yes, "I hunt ALGO", Color.gray);
 
Last edited by a moderator:
Solution
I got this indicator that plots a line at a specific time. Can someone help me edit it (or can it be edited) to anchor the line to a date? Right now, the indicator keeps plotting the line each day based on the input time, but I dont want it to start over each day, I want it to be anchored to the time as well as the date I enter. Can this be done?





#vertical line at a specific time

input startdate = 20220101;
Input time = 1200;
def starttime = secondsFromTime(time)==0;
def ext = if starttime then open else ext[1];
plot x = ext;

#AddVerticalLine(starttime, "Time = " + time , color = Color.Gray, stroke = Curve.POINTS);
#Vertical lines with the most flexibility/options

Input Percent_Range1 = .00125;

plot plotopenzoneH = X + (X *...
I got this indicator that plots a line at a specific time. Can someone help me edit it (or can it be edited) to anchor the line to a date? Right now, the indicator keeps plotting the line each day based on the input time, but I dont want it to start over each day, I want it to be anchored to the time as well as the date I enter. Can this be done?





#vertical line at a specific time

input startdate = 20220101;
Input time = 1200;
def starttime = secondsFromTime(time)==0;
def ext = if starttime then open else ext[1];
plot x = ext;

#AddVerticalLine(starttime, "Time = " + time , color = Color.Gray, stroke = Curve.POINTS);
#Vertical lines with the most flexibility/options

Input Percent_Range1 = .00125;

plot plotopenzoneH = X + (X * Percent_range1);
plot plotopenzoneL = X - (X * Percent_range1);

Input Percent_Range2 = .005;

plot plotSDhalfH = X + (X * Percent_range2);
plot plotSDhalfL = X - (X * Percent_range2);

Input Percent_Range3 = .01;

plot plotSD1H = X + (X * Percent_range3);
plot plotSD1L = X - (X * Percent_range3);

Input Percent_Range4 = .0075;

plot plotSDRH = X + (X * Percent_range4);
plot plotSDRL = X - (X * Percent_range4);

Input Percent_Range5 = .02;

plot plotSD2H = X + (X * Percent_range5);
plot plotSD2L = X - (X * Percent_range5);

Input Percent_Range6 = .015;

plot plotSD15H = X + (X * Percent_range6);
plot plotS15L = X - (X * Percent_range6);


Input Percent_Range7 = .03;

plot plotSD3H = X + (X * Percent_range7);
plot plotSD3L = X - (X * Percent_range7);


input bubblemover = 3;
def b = bubblemover;
def b1 = b + 1;


AddChartBubble(!IsNaN(close[b1]) and IsNaN(close), plotopenzoneH, "ALGO Tracking Zone ", Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close), plotopenzoneL, "ALGO Tracking Zone " , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close), plotSDhalfH, " Be smart Trader! Take some profits here " , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close), plotSDhalfL, " Be smart Trader! Take some profits here" , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close), plotSD1H, "Target#1 " , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close), plotSD1L, "Target#1 " , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close), plotSDRH, "!Reversal! ", Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close), plotSDRL, "!Reversal! " , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close), plotSD2H, "Target#2 " , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close), plotSD2L, "Target#2 " , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close), plotSD3H, "Take out STOPS here! (always look for H/L day to left!) " , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close), plotSD3L, "Take out STOPS here! (always look for H/L day to left!) " , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close), plotSD15H, "halfway " , Color.light_gray, no);


AddChartBubble(!IsNaN(close[b1]) and IsNaN(close), plotS15L, "halfway " , Color.light_gray, no);
AddLabel(yes, "I hunt ALGO", Color.gray);

This should help do what you requested. I also adjusted the bubble code to only print one label fo reach line and used \n to truncate some of the bubble information with a line return.

Screenshot 2023-11-10 141821.png
Code:
#vertical line at a specific time

input startdate = 20231001;
Input time = 1200;
def starttime = secondsFromTime(time)==0;
def ext = if starttime and getyyyYMMDD()==startdate then open else ext[1];
plot x = ext;

#AddVerticalLine(starttime, "Time = " + time , color = Color.Gray, stroke = Curve.POINTS);
#Vertical lines with the most flexibility/options

Input Percent_Range1 = .00125;

plot plotopenzoneH = X + (X * Percent_range1);
plot plotopenzoneL = X - (X * Percent_range1);

Input Percent_Range2 = .005;

plot plotSDhalfH = X + (X * Percent_range2);
plot plotSDhalfL = X - (X * Percent_range2);

Input Percent_Range3 = .01;

plot plotSD1H = X + (X * Percent_range3);
plot plotSD1L = X - (X * Percent_range3);

Input Percent_Range4 = .0075;

plot plotSDRH = X + (X * Percent_range4);
plot plotSDRL = X - (X * Percent_range4);

Input Percent_Range5 = .02;

plot plotSD2H = X + (X * Percent_range5);
plot plotSD2L = X - (X * Percent_range5);

Input Percent_Range6 = .015;

plot plotSD15H = X + (X * Percent_range6);
plot plotS15L = X - (X * Percent_range6);


Input Percent_Range7 = .03;

plot plotSD3H = X + (X * Percent_range7);
plot plotSD3L = X - (X * Percent_range7);


input bubblemover = 5;
def b = bubblemover;
def b1 = b + 1;


AddChartBubble(!IsNaN(close[b1]) and IsNaN(close[b]), plotopenzoneH, "ALGO Tracking Zone ", Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close[b]), plotopenzoneL, "ALGO Tracking Zone " , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close[b]), plotSDhalfH, " Be smart Trader! \nTake some profits here " , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close[b]), plotSDhalfL, " Be smart Trader! \nTake some profits here" , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close[b]), plotSD1H, "Target#1 " , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close[b]), plotSD1L, "Target#1 " , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close[b]), plotSDRH, "!Reversal! ", Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close[b]), plotSDRL, "!Reversal! " , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close[b]), plotSD2H, "Target#2 " , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close[b]), plotSD2L, "Target#2 " , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close[b]), plotSD3H, "Take out STOPS here! \n(always look for H/L day to left!) " , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close[b]), plotSD3L, "Take out STOPS here! \n(always look for H/L day to left!) " , Color.light_gray, no);

AddChartBubble(!IsNaN(close[b1]) and IsNaN(close[b]), plotSD15H, "halfway " , Color.light_gray, no);


AddChartBubble(!IsNaN(close[b1]) and IsNaN(close[b]), plotS15L, "halfway " , Color.light_gray, no);
AddLabel(yes, "I hunt ALGO", Color.gray);
 
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
330 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