Pivot Points on Tradestation

Does anyone have a Pivot Point indicator for Tradestation. IE R1, R2, R3, S1, S2, S3?

I figure its worth a shot that someone might want to share the wealth!

TPA
 
It will work for anything that has a high, low and close.
If you search there are many other pivot indicators around, I just recommended that one as it uses settlement price rather than last for the close.
 
Code:
{ ** Copyright (c) 2007 ABC TRADING GROUP All rights reserved. ** [url]www.abctradinggroup.com[/url]
This study may be shared freely, as long as the copyright notice is included.}

Inputs:
	StartCalcTime		(0000),
	EndCalcTime		(2359),
	PlaceTextRight  	(true),
	PlotatDateChange	(true),
	PlotToDateEnd		(true),
	IgnoreWeekends	(true),
	TLSize		(1),
	TLStyle		(1),
	PivColor	(yellow),
	R1Color		(red),
	R2Color		(red),
	R3Color		(red),	
	S1Color		(green),
	S2Color		(green),
	S3Color		(green);
		
Variables:
	Monday2Friday		(false),
	RR1			(0),
	RR2			(0),
	RR3			(0),
	SS1			(0),
	SS2			(0),
	SS3			(0),
	PP			(0),
	RR1TL			(0),
	RR2TL			(0),
	RR3TL			(0),
	SS1TL			(0),
	SS2TL			(0),
	SS3TL			(0),
	PPTL			(0),
	DayHi			(-999999),
	DayLo			(+999999),
	HaveTLs 		(false),
	StartTime		(0),
	EndTime 		(0),
	R1Txt			(0),
	R2Txt			(0),
	R3Txt			(0),
	S1Txt			(0),
	S2Txt			(0),
	S3Txt			(0),
	PPTxt			(0),
	SessClose		(0),
	TextStyleHoriz	(1), 	//0: To the right of the bar specified for the text object
 					//1: To the left of the bar specified for the text object
 					//2: Centered on the bar specified for the text object
	TextStyleVert	(2);	//0: Beneath the price specified for the text object
					//1: Above the price specified for the text object
					//2: Centered on the specified price location of the text object
	
If IgnoreWeekends then begin
	If DayOfWeek(Date) >= Monday and DayOfWeek(Date) <= Friday then 
		Monday2Friday = true
	else 
		Monday2Friday = false;

end
else begin
	Monday2Friday = true;
end;

