Chandelier exit

Vragen en suggesties over handelssystemen en indicatoren

Moderator: Perry

Chandelier exit

Berichtdoor Paul M » di 01 nov 2005, 9:17

Dit heb ik eens geprogrammeerd, voor een ieder die het bruikbaar vind.
Het is een exit strategie gebaseerd op de avg truerange.
Documentatie: https://www.tradestation.com/Discussion ... LeBeau.pdf
https://www.tradestation.com/Discussion ... 011&Page=1

Invoegen onder system, plots kun je als candles (automatisch dik)weergeven (Vestics kent nog geen points).

Inputs:Chandelier_Exit(true){on/off},
Set_Chandelier(true){Chandelier exit},
Set_SAR(true){Parabolic SAR exit},
Set_YoYo(false){Yo-Yo exit},
Chandelier_Fact(4){Multi ATR},
Ratchet_Incr (5){Tightning stop},
ATR_length (15),
YoYo_Fact(2){Multi ATR},
Prof_Fact_Chan(1){Profit target},
Prof_Fact_SAR(0){Profit tatget},
SAR_AF(0.02),
Initial_Risk(3){Opening Risk},
Show_All_Stops(false);

Vars: Chandelier_stop(0),YoYo_stop(0),SAR_stop(0),Stop_Loss(0);
vars: Market_Position(0),Position_High(0), Position_Low(0);
Vars: ATR(0),SAR(0),AF(0);
vars: Tg_Prof_Chandelier(0),Tg_Prof_SAR(0);

{Initialize variables}
Market_Position = MarketPosition;
ATR=AvgTrueRange(ATR_length);
SAR=round(Parabolic(SAR_AF),2);
Tg_Prof_Chandelier=Prof_Fact_Chan*ATR;
Tg_Prof_SAR=Prof_Fact_SAR*ATR;


if Chandelier_Exit then begin {on/off}



if Market_Position <> 0 then
begin

{LONG}
If Market_Position[1]<>1 and Market_Position = 1 Then Begin {Day 0}

Position_High=high;
{Opening Risk}
Chandelier_Stop =round(Entryprice-Initial_Risk*ATR,2);
YoYo_stop =round(Entryprice-Initial_Risk*ATR,2);
SAR_stop =round(Entryprice-Initial_Risk*ATR,2);
Stop_Loss =round(Entryprice-Initial_Risk*ATR,2);
end;

If Market_Position[1]=1 and Market_Position = 1 Then Begin {Day 1 .........}
if High>Position_High[1] then Position_High=High ;

if Set_Chandelier then begin

If Position_High>=Entryprice + Tg_Prof_Chandelier then {ProfitTarget}


Chandelier_stop = round(lowest(low,10) + (ATR * barssinceentry )*(Ratchet_Incr/100),2) {ATRRatchet}
else Chandelier_stop= round(Position_High-Chandelier_Fact*ATR,2); {Chandelier}

if Chandelier_Stop < Chandelier_Stop[1] then
Chandelier_Stop = Chandelier_Stop[1] ;
end;



if Set_YoYo then begin
YoYo_stop= Round(c - YoYo_Fact * ATR,2) ;{Yo-Yo}

end;

if Set_SAR then begin

If Prof_Fact_SAR <>0 then begin
SAR_stop=round(Position_High-Chandelier_Fact*ATR,2)else
if Position_High>=Entryprice + Tg_Prof_SAR then SAR_stop=SAR;
end else
SAR_stop=SAR;{SAR}
if SAR_stop < SAR_stop[1] then
SAR_stop = SAR_stop[1] ;
end;


Stop_Loss=maxlist(Chandelier_Stop,YoYo_stop,SAR_stop);
if Stop_Loss < Stop_Loss[1] then
Stop_Loss = Stop_Loss[1] ;
Exitlong next bar at Stop_Loss stop;


end {end Long}

else
{SHORT}
If Market_Position[1]<>-1 and Market_Position = -1 Then Begin {Day 0}

