Meastock swing indicator

yasu222

Active Member
#1
SWING INDICATOR WITH EXPIRY DATE (CAN BE MODIFIED) -

Stop1:=If( PREV < L,
If(( H - 4.5*ATR(21) ) >= PREV,
( H - 4.5*ATR(21) ),
PREV),
( H - 4.5*ATR(21) ));

Stop2:=If( PREV < L,
If(( C - 3.5*ATR(21) ) >= PREV,
( C - 3.5*ATR(21) ),
PREV),
( C - 3.5*ATR(21) ));

StopLong:=If(Stop1>Stop2,Stop1,Stop2);

Stop1:=If( PREV > H,
If(( L + 4*ATR(21) ) <= PREV,
( L + 4*ATR(21) ),
PREV),
( L + 4*ATR(21) ));

Stop2:=If( PREV > H,
If(( C + 3.5*ATR(21) ) <= PREV,
( C + 3.5*ATR(21) ),
PREV),
( C + 3.5*ATR(21) ));

StopShort:=If(Stop1<Stop2,Stop1,Stop2);

If( ((Year()<=2014) OR (Year()=2014 AND Month()<=12 AND DayOfMonth()<=31)),
If((BarsSince(L<Ref(StopLong,-1))>BarsSince(H>Ref(StopShort,-1)) ),StopLong,StopShort),C);
 

rvlv

Active Member
#2
Hi
This a good formula but there are drawbacks.

1). 3.5 atr or 4.5 atr is unrealistic thing. it does'nt do well in realistic market conditions.

A calcutta based company released a ms formula by name trendz years ago.
It was using 4*atr as basis,price never hits stoploss-people liked it then soon they found it creates more losses.

Result? people stopped using it.

WHAT GOOD IS A STOPLOSS IF IT DOESNT PROTECT LOSSES FROM BECOMING BIGGER?

2) PREV function is a big pain in the a.
only experts in amibroker can code it into amibroker.
PREV is like a temporary storage area where it stores value of a function that is recent.

hope somebody would code into amibroker so that we can test it to know the truth if it works or not.
regards
 

umeshmandal

Well-Known Member
#3
SWING INDICATOR WITH EXPIRY DATE (CAN BE MODIFIED) -

Stop1:=If( PREV < L,
If(( H - 4.5*ATR(21) ) >= PREV,
( H - 4.5*ATR(21) ),
PREV),
( H - 4.5*ATR(21) ));

Stop2:=If( PREV < L,
If(( C - 3.5*ATR(21) ) >= PREV,
( C - 3.5*ATR(21) ),
PREV),
( C - 3.5*ATR(21) ));

StopLong:=If(Stop1>Stop2,Stop1,Stop2);

Stop1:=If( PREV > H,
If(( L + 4*ATR(21) ) <= PREV,
( L + 4*ATR(21) ),
PREV),
( L + 4*ATR(21) ));

Stop2:=If( PREV > H,
If(( C + 3.5*ATR(21) ) <= PREV,
( C + 3.5*ATR(21) ),
PREV),
( C + 3.5*ATR(21) ));

StopShort:=If(Stop1<Stop2,Stop1,Stop2);

If( ((Year()<=2014) OR (Year()=2014 AND Month()<=12 AND DayOfMonth()<=31)),
If((BarsSince(L<Ref(StopLong,-1))>BarsSince(H>Ref(StopShort,-1)) ),StopLong,StopShort),C);
Thanks! Just curious: Why the expiry date?
 

Similar threads