Larry Connors’ %b Strategy (Amibroker And Tradestation Code)
The strategy in plain English:
- The close must be above the 200-day average.
- The %b must be below 0.2 for the last three (consecutive) days.
- If 1 and 2 are true, buy at the close.
- Exit at the close when the %b closes above 0.8.
Click here for the original article.
Amibroker code:
percentB=( ( Close – BBandBot(C,5,2) ) / ( BBandTop(C,5,2) – BBandBot(C,5,2) ) );
Buy= Close>MA(C,200) AND percentB<0.2 AND Ref(percentB,-1)<0.2 AND Ref(percentB,-2)<0.2;
buyPrice=Close;
Sell= percentB>0.8;
sellPrice=Close ;
Tradestation code:
{
Larry Connors’ %b Strategy (Strategy 38)
The close must be above the 200-day average.
The %b must be below 0.2 for the last three (consecutive) days.
If 1 and 2 are true, buy at the close.
Exit at the close when the %b closes above 0.8.
}
Inputs:
BBandLookback(5),
BBandMultiple(2),
RegimeLookback(200),
BuyTreshold(0.2),
SellTreshold(0.8);
Vars:
percentB(0);
percentB = (Close - BollingerBand(Close, BBandLookback, -BBandMultiple)) / (BollingerBand(Close, BBandLookback, BBandMultiple) - BollingerBand(Close, BBandLookback, -BBandMultiple));
if Close > Average(Close, RegimeLookback) and percentB < BuyTreshold and percentB[1] < BuyTreshold and percentB[2] < BuyTreshold Then
Buy this bar on close;
if percentB > SellTreshold Then
Sell this bar on close;
Disclosure: We are not financial advisors. Please do your own due diligence and investment research or consult a financial professional. All articles are our opinions – they are not suggestions to buy or sell any securities.
