代码编译错误,帮我修改一下
2022-02-19 15:43

Params

    numeric lots(1);
    numeric save(20);
    numeric holdpoint(0.3);//震荡系数在hold之下的时候判定为震荡才开仓

Vars
  Series<Numeric> upline;
  Series<Numeric> downline;
  Series<Numeric> midline;
  Series<Numeric> upline_ ;//中间线
  Series<Numeric> downline_; //中间线
  Series <Numeric> band;
  Series<Bool> con1;
  Series<Bool> con2;
  Series<Numeric> minpoint;
  Series<Numeric> avgvlue1;
  Series<Numeric> avgvlue2;
  Series<Numeric> hold;

Events
   OnBar(ArrayRef<integer>indexs)
   {
       midline = AverageFC(close, 26);
       band = StandardDev(close, 26,2);
       upline = midline + 2*band;
       downline =midline -2*band;
       PlotNumeric("upline" ,highest(upline ,3));
       PlotNumeric("downline", lowest(downline,3));
       upline_ =Highest(upline,3);
       downline_ =lowest(downline,3);
       //过滤掉波动大的行情

   avgvlue1=AverageFC(close,30);
   avgvlue2=AverageFC(close, 60);
   hold=Abs(avgvlue1 - avgvlue2)/Close*100;

   //开仓条件判断
   con1=Close[1]<downline_ [1] And close >downline_ And Close>Open;
   con2=close[1>upline_ [1] and Close <upline_ and close <Open;

    If(MarketPosition<>1 And con1[1] And hold[1]<=holdpoint)   //避免未来函数
  {
       Buy(lots,Open);
       Commentary(“多单进场");

     }

    If(MarketPosition <> -1 And con2[1]And hold[1]<=holdpoin)       //避免未来函数
   { 
         SellShort(lots, Open);
         Commentary(“空单进场");

     }
     If(MarkolPosition ==1 and Close[1]<AvgEntyPrice-save*minpoint And BarsSinceEntry>0)
    {

          Sell(lots, Open);
           Commentary("多单止损出场");
      }
     If(MarketPosition==-1 And Close[1]>AvgEntryPrice + save*minpoint And BarsSinceEntry>0)
   {   
           BuyToCover(lots, Open);
           Commentary("空单止损出场");
      }


       If(MarketPosition==1 and high[1]>=upline)
     {
           sell(0,Open);
           Commentary("多单出现止盈");

        }
        lf(MarketPosition==-1 and lowM[1]<=downline)
       {
            BuyToCover(0,Open);
            Commentary("空单出现止盈");

           }//多单固定止盈

          
        If(MarketPosition==1 And Close[1]>AvgEntryPrice+save*minpoint*1.2 and BarsSinceEntry>0)
      {
        sell(0, Open);
        Commentary(“多单止盈出场”)
   }
  lf(MarketPosition=-1 And Close[1]<AvgEntryPrice -save*minpoint*1.2 and BarsSinceEntry>0)
 {


  BuyToCover(0,Open);
  Commentary("空单止盈出场");
  }
  If(MarketPosition==1 And hold[1]>0.4 and BarsSinceEntry>0 and close[1]<AvgEntryPrice)

   sell(lots,Open);
          Commentary"波动过大,目前亏损状态出场”);
   }
   If(MarketPosition==-1 And hold[1]>0.4 and BarsSinceEntry>0 and cose[1]>AvgEntyPrice)
 { 
        BuyToCover(lots ,Open);

       Commentary("波动过大,目前亏损状态出场”);

  }
  }

评论区
zyqh100091573

加我我QQ356247161 聊

2022-02-20 16:01
zyqh100091573

网页上代码怎么不好复制,我的还是编译错误。我的Q356247161

2022-02-20 16:00
顶部