Trailing Stoploss Indicator

#1
Hi Friends,

Here is the formula for a simple Trailing stop indicator

The formula draws a stoploss loss line which will be 7% below the highest close within a lookback period of 20 bars.

The Stoploss % and the Lookback period can be varied. When you plot the indicator you will be prompted for Look back period and Stoploss%. The defaults are set to 20 bars and 7%.

THIS IS METASTOCK FORMULA
LB:= Input("Enter lookback period",15,30,20);
PERIOD:= Input("ENTER % STOPLOSS",2,10,7);
HHV(C ,LB)-(HHV(C,LB)*(PERIOD/100))

A chart is enclosed just to give an idea how this one looks

regards,
karthik
Hi Friends,

Karthickmarar had given the above formula for Metastock. Below you can find the corresponding formulat for AmiBroker.

CORRESPONDING AMIBROKER FORMULA

lookbackPeriod = Param("Lookback period", 20, 15, 30);
stoplossPercentage = Param("Stoploss Percentage", 7, 2, 10);
Plot(HHV(C,lookbackPeriod) - HHV(C,lookbackPeriod) * (stoplossPercentage / 100), "Trailing stoploss", ParamColor( "Color", colorCycle ));

It will prompt for Period, SL % and Colour. Ofcourse default values are given for all the three. The user can change them according to their needs.

The attached amibroker screen shot will give you an idea about the whole picture.

Thanks,
Praveen.
 

Attachments

Last edited:

rvlv

Active Member
#3
hi friends

just note
a percentage based stoploss is not a good thing to use.
YOUR STOPLOSS MUST HAVE A LINK WITH WHAT PRICE IS DOING.

a stoploss must be based on price structure or price behaviour
one is volatility
the other is recent lowest low(4 periods) or recent highest high 4 periods

the best seems a combination of
percentage and technical rule

http://www.tradingonlinemarkets.com/Articles/Technical_Analysis/stop_loss_order.htm


stoploss based on volatility is price - 2*ATR(20)

rvlv
 
Last edited:

Similar threads