设为首页收藏本站

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

信号有些闪烁 [复制链接]

Rank: 3Rank: 3

精华
0
UID
12849
积分
230
帖子
109
主题
13
阅读权限
40
注册时间
2010-6-23
最后登录
2024-2-2
跳转到指定楼层
1#
发表于 2019-3-14 11:08:33 |只看该作者 |倒序浏览
有个策略,大多时候信号稳定,但偶尔会闪,哪位帮修改下什么问题?

Params   
        Numeric Nnn1(5);
        Numeric Nnn2(20);
Vars
        Numeric Lots(1.00);
        Numeric offset(1);
        Numeric i_offset;
               
        NumericSeries a1;
        NumericSeries a2;
        NumericSeries a3;
        NumericSeries a4;
               
        NumericSeries a13;               
        NumericSeries a14;
        NumericSeries a15;

        NumericSeries a17;
        NumericSeries a18;
        NumericSeries a19;
        NumericSeries a20;
        NumericSeries a21;
        NumericSeries a22;
        NumericSeries a23;
        NumericSeries a24;
        NumericSeries a25;
               
        Numeric xx_1010;
        Numeric xx_1030;
//------------------------------------------------------------------------
//------------------------------------------------------------------------
Begin

        i_offset=offset*minmove*PriceScale;
               
        a3=AverageFC(Close[1],17);
        a4=StandardDev(Close[1],17,2);
               
        a1=(a3 + (a4 * 1.88));               
        a2=(a3 - (a4 * 1.88));               
       //------------------------------------------------------------------------               
        a18=Summation(Max(Max((High - Low),Abs((High - Close[1]))),Abs((Low - Close[1]))),23);
               
        a19=(High - High[1]);
        a20=(Low[1] - Low);
               
        a21=Summation(IIF((a19 > 0) and (a19 > a20),a19,0),23);
        a22=Summation(IIF((a20 > 0) and (a20 > a19),a20,0),23);
               
        a23=((a21 * 100) / a18);
        a24=((a22 * 100) / a18);
        a25=Average(((Abs((a24 - a23)) / (a24 + a23)) * 100),12);

//------------------------------------------------------------------------
//------------------------------------------------------------------------
If(Time>0.0920 and Time<0.1515)
{

        if (Time>0.0920 AND Time<0.1510)         
        {
               
                        if ((MarketPosition == 0) and (a4 >= 1.9) and (Time <= 0.1456))         
                        {
                                if ((High[1] > a1) and (Open > (a1 - 3)) and (Open <= High[1]))         
                                {
                                        SellShort(Lots,(Open-i_offset));
                                }

                                if ((Low[1] < a2) and (Open < (a2 + 3.8)) and (a25[1]   < 42))         
                                {
                                        Buy(Lots,(Open+i_offset));
                                }

                        } // www.cxh99.com
                              
                        if ((MarketPosition == 1) and (BarsSinceEntry == 0))         
                        {
                                a14=High;a15=Low;  
                        }
                        if ((MarketPosition == 1) and (BarsSinceEntry >= 1))         
                        {
                                a14=Max(a14,High);  
                        }
                        if ((MarketPosition == -1) and (BarsSinceEntry == 0))         
                        {
                                a15=Low;  
                        }
                        if ((MarketPosition == -1) and (BarsSinceEntry >= 1))         
                        {
                                a15=Min(a15,Low);  
                        }
                              

                        if ((BarsSinceEntry >= 1) and (MarketPosition == 1))         
                        {
                                a13=(a14[1]   - EntryPrice);  
                                if ((BarsSinceEntry >= 5) and ((Close[5] - Open[5]) < 0) and ((Close[4] - Open[4]) < 0) and ((Close[3] - Open[3]) < 0) and (a13 >= 18))         
                                {
                                        Sell(Lots,(Open-i_offset));
                                }
                                if ((BarsSinceEntry > 4) and (a13 >= 29) and (Low <= (EntryPrice + 19)))         
                                {
                                        Sell(Lots,((EntryPrice + 19) - i_offset));
                                }
                        }// www.cxh99.com
  
                        if ((BarsSinceEntry >= 1) and (MarketPosition == -1))         
                        {
                                a13=(EntryPrice - a15[1]  );  
                                if ((BarsSinceEntry >= 4) and ((Close[5] - Open[5]) > 0) and ((Close[4] - Open[4]) > 0) and ((Close[3] - Open[3]) > 0) and (a13 >= 26))         
                                {
                                        BuyToCover(Lots,(Open+i_offset));
                                }
                                if ((BarsSinceEntry > 5) and (a13 >= 30) and (High >= (EntryPrice - 16)))         
                                {
                                        BuyToCover(Lots,((EntryPrice - 16)+i_offset));
                                }

                        }

        }
//------------------------------------------------------------------------
//------------------------------------------------------------------------

        xx_1010=AvgEntryPrice;
               
        if ((BarsSinceEntry >= 1) and (MarketPosition > 0) and (Low <= (AvgEntryPrice - 05)) and ((PositionProfit+(Lots * 1500)) < 0))         
        {
                xx_1030=(xx_1010 - 05);  
                Sell(Lots,(Min(Open,xx_1030) - i_offset));

                if (((a2[1]   - a2) <= 5.6) and (Time <= 0.1456))         
                {
                SellShort(Lots,(Min(Open,xx_1030) - i_offset));
                }
        }

//------------------------------------------------------------------------
        if ((BarsSinceEntry >= 1) and (MarketPosition < 0) and (High >= (AvgEntryPrice + 05)) and ((PositionProfit+(Lots * 1500)) < 0))         
        {
                xx_1030=(xx_1010 + 05);      
                BuyToCover(Lots,(Max(Open,xx_1030) + i_offset));

                if (((a1 - a1[1]  ) <= 5.6) and (Time <= 0.1456))         
                {
                Buy(Lots,(Max(Open,xx_1030) + i_offset));
                }
        }
               
//------------------------------------------------------------------------
//------------------------------------------------------------------------

        If(Time>=0.1510 and Time<0.1513  and MarketPosition>0)
        {
                Sell(Lots,(Open-i_offset));
        }

        If(Time>=0.1510 and Time<0.1513  and MarketPosition<0)
        {
                BuyToCover(Lots,(Open+i_offset));
        }               
               
}

//------------------------------------------------------------------------

End

Rank: 10Rank: 10Rank: 10

精华
3
UID
5
积分
26584
帖子
12686
主题
49
阅读权限
200
注册时间
2007-7-20
最后登录
2021-11-3
2#
发表于 2019-3-14 13:50:30 |只看该作者
先观察一下是哪部分的信号有消失呢?
可以针对性的在开平仓条件下写日志语句,进行分析排查。

使用道具 举报

Rank: 3Rank: 3

精华
0
UID
12849
积分
230
帖子
109
主题
13
阅读权限
40
注册时间
2010-6-23
最后登录
2024-2-2
3#
发表于 2019-3-15 09:52:13 |只看该作者
是不是买卖指令写得有问题,发现委托价格与运行实际价格差得几十个价

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

bottom

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

GMT+8, 2024-4-20 20:24

Powered by Discuz! X2 LicensedChrome插件扩展

© 2011-2012 交易开拓者 Inc.

回顶部