Here's the rest!
//*** 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 = Chandelier_Stop ;
// Round( I_AvgEntryPrice + ( Chandelier_AvgRange * Average_Range ), 2 ) ; // tie to entry price
Acceleration_Factor = Parabolic_AF ;
end // eval market postion on prior bar
else begin
{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( Parabolic_Stop, "Parabolic", Red ) ;
Plot3( YoYo_Stop, "YoYo", Cyan ) ;
Plot4( Chandelier_Stop, "Chandelier", White ) ;
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
Plot4( Chandelier_Stop, "Chandelier", White )
else if YoYo_Stop > Parabolic_Stop then
Plot3( YoYo_Stop, "YoYo", Cyan )
else Plot2( 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
Plot4( Chandelier_Stop, "Chandelier", White )
else if YoYo_Stop < Parabolic_Stop then
Plot3( YoYo_Stop, "YoYo", Cyan )
else Plot2( 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
) ;