设为首页收藏本站

 找回密码
 注册
查看: 1179|回复: 3

请哪位大神给看一下问题出在哪里? [复制链接]

Rank: 1

精华
0
UID
243364
积分
16
帖子
8
主题
4
阅读权限
10
注册时间
2016-11-19
最后登录
2021-8-31
发表于 2021-8-8 09:52:58 |显示全部楼层
加载后刚开始一切正常,随着不断切换周期逐渐开始死机。



Params
    Numeric FastLength(5);                        //短周期参数
    Numeric N(2);                                 //止赢跳数
        Numeric L(1);                                 //止损跳数
Vars
    Numeric       MinPoint;                       //最小变动单位
        NumericSeries AvgValue;                       //移动平均
        NumericSeries myEntryPrice;                   //开仓价格
    NumericSeries myLastPrice;                    //我的最新价
        Numeric       i;                              //循环参数

Begin
   
    If(!CallAuctionFilter()) Return;              //集合竞价过滤
        MinPoint = MinMove*PriceScale;
        AvgValue = AverageFC(Close,FastLength);
        If(BarStatus == 2&&High >= AvgValue[1])
       
   {  For i = 0 to 1;
          Buy(1,High);
          myEntryPrice = High;
          myLastPrice = myEntryPrice + N*MinPoint;
          i = i+1;
          SetGlobalVar(0,myLastPrice);
          myLastPrice = GetGlobalVar(0);
          If(MarketPosition == 1)
         {If( Close >= myLastPrice or Close <= myEntryPrice - L*MinPoint);
          {
           Sell(1,Close);
           }
          }
    }
        While (BarStatus == 2 && High >= myLastPrice + MinPoint)
        {   If(MarketPosition == 0 && Close >= myLastPrice)
      { Buy(1, Close);         
                myEntryPrice = Close;
                myLastPrice = myEntryPrice + N*MinPoint;
                SetGlobalVar(0, myLastPrice);
           }
                If(Close >= myLastPrice or Close <= myEntryPrice - L*MinPoint);
           {
            Sell(1,Close);
           }
        }
       
        If(BarStatus == 2 && Low <= AvgValue[1]-3*MinPoint)
   {  For i = 0 to 1;
          SellShort(1,Low);
          myEntryPrice = Low;
          myLastPrice = myEntryPrice - N*MinPoint;
          i = i+1;
          SetGlobalVar(1,myLastPrice);
          myLastPrice = GetGlobalVar(1);
          If(MarketPosition == -1)
         {If( Close <= myLastPrice or Close >= myEntryPrice + L*MinPoint);
          {
           BuyToCover(1,Close);
           }
          }
    }
        While (BarStatus == 2 && Low <= myLastPrice - MinPoint)
        {   If(MarketPosition == 0 && Close <= myLastPrice)
      { SellShort(1, Close);         
                myEntryPrice = Close;
                myLastPrice = myEntryPrice - N*MinPoint;
                SetGlobalVar(1, myLastPrice);
           }
                If(Close <= myLastPrice or Close >= myEntryPrice + L*MinPoint);
           {
            BuyToCover(1,Close);
           }
        }
       
        End
          

Rank: 4

精华
0
UID
110114
积分
380
帖子
314
主题
16
阅读权限
50
注册时间
2012-4-20
最后登录
2021-12-29
发表于 2021-8-9 08:33:31 |显示全部楼层
While语句中没有退出机制,容易造成死循环,建议换成If条件句。

使用道具 举报

Rank: 1

精华
0
UID
243364
积分
16
帖子
8
主题
4
阅读权限
10
注册时间
2016-11-19
最后登录
2021-8-31
发表于 2021-8-31 17:33:27 |显示全部楼层
本帖最后由 kingwayzxmoni 于 2021-8-31 17:53 编辑

咱们这里多久回复?

使用道具 举报

Rank: 4

精华
0
UID
110114
积分
380
帖子
314
主题
16
阅读权限
50
注册时间
2012-4-20
最后登录
2021-12-29
发表于 2021-9-1 07:55:02 |显示全部楼层
两年前还有管理员回复,现在就说不好了

使用道具 举报

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

bottom

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

GMT+8, 2024-4-18 22:47

Powered by Discuz! X2 LicensedChrome插件扩展

© 2011-2012 交易开拓者 Inc.

回顶部