{	?		}
If Monday2Friday then begin

	If Date <> Date[1] then begin
		If PlaceTextRight then 
			TextStyleVert = 1;
			
		If PlotatDateChange then
			StartTime = Time
		else
			StartTime = StartCalcTime;
		
		EndTime = Time[1];		
		
		PP = (DayHi + DayLo + SessClose[1])/3 ;
		RR1 = PP * 2 - DayLo;
		RR2 = PP + DayHi - DayLo;
		RR3 = RR2 + DayHi - DayLo;
		SS1 = PP * 2 - DayHi;
		SS2 = PP - DayHi + DayLo;
		SS3 = SS2 - DayHi + DayLo;

		DayHi = -999999;
		DayLo = +999999;
		HaveTLs = false;

	end; //If Date <> Date[1] then begin...	

	If Time > StartCalcTime and Time <= EndCalcTime then begin
		If High >= DayHi then DayHi = High;
		If Low <= DayLo then DayLo = Low;
		If BarStatus(1) = 2 then
		SessClose = Close;
	end;//If Time > StartCalcTime and Time <= EndCalcTime then begin...
	
	If HaveTLs = false then begin
		HaveTLs = true;
		
		RR1TL = TL_New(Date, StartTime, RR1, Date, EndTime, RR1);
			TL_SetColor(RR1TL, R1Color);
			TL_SetSize(RR1TL, TLSize);	
			TL_SetStyle(RR1TL, TLStyle);
					
		RR2TL = TL_New(Date, StartTime, RR2, Date, EndTime, RR2);
			TL_SetColor(RR2TL, R2Color);
			TL_SetSize(RR2TL, TLSize);	
			TL_SetStyle(RR2TL, TLStyle);
					
		RR3TL = TL_New(Date, StartTime, RR3, Date, EndTime, RR3);
			TL_SetColor(RR3TL, R3Color);
			TL_SetSize(RR3TL, TLSize);	
			TL_SetStyle(RR3TL, TLStyle);
					
		SS1TL = TL_New(Date, StartTime, SS1, Date, EndTime, SS1);
			TL_SetColor(SS1TL, S1Color);
			TL_SetSize(SS1TL, TLSize);	
			TL_SetStyle(SS1TL, TLStyle);
					
		SS2TL = TL_New(Date, StartTime, SS2, Date, EndTime, SS2);
			TL_SetColor(SS2TL, S2Color);
			TL_SetSize(SS2TL, TLSize);
			TL_SetStyle(SS2TL, TLStyle);
					
		SS3TL = TL_New(Date, StartTime, SS3, Date, EndTime, SS3);
			TL_SetColor(SS3TL, S3Color);
			TL_SetSize(SS3TL, TLSize);
			TL_SetStyle(SS3TL, TLStyle);
					
		PPTL = TL_New(Date, StartTime, PP, Date, EndTime, PP);
			TL_SetColor(PPTL, PivColor);
			TL_SetSize(PPTL, TLSize);
			TL_SetStyle(PPTL, TLStyle);
			
		R1Txt = Text_New(Date, StartTime, RR1, "R1");
			Text_SetStyle(R1Txt, TextStyleHoriz, TextStyleVert);	
			Text_SetColor(R1Txt, R1Color);
					
		R2Txt = Text_New(Date, StartTime, RR2, "R2");
			Text_SetStyle(R2Txt, TextStyleHoriz, TextStyleVert);	
			Text_SetColor(R2Txt, R2Color);
			
		R3Txt = Text_New(Date, StartTime, RR3, "R3");
			Text_SetStyle(R3Txt, TextStyleHoriz, TextStyleVert);	
			Text_SetColor(R3Txt, R3Color);
			
		S1Txt = Text_New(Date, StartTime, SS1, "S1");
			Text_SetStyle(S1Txt, TextStyleHoriz, TextStyleVert);
			Text_SetColor(S1Txt, S1Color);
						
		S2Txt = Text_New(Date, StartTime, SS2, "S2");
			Text_SetStyle(S2Txt, TextStyleHoriz, TextStyleVert);	
			Text_SetColor(S2Txt, S2Color);
			
		S3Txt = Text_New(Date, StartTime, SS3, "S3");
			Text_SetStyle(S3Txt, TextStyleHoriz, TextStyleVert);	
			Text_SetColor(S3Txt, S3Color);
								
		PPTxt = Text_New(Date, StartTime, PP, "PP");
			Text_SetStyle(PPTxt, TextStyleHoriz, TextStyleVert);							
			Text_SetColor(PPTxt, PivColor);			


	end //If HaveTLs = false then begin...
	else begin
			If PlotToDateEnd then 
				EndTime = EndTime
			else
				EndTime = EndCalcTime;
			
			TL_SetEnd(RR1TL, Date, EndTime, RR1);	
			TL_SetEnd(RR2TL, Date, EndTime, RR2);		
			TL_SetEnd(RR3TL, Date, EndTime, RR3);
			TL_SetEnd(SS1TL, Date, EndTime, SS1);
			TL_SetEnd(SS2TL, Date, EndTime, SS2);
			TL_SetEnd(SS3TL, Date, EndTime, SS3);					
			TL_SetEnd(PPTL, Date, EndTime, PP);
			
			If PlaceTextRight then begin
				Text_SetLocation(R1Txt, Date, EndTime, RR1);
				Text_SetLocation(R2Txt, Date, EndTime, RR2);		
				Text_SetLocation(R3Txt, Date, EndTime, RR3);
				Text_SetLocation(S1Txt, Date, EndTime, SS1);
				Text_SetLocation(S2Txt, Date, EndTime, SS2);
				Text_SetLocation(S3Txt, Date, EndTime, SS3);
				Text_SetLocation(PPTxt, Date, EndTime, PP);
				
			end; //If PlaceTextRight then begin...			
	end; //If HaveTLs then begin...
	
end; //If Monday2Friday then begin...

{		R1Txt = Text_New(Date, StartTime, RR1, "R1");
			Text_SetStyle(R1Txt, TextStyleHoriz, TextStyleVert);	
			Text_SetColor(R1Txt, R1Color);
					
		R2Txt = Text_New(Date, StartTime, RR2, "R2");
			Text_SetStyle(R2Txt, TextStyleHoriz, TextStyleVert);	
			Text_SetColor(R2Txt, R2Color);
			
		R3Txt = Text_New(Date, StartTime, RR3, "R3");
			Text_SetStyle(R3Txt, TextStyleHoriz, TextStyleVert);	
			Text_SetColor(R3Txt, R3Color);
			
		S1Txt = Text_New(Date, StartTime, SS1, "S1");
			Text_SetStyle(S1Txt, TextStyleHoriz, TextStyleVert);
			Text_SetColor(S1Txt, S1Color);
						
		S2Txt = Text_New(Date, StartTime, SS2, "S2");
			Text_SetStyle(S2Txt, TextStyleHoriz, TextStyleVert);	
			Text_SetColor(S2Txt, S2Color);
			
		S3Txt = Text_New(Date, StartTime, SS3, "S3");
			Text_SetStyle(S3Txt, TextStyleHoriz, TextStyleVert);	
			Text_SetColor(S3Txt, S3Color);
								
		PPTxt = Text_New(Date, StartTime, PP, "PP");
			Text_SetStyle(PPTxt, TextStyleHoriz, TextStyleVert);							
			Text_SetColor(PPTxt, PivColor);			

}
 
Back
Top