Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

pitrader

Second Charts

Recommended Posts

I have an indicator that works fine on minute charts but will not work on second charts. I have the code below. Is there some way that I can get it to work on second charts?

 

inputs: 
DateOfLine(currentdate), 
DistFromSwing_Ticks(15), 
StartBarCount_Time(836), 
ExtendLines_Right(false), 

Line1_Color(blue), 
Line1_StartBarCount(4), 
Line1_EndBarCount(13), 

Line2_Display(true), 
Line2_StartBarCount(8), 
Line2_EndBarCount(19), 

Line3_Display(true), 
Line3_StartBarCount(15), 
Line3_EndBarCount(25); 



vars:  
X(0), 
ColorCount(0), 
PriDisplayValue(0), 
EndCount(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 = red then ColorCount = 1 else ColorCount = 0; 
for X = 1 to 3 begin 
	if ColorCount > 1 then ColorCount = 0; 
	PriDisplayValue = pz_iff(ColorCount = 0, getappinfo(aiLowestDispValue), getappinfo(aiHighestDispValue)); 

	TLID_Main[X] = tl_new(currentdate, StartBarCount[X], PriDisplayValue, currentdate, EndBarCount[X], PriDisplayValue); 
	tl_setcolor(TLID_Main[X], pz_iff(ColorCount = 0, blue, red)); 
	tl_setextright(TLID_Main[X], ExtendLines_Right); 

	ColorCount += 1;  
end; 
end; 

if d = DateOfLine then begin 
for X = 1 to 2 begin 
	if t >= StartBarCount[X - 1] then EndCount = X + 1; 
end; 
for X = 1 to EndCount 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 LineSwitch[X] then begin 
		if tl_getcolor(TLID_Main[X]) = blue then begin 
			tl_setend(TLID_Main[X], d, EndBarCount[X], LineLow[X] - DistFromSwing_Ticks * TickValue); 
			tl_setbegin(TLID_Main[X], d, StartBarCount[X], LineLow[X] - DistFromSwing_Ticks * TickValue); 
		end 
		else begin 
			tl_setend(TLID_Main[X], d, EndBarCount[X], LineHigh[X] + DistFromSwing_Ticks * TickValue); 
			tl_setbegin(TLID_Main[X], d, StartBarCount[X], LineHigh[X] + DistFromSwing_Ticks * TickValue); 
		end; 
	end; 
end; 
end; 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.