Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
For Portfolio Manager Click Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

BATS ( Beta-Adjusted Stop Loss ) for Amibroker (AFL)
niladri
almost 3 years ago
Amibroker (AFL)

Rating:
5 / 5 (Votes 2)
Tags:
amibroker, stop loss

Beta is a measure of the volatility of a stock compared with an index or average. Beta Adjusted Trailing Stop (BATS) was introduced in an article for Technical Analysis of Stocks & Commodities magazine in January 1997 by Thomas Bulkowski.

Ref: http://traders.com/documentation/feedbk_docs/1997/01/Abstracts0197/0197Bulkowski.html

By using Kaufman’s technique, Bulkowski computed the average daily high-low price range for the prior month, multiply by 2, and then subtract the result from the current low price. ( details here http://thepatternsite.com/stops.html )

Note: Higher-beta stocks have larger price declines compared with lower-beta stocks and require a larger stop-loss percentage to compensate for the increased volatility. A beta of 1.50 means that a stock tends to rise or fall 50% more than the ref Index.

Screenshots

Indicator / Formula

Copy & Paste Friendly

Apply as "insert" on main chart

_SECTION_BEGIN("BATS");

// Ref: http://thepatternsite.com/stops.html & http://thepatternsite.com/stops.html
// compute the average daily high-low price range for the prior month, multiply by 2, and then subtract the result from the current low price.
  
dif=Ref(High,0)-Ref(Low,0);
dif1=Ref(High,-1)-Ref(Low,-1);
dif2=Ref(High,-2)-Ref(Low,-2);
dif3=Ref(High,-3)-Ref(Low,-3);
dif4=Ref(High,-4)-Ref(Low,-4);
dif5=Ref(High,-5)-Ref(Low,-5);
dif6=Ref(High,-6)-Ref(Low,-6);
dif7=Ref(High,-7)-Ref(Low,-7);
dif8=Ref(High,-8)-Ref(Low,-8);
dif9=Ref(High,-9)-Ref(Low,-9);
dif10=Ref(High,-10)-Ref(Low,-10);
dif11=Ref(High,-11)-Ref(Low,-11);
dif12=Ref(High,-12)-Ref(Low,-12);
dif13=Ref(High,-13)-Ref(Low,-13);
dif14=Ref(High,-14)-Ref(Low,-14);
dif15=Ref(High,-15)-Ref(Low,-15);
dif16=Ref(High,-16)-Ref(Low,-16);
dif17=Ref(High,-17)-Ref(Low,-17);
dif18=Ref(High,-18)-Ref(Low,-18);
dif19=Ref(High,-19)-Ref(Low,-19);
dif20=Ref(High,-20)-Ref(Low,-20);
dif21=Ref(High,-21)-Ref(Low,-21);
  
Sumdif=(dif+dif1+dif2+dif3+dif4+dif5+dif6+dif7+dif8+dif9+dif10+dif11+dif12+dif13+dif14+dif15+dif16+dif17+dif18+dif19+dif20+dif21)/22;
  
Sumdifml=(Sumdif*1);
Sumdifml2=(Sumdif*1.5); 
Sumdifml3=(Sumdif*2);
  
Betastops=HHV(C,22) - Sumdifml;
Betastops2=HHV(C,22) - Sumdifml2;
Betastops3=HHV(C,22) - Sumdifml3;

bsd=IIf(C>Ref(Betastops3,-1),1,IIf(C<Ref(Betastops3,-1),-1,0));
bsn=ValueWhen(bsd!=0,bsd,1);

colbs = IIf(bsn==1,colorGreen,colorRed);
  
Plot(Betastops3, "BATS", colbs,ParamStyle("Style2",styleThick,maskAll));
 
_SECTION_END();

3 comments

1. ll98

nice!

2. ARIES77

good job bro

3. ARIES77

hi nilandri, i need assistance with how the afl write for transaction frequency , plis help thanks

Leave Comment

Please login here to leave a comment.

Back