[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Parabolic stop help



PureBytes Links

Trading Reference Links

Hello all:

Seems when you plot this indicator on top of a strategy the plot for the
Parabolic Stop doesn't follow the properly and gets stuck. Chandelier
and YoYo seem to work though.  Not sure if the Profit Switch is being
activated also.

Any help would be appreciated.

{*******************************************************************
LeBeau Stops - Indicator created by Thomas J. Festa, CMT Copyright c
2007 
*******************************************************************

***** Set-up *****}

INPUTS: AvgRange_Length(21),
		Chandelier_AvgRange(4), 
		YoYo_AvgRange(3),
		
		Show_All_Stops(True),
		Commentary_On(False);
 
VARIABLES: 
Acceleration_Factor(0.02),
Parabolic_AF(0),
Parabolic_AF_Limit(0), 
Average_Range(0),
Market_Position(0),

Trade_High(0),
Trade_Low(0),
YoYo_Amount(0),
YoYo_Price(0), { pin price to last bar close }
Chandelier_Stop(0),
YoYo_Stop(0),	 

Parabolic_Stop(0),
Profit_AvgRange(0),					{ ??? unsure how
to define this variable ???}
PT_Average_Range(0),
PT_Range_Length(21),
Profit_Amount(0),

Profit_Switch_Fac(1),				{ ??? }

EntryBar_Stop(0),
Profit_Switch(False),				{ ??? }			
Avg_Entry_Price(0),
New_Entry(False);

{***** Compute Stops *****}
Market_Position = I_MarketPosition ;	{ ??? in order to access
historical bar market positions ???}
If BarStatus(1) = 2 then begin 			{ ??? calc only once per
bar ???}
	Average_Range = AvgTrueRange(AvgRange_Length);
 	Avg_Entry_Price = I_AvgEntryPrice;
 	New_Entry = Avg_Entry_Price[1] <> Avg_Entry_Price;
 	PT_Average_Range = AvgTrueRange( PT_Range_Length );
 	Profit_Amount = Round(Profit_AvgRange * PT_Average_Range, 2);
{ ??? Profit_AvgRange ??? }
 	YoYo_Amount = YoYo_AvgRange * Average_Range;
end; { calc once }

If Market_Position[1] <> 0 then YoYo_Price = Close[1] 
else
	YoYo_Price = Open;

If Market_Position <> 0 then begin { eval market position on current bar
}
{*** Long Position ***}
	If Market_Position = 1 then begin
		If Market_Position[1] <> 1 or { eval market position on
prior bar and reset variables }
			New_Entry then begin
			    Profit_Switch = False; { reset profit switch
}
			    Trade_High = High; { reset trade high }
			   end 
			   else { reset }
			   	If High > Trade_High then { find new
high }
			 		Trade_High = High;

{* Chandelier Stop *}
If Profit_Switch or { if switch = true }
	Trade_High >= I_AvgEntryPrice + (Profit_Amount *
Profit_Switch_Fac) then begin
		Profit_Switch = True; 
   		Chandelier_Stop = Round(Trade_High -(Chandelier_AvgRange
* Average_Range * Profit_Switch_Fac), 2); { tighten stop }
	  end
	  else { tighten Chandelier stop when profit point exceeded }
   		Chandelier_Stop = Round(Trade_High -(Chandelier_AvgRange
* Average_Range ), 2); { normal stop }
		
If Market_Position[1] = 1 and New_Entry = False and Chandelier_Stop <
Chandelier_Stop[1] then
	Chandelier_Stop = Chandelier_Stop[1]; { prevent retracement }

{* YoYo Stop *}
YoYo_Stop = Round( YoYo_Price - YoYo_Amount, 2);

{***********************************************************************
**************************************************************}
{* Parabolic Stop *}
If Market_Position[1] <> 1 or New_Entry then begin
	Parabolic_Stop = Round(I_AvgEntryPrice - (Chandelier_AvgRange *
Average_Range), 2 );		{initial setting else Chandelier_Stop }

	Acceleration_Factor = Parabolic_AF; { tie to entry price }
end
else begin { eval market postion on prior bar }
	If BarStatus(1) = 2 then begin
		If Trade_High > Trade_High[1] and
			Acceleration_Factor < Parabolic_AF_Limit then
				Acceleration_Factor =
Acceleration_Factor +  MinList(Parabolic_AF, Parabolic_AF_Limit -
Acceleration_Factor);
				Parabolic_Stop = Parabolic_Stop +
Acceleration_Factor * (Trade_High - Parabolic_Stop);
					If Parabolic_Stop > Low then {
force stop <= low of last bar }
						Parabolic_Stop = Low;
	end; { update only at end of bar }
	end; { long parabolic stop }
end { long market postion }
{***********************************************************************
**************************************************************}	

{*** Short Position ***}
	else begin { short market position }
		If Market_Position[1] <> -1 or { eval market position on
prior bar } 
		New_Entry then begin
			Profit_Switch = False; { reset profit switch }
			Trade_Low = Low; { reset trade low }
		end
		else
			If Low < Trade_Low then { find new low }
			Trade_Low = Low;
 
{* Chandelier Stop * }
If Profit_Switch or { if switch = true }
	Trade_Low <= I_AvgEntryPrice -(Profit_Amount * Profit_Switch_Fac
) then begin
		Profit_Switch = True; 
		Chandelier_Stop = Round( Trade_Low +(Chandelier_AvgRange
* Average_Range * Profit_Switch_Fac ), 2 ) ; { tighten stop }
	end { tighten Chandelier stop when profit point exceeded }
	else
		Chandelier_Stop = Round(Trade_Low +(Chandelier_AvgRange
* Average_Range), 2 ); { normal stop }
			
If Market_Position[1] = -1 and New_Entry = False and Chandelier_Stop >
Chandelier_Stop[1] then 
				Chandelier_Stop = Chandelier_Stop[1] ; {
prevent retracement }

{* YoYo Stop * }
YoYo_Stop = Round( YoYo_Price + YoYo_Amount, 2 );
 
{***********************************************************************
**************************************************************}
{* Parabolic Stop * }
If Market_Position[1] <> -1 or
	New_Entry then begin
		Parabolic_Stop = Round(I_AvgEntryPrice +
(Chandelier_AvgRange * Average_Range), 2 );
{ initial setting else Chandelier_Stop; }
		Acceleration_Factor = Parabolic_AF; {tie to entry price
}
	end
else begin { eval market postion on prior bar }
	If BarStatus(1) = 2 then begin
		Parabolic_Stop = Parabolic_Stop + Acceleration_Factor *
(Trade_Low - Parabolic_Stop);
			If Trade_Low < Trade_Low[1] and
Acceleration_Factor < Parabolic_AF_Limit then
				Acceleration_Factor =
Acceleration_Factor + MinList( Parabolic_AF, Parabolic_AF_Limit -
Acceleration_Factor);
					If Parabolic_Stop < High then
Parabolic_Stop = High;
	end;{ run once per bar }
end; { short parabolic stop }
{***********************************************************************
**************************************************************}

	end; { short market position }
end; { in position }

{***** Plots *****}
If Market_Position[1] <> 0 or Market_Position <> 0 then begin
	If Show_All_Stops then begin
		Plot2(Chandelier_Stop, "Chandelier", White);
		Plot3(YoYo_Stop, "YoYo", Cyan );
		Plot4(Parabolic_Stop, "Parabolic", Red);
	end { show all stops }
	else begin { plot only closest stop }
		If Market_Position = 1 or Market_Position[1] = 1 then
begin
			If Chandelier_Stop > YoYo_Stop and
Chandelier_Stop > Parabolic_Stop then
				Plot2(Chandelier_Stop,"Chandelier",
White )
			else
				If YoYo_Stop > Parabolic_Stop then
Plot3(YoYo_Stop, "YoYo", Cyan)
				else
					Plot4(Parabolic_Stop,
"Parabolic", Red);
		end ;
 
{ closest long stop }
If Market_Position = -1 or Market_Position[1] = -1 then begin
	If Chandelier_Stop < YoYo_Stop and Chandelier_Stop <
Parabolic_Stop then
		Plot2(Chandelier_Stop, "Chandelier", White)
	else
		If YoYo_Stop < Parabolic_Stop then Plot3(YoYo_Stop,
"YoYo", Cyan)
		else
			Plot4(Parabolic_Stop, "Parabolic", Red);
end; { closest short stop }
	end; { only closest stop }
end; { plots }

{***** Commentary *****}
If Commentary_On and AtCommentaryBar then
	Commentary((Date -(Year( Date ) * 10000 ) ):0:0, Time:5:0, " --
BarNumber = ", CurrentBar:5:0,
    NewLine,"High = ", High, 
	NewLine,"Low = ", Low, 
	NewLine,"Open = ", Open, 
 	NewLine,"Close = ", Close, 
 	NewLine,"AvgRange Length = ", AvgRange_Length:0:0, 
 	NewLine,"AvgRange =", Average_Range:0:2, 
 	NewLine,"Chandelier AvgRange Multiplier = ",
Chandelier_AvgRange:0:2, 
 	NewLine,"YoYo AvgRange Multiplier = ", YoYo_AvgRange:0:2, 
 	NewLine,"Parabolic Acceleration Factor = ", Parabolic_AF:0:3, 
 	NewLine,"Parabolic AF Limit = ", Parabolic_AF_Limit:0:2, 
 	NewLine,"Acceleration Factor = ", Acceleration_Factor:0:3,
 	NewLine,"Profit Point AvgRange Multiplier = ",
Profit_AvgRange:0:2, 
 	NewLine,"Profit Switch = ", Profit_Switch, 
 	Newline,"Market Position = ", Market_Position:0:0, 
 	NewLine,"Trade High = ", Trade_High:0:2, 
 	NewLine,"Trade Low = ", Trade_Low:0:2, 
 	NewLine,"Profit Amount = ", Profit_Amount:0:2, 
 	NewLine,"Chandelier Stop = ", Chandelier_Stop:0:2, 
 	NewLine,"YoYo Stop = ", YoYo_Stop:0:2, 
 	NewLine,"Parabolic Stop = ", Parabolic_Stop:0:2, 
 	NewLine);


========================================================================
=======================================
Regards,

Thomas J. Festa, CMT
Senior Equity / ETF Trader (Series 7, 24, 55 & 63 Registered)
Technical Market Analyst
Technical Analysis Trading Systems Developer
Hold Brothers, LLC
230 Headquarters Plaza
East Tower, 2nd Floor
Morristown, NJ  07960
Cell:   (908) 581-8880

Confidentiality Notice: The information contained in this e-mail and any
attachments may be legally privileged and confidential. If you are not
an intended recipient, you are hereby notified that any dissemination,
distribution, or copying of this e-mail is strictly prohibited. If you
have received this e-mail in error, please notify the sender and
permanently delete the e-mail and any attachments immediately. You
should not retain, copy or use this e-mail or any attachment for any
purpose, nor disclose all or any part of the contents to any other
person.