全部 智大领峰 TBQuant功能 TBL语言 TB开户 问答专区 高手圈 其他
代码编译错误,帮我修改一下
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("波动过大,目前亏损状态出场”);

  }
  }

a1151299469

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]<=holdpoint)       //避免未来函数
   { 
         SellShort(lots, Open);
         Commentary("空单进场");

     }
     If(MarketPosition ==1 and Close[1]<AvgEntryPrice    -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("多单出现止盈");

        }
        if(MarketPosition==-1 and low[1]<=downline)
       {
            BuyToCover(0,Open);
            Commentary("空单出现止盈");
           }
           
           //多单固定止盈
        If(MarketPosition==1 And Close[1]>(AvgEntryPrice+save*minpoint*1.2) and BarsSinceEntry>0)
      {
        sell(0, Open);
        Commentary("多单止盈出场");
   }
    if(MarketPosition<0 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 close[1]>AvgEntryPrice)
 { 
        BuyToCover(lots,Open);

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

  }
  }

2022-02-19 20:34
zyqh100091573
@a1151299469

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

2022-02-20 16:00
a1151299469

哪里找来的程序,都是一些拼写错误,标点符号问题

2022-02-19 20:34
hn0512
2022-02-19 21:25
hn0512
@hn0512

中英文切换,单词拼写

2022-02-19 21:27
202****5173133049

这是动态突破策略。你整出来,也是低胜率低盈亏比的东东

2022-02-20 13:05
zyqh100091573
@202****5173133049

加我我QQ356247161 聊

2022-02-20 16:01
rdqh10017160
@zyqh100091573

理性交往,这个人很容易发火而且喜欢呼唤狐朋狗友上门堵人laugh

2022-02-21 09:45
rdqh10017160

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]<holdpoint)       //避免未来函数
   {
         SellShort(lots, Open);
         Commentary("空单进场");

     }
     If(MarketPosition ==1 and Close[1]<AvgEntryPrice-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("多单出现止盈");

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

           }//多单固定止盈

          
        If(MarketPosition==1 And Close[1]>AvgEntryPrice+save*minpoint*1.2 and BarsSinceEntry>0)
      {
        sell(0, Open);
        Commentary("多单止盈出场");
   }
  if(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 close[1]>AvgEntryPrice)
 {
        BuyToCover(lots ,Open);

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

 

//close写成cose

//low写成lowm

//avgentryprice写成avgentyprice

//大量符号写成全角模式

//感觉就像从哪里要来一份策略代码,自己手动输入一遍,然后错了一大堆细节

//读代码是好的学习习惯,但是也要学会自己检查编译错误,这种事基础得不能再基础的技能了

2022-02-21 09:56
您未登录,请先 登录注册 后发表评论
顶部