NexusFi: Find Your Edge


Home Menu

 





Vertical Line every 30 min.


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one SunTrader with 1 posts (3 thanks)
    2. looks_two eskules with 1 posts (0 thanks)
    3. looks_3 JoeDee with 1 posts (4 thanks)
    4. looks_4 Carlera with 1 posts (0 thanks)
    1. trending_up 3,229 views
    2. thumb_up 7 thanks given
    3. group 5 followers
    1. forum 2 posts
    2. attach_file 1 attachments




 
Search this Thread
  #1 (permalink)
Carlera
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.


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Prop Firm Tracked Payouts Hit $115M in Q1 but Growth Fla …
Funded Trading Evaluation Firms
Tradeify 3.0 Overhauls Futures Prop Firm Model -- One-Ti …
Funded Trading Evaluation Firms
More Than Capable: Hegseths War Warning Validates $114M …
Prediction Markets & Event Contracts
Beijing Summit Closes: Xi Pledges Hormuz Help -- $1.14B …
Prediction Markets & Event Contracts
The Great Rotation -- Small Caps Crushing Tech as Sectio …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
21 thanks
2026 Jlab journal
10 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #2 (permalink)
SunTrader
Boca Raton, FL
 
Posts: 267 since Nov 2018
Thanks Given: 84
Thanks Received: 185


Carlera View Post
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.


Reply With Quote
Thanked by:
  #3 (permalink)
 JoeDee 
London, UK
 
Experience: Intermediate
Platform: Multicharts
Trading: eMini Futures
Posts: 29 since Mar 2012
Thanks Given: 6
Thanks Received: 38



Carlera View Post
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;


Reply With Quote




Last Updated on September 26, 2022


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts