- Katılım
- 23 Eki 2020
- Mesajlar
- 1,826
SVE_Trends_trail
The basic trailing stop trading method formula will switch from support to resistance and visa-versa when breaking support or resistance. The percentage and ATR trailing stops allow sufficient price reaction that makes them most effective for medium term trend trading. Using lower percentages or a smaller multiplication factor for the ATR trailing stop will mostly result in too many losing trades. If we want a short term trailing stop it will have to move much closer to the price action. So, for the creation of TR&NDS we will look directly at the price movement. The most reliable reference is price support and resistance and the main item here is price turning points.Additionally I am showing you the formula to use the TR&NDS trailing stop from a start date. TR&NDS is used only for an up move. During the down move we use the ATR trailing stop method.
This is the formula:
SVE_Trends_trail
{SVE_TRENDS_Trail trailing stop function}
atrfact:=Input("ATR multiplication :",1,10,2.8);
period:=Input("ATR Period :",1,100,10);
HiLo:=If(H-L<1.5*Mov(H-L,period,S),H-L, 1.5*Mov(H-L,period,S));
Href:=If(L<=Ref(H,-1),H-Ref(C,-1),(H-Ref(C,-1))-(L-Ref(H,-1))/2);
Lref:=If(H>=Ref(L,-1),Ref(C,-1)-L,(Ref(C,-1)-L)-(Ref(L,-1)-H)/2);
diff1:=Max(HiLo,Href);
diff2:=Max(diff1,Lref);
ATRmod:=Wilders(diff2,period);
loss:=atrfact*ATRmod;
resistance:= C + loss;
support:=If(L>=Ref(L,-2) AND Ref(L,-1)>=Ref(L,-2) AND Ref(L,-3)>=Ref(L,-2) AND Ref(L,-4)>= Ref(L,-2),Ref(L,-2),
If(L>Ref(H,-1)*1.0013,Ref(H,-1)*0.9945,
If(L>PREV*1.1,PREV*1.05,
PREV)));
trends:=
If(H>PREV AND Ref(H,-1)>PREV,
Max(PREV,support),
If(H<PREV AND Ref(H,-1)<PREV,
Min(PREV,resistance),
If(H>PREV,support,resistance)));
trends
kaynak:
stocata