NexusFi: Find Your Edge


Home Menu

 





Minutes to seconds


Discussion in EasyLanguage Programming

Updated
    1. trending_up 1,779 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 Pitrader 
Canada
 
Posts: 12 since Feb 2011

I am hoping that someone can help me. I have some code below that places horizontal lines on the chart at a specific time with specific lengths. The indicator was originally written for me back in the day when a 1 minute chart was the smallest time compression available. Would it be possible to have this indicator adaptable so it will function on second charts? Any help would be greatly appreciated.

 
Code
// ==========================================
// 


inputs:
	DateOfLine(1180517),
	DistFromSwing_Ticks(3),
	StartBarCount_Time(700),
	ExtendLines_Right(false),
	
	Line1_Color(darkred),
	Line1_StartBarCount(-2),
	Line1_EndBarCount(8),
		
	Line2_Display(true),
	Line2_StartBarCount(8),
	Line2_EndBarCount(18),
		
	Line3_Display(true),
	Line3_StartBarCount(16),
	Line3_EndBarCount(28);
		
	 
vars: 
	X(0),
	startHiTLValue(0),
	startLoTLValue(0),
	ii(0),
	looCounter(0),
	ColorCount(0),
	PriDisplayValue(0),
	EndCount(0),
	loTLPrice(0),
	hiTLPrice(0),
	TickValue(minmove/pricescale);

arrays:
	LineSwitch[3](false),
	TLID_Main[3](-1),
	StartBarCount[3](0),
	EndBarCount[3](0),
	LineHigh[3](0),
	LineLow[3](999999);

once begin
	LineSwitch[1] = true;
	StartBarCount[1] = calctime(StartBarCount_Time, Line1_StartBarCount * barinterval);
	EndBarCount[1] = calctime(StartBarCount_Time, Line1_EndBarCount * barinterval);
	
	LineSwitch[2] = Line2_Display;
	StartBarCount[2] = calctime(StartBarCount_Time, Line2_StartBarCount * barinterval);
	EndBarCount[2] = calctime(StartBarCount_Time, Line2_EndBarCount * barinterval);
	
	LineSwitch[3] = Line3_Display;
	StartBarCount[3] = calctime(StartBarCount_Time, Line3_StartBarCount * barinterval);
	EndBarCount[3] = calctime(StartBarCount_Time, Line3_EndBarCount * barinterval);
	
	 	
	
	if Line1_Color = Darkred then ColorCount = 1 else ColorCount = 0;
	
	for X = 1 to 3 begin
		if LineSwitch[X] then
		begin 
			if ColorCount > 1 then ColorCount = 0;
			PriDisplayValue = pz_iff(ColorCount = 0, getappinfo(aiLowestDispValue), getappinfo(aiHighestDispValue));
			
			if ColorCount = 0 then
				startLoTLValue = getappinfo(aiLowestDispValue) 
			else
				startHiTLValue = getappinfo(aiHighestDispValue) ;
			
			TLID_Main[X] = tl_new(currentdate, StartBarCount[X], PriDisplayValue, currentdate, EndBarCount[X], PriDisplayValue);
			tl_setcolor(TLID_Main[X], pz_iff(ColorCount = 0, Darkblue, Darkred));
			tl_setstyle(TLID_Main[X],(2));
			TL_SetSize (TLID_Main[X],(3)); 
			tl_setextright(TLID_Main[X], ExtendLines_Right);
			
			ColorCount += 1; 
		end ;
	end;
end;

if d = DateOfLine then begin
	{for X = 1 to 11 begin
		if t >= StartBarCount[X - 1] then EndCount = X + 1;
	end;}
	for X = 1 to 3 begin
		if LineSwitch[X] then
		begin 
			if t >= StartBarCount[X] and t <= EndBarCount[X] then begin
				if h > LineHigh[X] then LineHigh[X] = h;
				if l < LineLow[X] then LineLow[X] = l;
			end ;
			
			if t < StartBarCount[X] then
			begin		
				loTLPrice = startLoTLValue ;
				hiTLPrice = startHiTLValue ;
									
				if X > 2 then 
				begin 
					ii = X - 2 ;
					looCounter = 0 ;
					
					while ii > 0 
					begin
						if LineSwitch[ii] and t >= StartBarCount[ii] then
						begin 
							loTLPrice = LineLow[ii] ;
							hiTLPrice = LineHigh[ii] ;	
						end ;
										
						ii -= 2 ;
						
						looCounter += 1 ;
						if looCounter > 10 then
							break ;
					end ; 
				
				end ;		
			end
			else
			begin 
				loTLPrice = LineLow[X] ;
				hiTLPrice = LineHigh[X] ;
			end ;
			


			if tl_getcolor(TLID_Main[X]) = Darkblue then begin
				tl_setend(TLID_Main[X], d, EndBarCount[X], loTLPrice - DistFromSwing_Ticks * TickValue);
				tl_setbegin(TLID_Main[X], d, StartBarCount[X], loTLPrice - DistFromSwing_Ticks * TickValue);
			end
			else begin
				tl_setend(TLID_Main[X], d, EndBarCount[X], hiTLPrice + DistFromSwing_Ticks * TickValue);
				tl_setbegin(TLID_Main[X], d, StartBarCount[X], hiTLPrice + DistFromSwing_Ticks * TickValue);
			end;

		end ;
	end;
end;


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Iran Update May 8: Still Reviewing MOU, Demands Reparati …
Traders Hideout
Day 96 Missiles Hit Kuwait and Bahrain: June 15 Peace at …
Prediction Markets & Event Contracts
Bookmap Global Plus Lifetime + Lifetime Addons For Sale
Platforms and Indicators
$4.5M Floods Russia Nuclear Contract in 24 Hours -- Krem …
Prediction Markets & Event Contracts
Iran Forward Curve: June 30 at 56% vs June 15 at 28% -- …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
15 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,643


Pittrader,

you will have to exchange the legacy trendlines with object oriented EasyLanguage trendline objects to be able to place trendlines either bar number or datetime based.

Regards,

ABCTG


Follow me on X Reply With Quote
Thanked by:




Last Updated on May 22, 2018


© 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