Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Vars: upBand(0),dnBand(0),liqDays(50);
upBand = BollingerBand(Close,50,1.25);
dnBand = BollingerBand(Close,50,-1.25);
if(MarketPosition <> 1 and ExitsToday(date) = 0) then Buy("BanditBuy")tomorrow upBand
stop;
if(MarketPosition <> -1 and ExitsToday(date) = 0) then Sell("BanditSell")tomorrow dnBand
stop;
if(MarketPosition = 0) then liqDays = 50;
if(MarketPosition <> 0) then
begin
liqDays = liqDays - 1;
liqDays = MaxList(liqDays,10);
end;
if(MarketPosition = 1 and Average(Close,liqDays) < upBand) then ExitLong("LongLiq")
tomorrow Average(Close,liqDays)stop;
if(MarketPosition = -1 and Average(Close,liqDays) > dnBand) then ExitShort("ShortLiq")
tomorrow Average(Close,liqDays)stop;