开拓者期货期权程序化系统交易论坛
标题:
分享一个股指程序IF_5min
[打印本页]
作者:
yebenli
时间:
2014-9-17 16:26:41
标题:
分享一个股指程序IF_5min
本帖最后由 yebenli 于 2014-9-17 16:42 编辑
一个做多模块,一个做空模块,同时运行就可以减少回撤。
[attach]30296[/attach]
Params
Numeric Lots(1);
Vars
NumericSeries length(20);
NumericSeries UpBand;
NumericSeries DnBand;
NumericSeries MidBand;
Begin
IF(MarketPosition==0)
{
Length=20;
}
IF(MarketPosition<>0)
{
Length=Min(120,length+1);
}
UpBand=Highest(High[1],Length);
DnBand=Lowest(Low[1],Length);
MidBand=(UpBand+Dnband)/2;
PlotNumeric("UpBand",UpBand);
PlotNumeric("DnBand",DnBand);
PlotNumeric("MidBand",MidBand);
if( MarketPosition==0 )
{
If ( C[1]>UpBand[1] && C[2]>UpBand[2] && H>=H[1])
{
Buy(Lots,Max(O,H[1]) );
}
}
//出场
if( MarketPosition>0 && L<=midband && BarsSinceEntry>=1 )
{
Sell(Lots,Min(O,midband));
}
Commentary("length="+Text(Length));
End
复制代码
Params
Numeric Lots(1);
Vars
NumericSeries length(20);
NumericSeries UpBand;
NumericSeries DnBand;
NumericSeries MidBand;
Begin
IF(MarketPosition==0)
{
Length=20;
}
IF(MarketPosition<>0)
{
Length=Min(120,length+1);
}
UpBand=Highest(High[1],Length);
DnBand=Lowest(Low[1],Length);
MidBand=(UpBand+Dnband)/2;
PlotNumeric("UpBand",UpBand);
PlotNumeric("DnBand",DnBand);
PlotNumeric("MidBand",MidBand);
if( MarketPosition==0 )
{
If ( C[1]<DnBand[1] && C[2]<DnBand[2] && L<=L[1])
{
SellShort(Lots,Min(O,L[1]) );
}
}
if( MarketPosition<0 && H>=midband && BarsSinceEntry>=1 )
{
BuyToCover(Lots,Max(O,midband));
}
Commentary("length="+Text(Length));
End
复制代码
作者:
zhc1234
时间:
2014-9-21 01:03:04
这个程序比较简单,但过滤效果还不错,赞一个!
欢迎光临 开拓者期货期权程序化系统交易论坛 (http://bbs.tb18.net/)
Powered by Discuz! X2