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
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
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
-
14.5 KB Views: 741
Last edited: