Hi
There is quite good Volatility Stop Loss based on Average True Range (ATR). It depends on ATR, some kind of multipiler.
It is written in the code for Metastock, and I am looking someone, who would like to translate 3 short codes below. I thinkt that it may be very usefull for us.
Source page
This is the basic formula switching on stop breaks:
Stop Long
Stop Short
And this Volatility Stop can also be usefull for programmers.
Source page
Thanks, for any help.
There is quite good Volatility Stop Loss based on Average True Range (ATR). It depends on ATR, some kind of multipiler.
It is written in the code for Metastock, and I am looking someone, who would like to translate 3 short codes below. I thinkt that it may be very usefull for us.
Source page
This is the basic formula switching on stop breaks:
SVE_Stop_Trail_ATR
atrper:=Input("ATR period :",1,100,5);
atrfact:=Input("ATR multiplication :",1,10,3.5);
loss:=atrfact*ATR(atrper);
trail:=
If(C>PREV AND Ref(C,-1)>PREV,
Max(PREV,C-loss),
If(C<PREV AND Ref(C,-1)<PREV,
Min(PREV,C+loss),
If(C>PREV,C-loss,C+loss)));
Trail
atrper:=Input("ATR period :",1,100,5);
atrfact:=Input("ATR multiplication :",1,10,3.5);
loss:=atrfact*ATR(atrper);
trail:=
If(C>PREV AND Ref(C,-1)>PREV,
Max(PREV,C-loss),
If(C<PREV AND Ref(C,-1)<PREV,
Min(PREV,C+loss),
If(C>PREV,C-loss,C+loss)));
Trail
SVE_StopLong_Trail_ATR_Date
{SVE_StopLong_Trail_ATR_Date - ATR trailing stop Long from date}
InpMonth:=Input("Month",1,12,1);
InpDay:=Input("Day",1,31,2);
InpYear:=Input("Year",1800,2050,2009);
InitStop:=Input("Initial Stop Price",0.1,10000,10);
atrper:=Input("ATR period :",1,100,5);
atrfact:=Input("ATR multiplication :",1,10,3.5);
loss:=atrfact*ATR(atrper);
EntryLong:= InpYear=Year() AND InpMonth=Month() AND InpDay=DayOfMonth();
EntryLock:=If(Ref(EntryLong,-1)=0 AND EntryLong=1,1,PREV);
support:=C-loss;
TrailStopLong:= If(EntryLock=0 OR EntryLong=1,InitStop,
If(support>Ref(Support,-1),Max(support,PREV),PREV));
TrailStopLong
{SVE_StopLong_Trail_ATR_Date - ATR trailing stop Long from date}
InpMonth:=Input("Month",1,12,1);
InpDay:=Input("Day",1,31,2);
InpYear:=Input("Year",1800,2050,2009);
InitStop:=Input("Initial Stop Price",0.1,10000,10);
atrper:=Input("ATR period :",1,100,5);
atrfact:=Input("ATR multiplication :",1,10,3.5);
loss:=atrfact*ATR(atrper);
EntryLong:= InpYear=Year() AND InpMonth=Month() AND InpDay=DayOfMonth();
EntryLock:=If(Ref(EntryLong,-1)=0 AND EntryLong=1,1,PREV);
support:=C-loss;
TrailStopLong:= If(EntryLock=0 OR EntryLong=1,InitStop,
If(support>Ref(Support,-1),Max(support,PREV),PREV));
TrailStopLong
Stop Short
SVE_StopShort_Trail_ATR_Date
{SVE_StopShort_Trail_ATR_Date - ATR trailing stop Short from date}
InpMonth:=Input("Month",1,12,1);
InpDay:=Input("Day",1,31,2);
InpYear:=Input("Year",1800,2050,2009);
InitStop:=Input("Initial Stop Price",0.1,10000,10);
atrper:=Input("ATR period :",1,100,5);
atrfact:=Input("ATR multiplication :",1,10,3.5);
loss:=atrfact*ATR(atrper);
EntryLong:= InpYear=Year() AND InpMonth=Month() AND InpDay=DayOfMonth();
EntryLock:=If(Ref(EntryLong,-1)=0 AND EntryLong=1,1,PREV);
support:=C+loss;
TrailStopShort:= If(EntryLock=0 OR EntryLong=1,InitStop,
If(support>Ref(Support,-1),Min(support,PREV),PREV));
TrailStopShort
{SVE_StopShort_Trail_ATR_Date - ATR trailing stop Short from date}
InpMonth:=Input("Month",1,12,1);
InpDay:=Input("Day",1,31,2);
InpYear:=Input("Year",1800,2050,2009);
InitStop:=Input("Initial Stop Price",0.1,10000,10);
atrper:=Input("ATR period :",1,100,5);
atrfact:=Input("ATR multiplication :",1,10,3.5);
loss:=atrfact*ATR(atrper);
EntryLong:= InpYear=Year() AND InpMonth=Month() AND InpDay=DayOfMonth();
EntryLock:=If(Ref(EntryLong,-1)=0 AND EntryLong=1,1,PREV);
support:=C+loss;
TrailStopShort:= If(EntryLock=0 OR EntryLong=1,InitStop,
If(support>Ref(Support,-1),Min(support,PREV),PREV));
TrailStopShort
Source page
Thanks, for any help.