出错,请高手修改! [开拓者 TB]
- 咨询内容:
本帖最后由 htqh83010313 于 2015-9-1 22:03 编辑
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])
{
Sell(Lots,Open);
}
If(MarketPosition==-1 && Close[1]>AveMa[1])
{
BuyToCover(Lots,Open);
}
End
- TB技术人员:
Params
Numeric Length(35);
Numeric StdDevUp(2.0);
Numeric StdDevDn(-2.0);
Numeric Lots(1);
Vars
NumericSeries UpperBand;
NumericSeries LowerBand;
NumericSeries AveMa;
Numeric StdValue;
Bool bb;
bool cc;
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);
bb = CrossOver(Close[1],UpperBand[1]);
cc = CrossUnder(Close[1],LowerBand[1]);
If(MarketPosition!=1 && bb)
{
Buy(Lots,Open);
}
If(MarketPosition!=-1 && cc)
{
SellShort(Lots,Open);
}
If(MarketPosition==1 && Close[1]<AveMa[1])
{
Sell(Lots,Open);
}
If(MarketPosition==-1 && Close[1]>AveMa[1])
{
BuyToCover(Lots,Open);
}
End - TB客服:
本帖最后由 htqh83010313 于 2015-9-1 22:04 编辑
- 网友回复:
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,Length);
StdValue = StandardDev(Close,Length);
UpperBand=Avema+StdDevUp*StdValue;
LowerBand=Avema-StdDevUp*StdValue;
PlotNumeric("UpperBand",UpperBand[1]);
PlotNumeric("LowerBand",LowerBand[1]);
PlotNumeric("AveMa",AveMa[1]);
If(MarketPosition!=1 && Close[1] > UpperBand[1] && High > High[1])
{
Buy(Lots,Max(Open,High[1]));
}
If(MarketPosition!=-1 && Close[1] < LowerBand[1] && Low < low[1])
{
SellShort(Lots,Min(Open,Low[1]));
}
If(MarketPosition==1 && Low < AveMa[1])
{
Sell(Lots,Min(Open,AveMa[1]));
}
If(MarketPosition==-1 && High > AveMa[1])
{
BuyToCover(Lots,Max(Open,AveMa[1]));
}
End
有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友
可联系技术人员 QQ: 511411198 进行 有偿 编写!(不贵!点击查看价格!)
相关文章
-
没有相关内容