设为首页收藏本站

 找回密码
 注册
查看: 2699|回复: 0
打印 上一主题 下一主题

TB5肯特纳通道的策略,加根短周期均线离场,怎么老出场又进 [复制链接]

Rank: 2

精华
0
UID
192816
积分
107
帖子
61
主题
8
阅读权限
30
注册时间
2014-8-24
最后登录
2017-7-11
跳转到指定楼层
1#
发表于 2015-8-21 07:47:53 |只看该作者 |倒序浏览
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,还是不行,请大神帮忙指点下。
附件: 你需要登录才可以下载或查看附件。没有帐号?注册
您需要登录后才可以回帖 登录 | 注册

bottom

静态版|手机版|联系我们|交易开拓者 ( 粤ICP备07044698   

GMT+8, 2024-5-15 05:40

Powered by Discuz! X2 LicensedChrome插件扩展

© 2011-2012 交易开拓者 Inc.

回顶部