Dark Theme
Light Theme
Trading Articles
Article Categories
Article Tools
Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to
register in order to view the content of the threads and start contributing to our community.
It's free for basic access, or support us by becoming an Elite Member -- discounts are available after registering.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Updated September 26, 2022
Top Posters
looks_one
JoeDee
with 1 posts (4 thanks)
looks_two
Carlera
with 1 posts (0 thanks)
looks_3
SunTrader
with 1 posts (3 thanks)
looks_4
eskules
with 1 posts (0 thanks)
trending_up
2,594 views
thumb_up
7 thanks given
group
5 followers
forum
2 posts
attach_file
1 attachments
September 24th, 2022, 10:16 AM
Colombia
Posts: 14 since Mar 2021
Thanks Given: 1
Thanks Received: 1
Hi, I am trying to code a indicator than show a vertical line every 30 min, Can from 09:00 hrs to 16:00 hrs, I have gratefully.
Can you help answer these questions from other members on NexusFi?
Best Threads (Most Thanked) in the last 7 days on NexusFi
September 25th, 2022, 02:48 PM
Boca Raton, FL
Posts: 264 since Nov 2018
Thanks Given: 83
Thanks Received: 184
Carlera
Hi, I am trying to code a indicator than show a vertical line every 30 min, Can from 09:00 hrs to 16:00 hrs, I have gratefully.
There is very likely a cleaner, shorter way of coding but this is what I have:-
Code
Inputs: String LineColor ("Red"), LineTime1(0900), LineTime2(0930), LineTime3(1000), LineTime4 (1030), LineTime5 (1100),
LineTime6 (1130), LineTime7 (1200), LineTime8 (1230), LineTime9 (1300), LineTime10 (1330), LineTime11 (1400), LineTime12 (1430), LineTime13 (1500), LineTime14 (1530),
LineTime15 (1600);
Using elsystem.drawingobjects;
Using elsystem.drawing;
Variables: VerticalLine VL(null);
Method void DrawVerticalLine() begin
VL = VerticalLine.Create(DTPoint.Create(BarDateTime,0));
VL.Persist = False;
DrawingObjects.Add(VL);
End;
If T >= LineTime1 and T[1] < LineTime1 then begin
DrawVerticalLine();
VL.Color = Color.FromName(LineColor);
VL.Style = StyleType.Dashed;
VL.Weight = 0;
End;
If T >= LineTime2 and T[1] < LineTime2 then begin
DrawVerticalLine();
VL.Color = Color.FromName(LineColor);
VL.Style = StyleType.Dashed;
VL.Weight = 0;
End;
If T >= LineTime3 and T[1] < LineTime3 then begin
DrawVerticalLine();
VL.Color = Color.FromName(LineColor);
VL.Style = StyleType.Dashed;
VL.Weight = 0;
End;
If T >= LineTime4 and T[1] < LineTime4 then begin
DrawVerticalLine();
VL.Color = Color.FromName(LineColor);
VL.Style = StyleType.Dashed;
VL.Weight = 0;
End;
If T >= LineTime5 and T[1] < LineTime5 then begin
DrawVerticalLine();
VL.Color = Color.FromName(LineColor);
VL.Style = StyleType.Dashed;
VL.Weight = 0;
End;
If T >= LineTime6 and T[1] < LineTime6 then begin
DrawVerticalLine();
VL.Color = Color.FromName(LineColor);
VL.Style = StyleType.Dashed;
VL.Weight = 0;
End;
If T >= LineTime7 and T[1] < LineTime7 then begin
DrawVerticalLine();
VL.Color = Color.FromName(LineColor);
VL.Style = StyleType.Dashed;
VL.Weight = 0;
End;
If T >= LineTime8 and T[1] < LineTime8 then begin
DrawVerticalLine();
VL.Color = Color.FromName(LineColor);
VL.Style = StyleType.Dashed;
VL.Weight = 0;
End;
If T >= LineTime9 and T[1] < LineTime9 then begin
DrawVerticalLine();
VL.Color = Color.FromName(LineColor);
VL.Style = StyleType.Dashed;
VL.Weight = 0;
End;
If T >= LineTime10 and T[1] < LineTime10 then begin
DrawVerticalLine();
VL.Color = Color.FromName(LineColor);
VL.Style = StyleType.Dashed;
VL.Weight = 0;
End;
If T >= LineTime11 and T[1] < LineTime11 then begin
DrawVerticalLine();
VL.Color = Color.FromName(LineColor);
VL.Style = StyleType.Dashed;
VL.Weight = 0;
End;
If T >= LineTime12 and T[1] < LineTime12 then begin
DrawVerticalLine();
VL.Color = Color.FromName(LineColor);
VL.Style = StyleType.Dashed;
VL.Weight = 0;
End;
If T >= LineTime13 and T[1] < LineTime13 then begin
DrawVerticalLine();
VL.Color = Color.FromName(LineColor);
VL.Style = StyleType.Dashed;
VL.Weight = 0;
End;
If T >= LineTime14 and T[1] < LineTime14 then begin
DrawVerticalLine();
VL.Color = Color.FromName(LineColor);
VL.Style = StyleType.Dashed;
VL.Weight = 0;
End;
If T >= LineTime15 and T[1] < LineTime15 then begin
DrawVerticalLine();
VL.Color = Color.FromName(LineColor);
VL.Style = StyleType.Dashed;
VL.Weight = 0;
End;
Copy code into a new EayLanguage Document window, give it a name, verify it and then remember to go into Properties ---> Scaling tab and select "Same as Underlying Data".
Notes 30 minute periods are coded as inputs so you can adjust them other time periods as well.
September 26th, 2022, 05:52 AM
London, UK
Experience: Intermediate
Platform: Multicharts
Trading: eMini Futures
Posts: 29 since Mar 2012
Thanks Given: 6
Thanks Received: 38
Carlera
Hi, I am trying to code a indicator than show a vertical line every 30 min, Can from 09:00 hrs to 16:00 hrs, I have gratefully.
I haven't fully tested this but it does draw Time Lines every 30 minutes between the desired time window - but you get the idea and should be able to tweak it as necessary.
Note:
1. It's important to set the plot's 'TYPE' to Histogram
2. You can turn it off by changing the Input, DrawTimeLines to False
3. TimePeriod can be changed to draw lines every 15, 10, 5 minutes etc.
Code
Inputs: DrawTimeLines(True);
Vars: TimePeriod(30), MinsPastHour(0), LineColor(Red),
IntraBarPersist LastTimeLine(0);
If DrawTimeLines and Time >= 900 and (Time - LastTimeLine > (TimePeriod -1)) then
begin
If Time <= 1600 then
begin
MinsPastHour = Mod(MinutesFromDateTime(DateTime), TimePeriod);
If MinsPastHour = 0 then
begin
Plot1(Close*2, "TimeLine", LineColor); // **** Set Plot 'Type' as Histogram ****
LastTimeLine = Time;
end
else
begin
Plot1(0);
end;
end
else
LastTimeLine = 0;
end;
Last Updated on September 26, 2022