Position_Low=low;
{Opening Risk}
Chandelier_Stop =round(Entryprice+Initial_Risk*ATR,2);
YoYo_stop =round(Entryprice+Initial_Risk*ATR,2);
SAR_stop =round(Entryprice+Initial_Risk*ATR,2);
Stop_Loss =round(Entryprice+Initial_Risk*ATR,2);
end;

If Market_Position[1]=-1 and Market_Position = -1 Then Begin {Day 1 .........}

if low<Position_Low[1] then Position_Low=Low;


if Set_Chandelier then begin

if Position_Low<= entryprice-Tg_Prof_Chandelier then {ProfitTarget}
Chandelier_stop = round(highest(high,10) - (ATR * barssinceentry )*(Ratchet_Incr/100),2) {ATRRatchet}
else Chandelier_stop= round(Position_Low+Chandelier_Fact*ATR,2);{Chandelier}
if Chandelier_Stop > Chandelier_Stop[1] then
Chandelier_Stop = Chandelier_Stop[1] ;
end;



if Set_YoYo then begin
YoYo_stop=round(c + YoYo_Fact * ATR,2) ;{Yo-Yo}

end;

if Set_SAR then begin

If Prof_Fact_SAR <>0 then begin
SAR_stop=round(Position_Low+Chandelier_Fact*ATR,2)else
if Position_Low<= entryprice- Tg_Prof_SAR then SAR_stop=SAR;
end else
SAR_stop=SAR;{SAR}
if SAR_stop > SAR_stop[1] then
SAR_stop = SAR_stop[1] ;


end;


Stop_Loss=minlist(Chandelier_Stop,YoYo_stop,SAR_stop);
if Stop_Loss > Stop_Loss[1] then
Stop_Loss = Stop_Loss[1] ;
Exitshort next bar at Stop_Loss stop;

end;{end Short}
end; {end Position}
end; {end Chandelier_Exit}

{Plots}
if Market_Position <> 0 then
begin
if Show_All_Stops then
begin
if Set_Chandelier then Plot1(Chandelier_Stop ,"Chandelier_stop"+ " "+NumToStr(Chandelier_Fact));
if Set_YoYo then Plot2(YoYo_stop,"YoYo_stop"+ " "+NumToStr(YoYo_Fact));
if Set_SAR then Plot3(SAR_stop,"SAR_stop");
end { end show all stops}
else plot1(Stop_Loss,"Stop_Loss"); { plot only closest stop}

end ; { end plots }


Paul
Paul M
 
Berichten: 263
Geregistreerd op: vr 13 dec 2002, 23:21

Berichtdoor JanBrinker » wo 02 nov 2005, 21:51

Hallo Paul,

Dat is ook toevallig: net afgelopen weekeinde was van ik plan om, zoals ik hem ooit heb genoemd, de ATR-Ratchet stop weer eens van stal te halen. Ik heb ooit de Chandelier stop getest voor mijn lange termijn systemen (1 ? 2 trades per jaar per aandeel cq. index) en korte termijn systeem(trades die gemiddeld een dag of drie duren). Maar bij beiden heb ik uiteindelijk voor een andere exit strategie gekozen. Van het weekeinde heb ik een basis gemaakt voor de nog ontbrekende termijn: trades die de middellange termijn trend volgen. Hierbij lijkt mij dat de Chandelier-stop een goede exit strategie zou kunnen zijn. Toekomstig backtesten moet dat nog uitwijzen. Mijn vraag aan jou is: gebruik jij de Cahndelier-stop? En zo ja, in wat voor type systeem met welke instellingen voor de Chandelier_Fact, Prof_Fact_Chan en de ATR_length?

Met vriendelijke groeten,
Bertjan
JanBrinker
 
Berichten: 14
Geregistreerd op: za 09 aug 2003, 13:18


Keer terug naar Handelssystemen + Indicatoren

Wie is er online

Gebruikers op dit forum: Geen geregistreerde gebruikers en 2 gasten

cron