O'Reilly logo

Building Winning Trading Systems with TradeStation™ by John R. Hill, George Pruitt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

APPENDIX B

TradeStation 2000i Source Code of Select Programs

Bollinger Bandit {TradeStation 2000i Format}

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;

{Dynamic Break Out II by George Pruitt— TradeStation 2000i Format

This system is an extension of the original Dynamic Break Out system written by George
for Futures Magazine in 1996. In addition to the channel break out methodology, DBS II incorporates Bollinger Bands to determine trade entry.} Inputs: ceilingAmt(60),floorAmt(20),bolBandTrig(2.00); Vars: lookBackDays(20),todayVolatility(0),yesterDayVolatility(0),deltaVolatility(0); Vars: buyPoint(0),sellPoint(0),longLiqPoint(0),shortLiqPoint(0),upBand(0),dnBand(0); todayVolatility = StdDev(Close,30); yesterDayVolatility = StdDev(Close[1],30); {See how I offset the function call to get yesterday's value} deltaVolatility = (todayVolatility - yesterDayVolatility)/todayVolatility; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required