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 2,332 views
    2. thumb_up 7 thanks given
    3. group 5 followers
    1. forum 2 posts
    2. attach_file 1 attachments




 
Search this Thread

Vertical Line every 30 min.

(login for full post details)
  #1 (permalink)
Carlera
Colombia
 
Posts: 13 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?
Request for MACD with option to use different MAs for fa …
NinjaTrader
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
Trader Dale [email protected] or Scammer Dale
Trading Reviews and Vendors
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Tao te Trade: way of the WLD
30 thanks
GFIs1 1 DAX trade per day journal
28 thanks
Supertradersams Thread Journal on NQ/MNQ
25 thanks
Deaddogs Stock Trading
22 thanks
Leaving CFD trading and learning futures
11 thanks

(login for full post details)
  #2 (permalink)
SunTrader
Boca Raton, FL
 
Posts: 260 since Nov 2018
Thanks Given: 81
Thanks Received: 182


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
The following 3 users say Thank You to SunTrader for this post:
(login for full post details)
  #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
The following 4 users say Thank You to JoeDee for this post:





Last Updated on September 26, 2022


© 2024 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 - Privacy Policy - Downloads - Top
no new posts