Params
Numeric Length(35);
Numeric StdDevUp(2.0);
Numeric StdDevDn(-2.0);
Numeric Lots(1);
Vars
NumericSeries UpperBand;
NumericSeries LowerBand;
NumericSeries AveMa;
Numeric StdValue;
Begin
AveMa=Average(Close[1],Length);
StdValue = StandardDev(Close[1],Length);
UpperBand=Avema+StdDevUp*StdValue;
LowerBand=Avema-StdDevUp*StdValue;
PlotNumeric("UpperBand",UpperBand);
PlotNumeric("LowerBand",LowerBand);
PlotNumeric("AveMa",AveMa);
If(MarketPosition!=1 CrossOver(Close[1],UpperBand[1]))
{
Buy(Lots,Open);
}
If(MarketPosition!=-1 CrossUnder(Close[1],LowerBand[1]))
{
SellShort(Lots,Open);
}
If(MarketPosition==1 Close[1]AveMa[1])
{
BuyToCover(Lots,Open);
}
End