Sunday, September 16, 2012

[Tradestation] Aberration

If close is bigger than upper bollinger band then buy
EL if Close is less than MA
If close is lower than lower bollinger band then sell
ES if Close is bigger than MA






























Inputs: Length(35), //10~100(10)
StdDev(2.0); //1~3(0.5)
Vars: UpBand(0), DnBand(0), Ave(0);
UpBand = BollBandUp(Length,StdDev);
DnBand = BollBanddown(Length,StdDev);
Ave = Average(Close,Length);
//{ ---- Enter Long ---- }
if ( MarketPosition == 0 ) and ( Close > UpBand )
then Buy("BE", atmarket);
//{ ---- Enter Short ---- }
if ( MarketPosition == 0 ) and ( Close < DnBand )
then Sell("SE", atmarket);
//{ ---- Exit Short ---- }
if ( MarketPosition == 1 ) and ( Close < Ave )
then ExitLong("LX", onclose);
//{ ---- Exit Long ---- }
if ( MarketPosition == -1 ) and ( Close > Ave )
then ExitShort("SX", onclose);

No comments:

Post a Comment