|
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 &&CrossOver(Close[1],LowerBand[1]))
{
SellShort(Lots,Open);
}
if{MarketPosition==1 && Close[1]<AveMa[1])
{
Sell(Lots,Open);
}
if{MarketPosition==-1 && Close[1]>AveMa[1])
{
BuyToCover(Lots,Open);
}
}
End
|
|