Minutes to seconds - futures io
futures io futures trading



Minutes to seconds


Discussion in EasyLanguage Programming

Updated by ABCTG
    1. trending_up 449 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 2 replies
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 100,000 members
  • 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 and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Minutes to seconds

(login for full post details)
  #1 (permalink)
Canada
 
 
Posts: 12 since Feb 2011
Thanks: 3 given, 0 received

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 futures io?
IB Bracker Order
Platforms and Indicators
is there an easy way to obtain by code the price variation percentual
MultiCharts
TraderSync Experience?
Trading Reviews and Vendors
OPEN_CLOSE_DOTS
ThinkOrSwim
Need a near crosses scan help for TOS
ThinkOrSwim
 
 
(login for full post details)
  #3 (permalink)
Hamburg Germany
 
Experience: Advanced
Platform: Multicharts, Tradestation
Broker: DTN IQ
Trading: ES
 
Posts: 2,192 since Apr 2013
Thanks: 385 given, 1,428 received


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 Twitter Visit my Facebook Reply With Quote
The following user says Thank You to ABCTG for this post:


futures io Trading Community Platforms and Indicators EasyLanguage Programming > Minutes to seconds


May 22, 2018


Upcoming Webinars and Events
 

Dealing with burnout w/Linda Bradford Raschke

Elite only
     



Copyright © 2020 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts