- 精华
- 0
- 在线时间
- 108 小时
- UID
- 192816
- 积分
- 107
- 帖子
- 61
- 阅读权限
- 30
- 注册时间
- 2014-8-24
- 最后登录
- 2017-7-11
- 精华
- 0
- UID
- 192816
- 积分
- 107
- 帖子
- 61
- 主题
- 8
- 阅读权限
- 30
- 注册时间
- 2014-8-24
- 最后登录
- 2017-7-11
|
Params
Numeric avgLength(40); // 三价均线参数
Numeric atrLength(40); // 真实波幅参数
Numeric Lots(0); // 交易手数
Numeric ExitLength(15); // 离场三价均线参数
Numeric ATRLength2(20); // ATR周期
Numeric TrailStop(2); // 追踪止损,回撤ATR的倍数
Vars
NumericSeries TyPriceMA(0); // 三价均线
NumericSeries dnBand(0); // 通道下轨
NumericSeries liquidPoint(0); // 出场条件
NumericSeries ExitLine(0); // 离场均线参数
NumericSeries HiAfterEntry;
NumericSeries LoAfterEntry;
Numeric Stopline;
BoolSeries bLongStoped(false);
BoolSeries bShortStoped(false);
NumericSeries ATRValue;
Begin
// 集合竞价和小节休息过滤
If(!CallAuctionFilter()) Return;
// 三价均线
TyPriceMA = Average((High + Low + Close)/3,avgLength);
// 通道下轨
dnBand = TyPriceMA - AvgTrueRange(atrLength);
// 出场条件
ExitLine = Average((High + Low + Close)/3, ExitLength);
ATRValue = AvgTrueRange(ATRLength2);
// 画线
PlotNumeric("TyPriceMA",TyPriceMA);
PlotNumeric("dnBand",dnBand);
PlotNumeric("ExitLine",ExitLine);
// 三价均线向下,并且价格下破通道下轨,开空单
If(MarketPosition != -1 And TyPriceMA[1] < TyPriceMA[2] And Low <= dnBand[1])
{ SellShort(Lots,Min(Open,dnBand[1]));
}
If(MarketPosition == -1 And BarsSinceEntry >= 1 And High >= ExitLine[1])
{
BuyToCover(0,Max(Open,ExitLine[1]));
bShortStoped = True;
}
End
因为入场条件还满足,所有在下轨之下,会出现这种情况,加了bshortstoped,还是不行,请大神帮忙指点下。 |
附件: 你需要登录才可以下载或查看附件。没有帐号?注册
|