input: bollingerlengths(50),liqlength(50),roccalclength(30);
var: upband(0),dnband(0),liqdays(50),roccalc(0);
upband = bollingerband(close,bollingerlengths, 1.25);
dnband = bollingerband(close,bollingerlengths, -1.25);
rocCalc = Close - Close[rocCalcLength-1];
if MarketPosition <> 1 and rocCalc > 0 then Buy("BanditBuy") tomorrow upBand stop;
if MarketPosition <>-1 and rocCalc < 0 then sell("BanditSell") tomorrow dnBand stop;
if(MarketPosition = 0) then liqDays = liqLength;
if(MarketPosition <> 0) then begin
liqDays = liqDays - 1;
liqDays = MaxList(liqDays,10);
end;
if(MarketPosition = 1 and Average(Close,liqDays) < upBand) then
exitlong("Long Liq") tomorrow Average(Close,liqDays) stop;
if(MarketPosition = -1 and Average(Close,liqDays) > dnBand) then
exitshort("Short Liq") tomorrow Average(Close,liqDays) stop;
此交易系统引自"build wining trade system with tradestation"一书