Skip to main content

Stop-loss Indicator Bands for Amibroker (AFL)

kaiji over 16 years ago Amibroker (AFL)

  • Rating:
    5 / 5 (Votes 1)
  • Tags:

Simple stop-loss bands calculated by ATR periods (Variable) with highest high and lowest Low value over (variable) the preceding periods. Stop loss level for short positions deduced from highest high value periods and Stop Loss for longs fm Lowest low value periods.

AFL code by Prakash Shenoi

Screenshots

Indicator / Formula

Copy & Paste Friendly
/* Stop Loss indicator  */
/* AFL code by Prakash Shenoi */

/* Simple stop-loss bands calculated by ATR periods (Variable) with highest
high and lowest Low value 
over (variable) the preceding periods. Stop loss level for short positions
deduced from
highest high value periods and Stop Loss for longs fm Lowest low value periods.
*/

pdsshort=Param("pds short",1,10,55);
pdslong=Param("pds long",1,10,55);
Ststop=HHV(H,pdsshort)-ATR(pdsshort);
Lgstop=LLV(L,pdslong)+ ATR(pdslong);
Plot (Close,"Close",colorBlack,styleCandle);
Plot (Ststop," SL for shorts ",colorGreen,styleDots|styleNoLine);
Plot (Lgstop," SL for longs ",colorRed,styleDots|styleNoLine);

0 comments

Leave Comment

Please login here to leave a comment.