您现在的位置:程序化交易>> 期货公式>> 交易开拓者(TB)>> 开拓者知识>>正文内容

是否偷价? [开拓者 TB]

  • 咨询内容: 你好!下面的代码实盘的时候有问题吗?存在偷价吗?

    if (  MarketPosition==0 and  c[1]>uprange and Time>0.0900000 and time<0.143000  and h>Highest(h[1],5) and c[2]>uprange and c[3]>uprange  )
    {
    Buy(lots,Max(open,Highest(h[1],5))+minpoint);
    }

    在描述哪里出现 警告语句:FOR,WHILE,IF,ELSE中包含序列函数,可能存在潜在的逻辑错误。请确认代码无误。这样的提示

     

  • TB技术人员: uprange是一个变量还是一个固定的参数?
    使用一个中间变量将Highest(h[1],5)来进行赋值 后,将该变量来替换原文中使用了Highest(h[1],5)的地方

     

  • TB客服:
    小米 发表于 2016-5-4 09:06
    uprange是一个变量还是一个固定的参数?
    使用一个中间变量将Highest(h[1],5)来进行赋值 后,将该变量来替换 ...

    是一个变量,但回溯了!这个没有问题。我按照你下面的来做了,就是测试出来的曲线差很远,所以想问问这是什么原因?

     

  • 网友回复:
    zsqh0250000777 发表于 2016-5-4 09:51
    是一个变量,但回溯了!这个没有问题。我按照你下面的来做了,就是测试出来的曲线差很远,所以想问问这是 ...

    代码贴 一下啊。。
    我不知道您是怎么写的,没法回答呢。

     

  • 网友回复:
    小米 发表于 2016-5-4 09:53
    代码贴 一下啊。。
    我不知道您是怎么写的,没法回答呢。

    Params
    Numeric lots(1);
    Numeric k(0.27);
           
    Numeric stoploss(100);
    Numeric stopwin(200);

    Vars
    NumericSeries  tenclose;
    NumericSeries ma12;
    NumericSeries kd;
    NumericSeries kk;
    NumericSeries uprange;
    NumericSeries downrange;
    Numeric minpoint;


           


    Begin

    minpoint=MinMove*PriceScale;

    if(time==0.100000 or time==0.110000 or time==0.143000 or time==0.150000  )
    {
    tenclose=close[1];
    }Else if (time<>0.100000 or Time<>0.110000 or Time<>0.143000)
    {
    tenclose=tenclose[1];
    }

    ma12=Average(c[1],12);


    //盘整

    uprange=tenclose+k*abs(CloseD(1)-openD(1));
    downrange=tenclose-k*abs(CloseD(1)-openD(1));
    kd=Highest(h[1],5);
    kk=lowest(l[1],5);

    PlotNumeric("up",uprange);
    PlotNumeric("down",downrange);


    if (  MarketPosition==0 and  c[1]>uprange and Time>0.0900000 and time<0.143000  and h>Highest(h[1],5) and c[2]>uprange and c[3]>uprange  )
    {
    Buy(lots,Max(open,Highest(h[1],5))+minpoint);
    }

    if (  MarketPosition==0 and c[1]<downrange and time>0.090000 and time<0.143000 and l<lowest(l[1],5) and c[2]<downrange and c[3]<downrange  )
    {
    SellShort(lots,Min(open,lowest(l[1],5))-minpoint);
    }

    if ( h[1]<downrange and h[1]<ma12 and BarsSinceEntry>5)
    {
      Sell(lots,open-minpoint);
    }
           
    if (l[1]>uprange and l[1]>ma12 and BarsSinceEntry>5)
    {
    BuyToCover(lots,open+minpoint);
    }

      

    if (c[1]-EntryPrice>stoploss and MarketPosition<0)
    {
    BuyToCover(lots,open+minpoint);
    }

    if (EntryPrice-c[1]>stoploss and MarketPosition>0)
    {
    sell(lots,open-minpoint);
    }


    if (c[1]-EntryPrice>stopwin and MarketPosition>0)
    {
    sell(lots,open-minpoint);

    }

    if (EntryPrice-c[1]>stopwin and MarketPosition<0)
    {
    BuyToCover(lots,open+minpoint);
    }

    if (c[1]-EntryPrice>100 and MarketPosition>0 and BarsSinceEntry<5 )
    {
    sell(lots,open-minpoint);

    }

    if (EntryPrice-c[1]>100 and MarketPosition<0 and BarsSinceEntry>5)
    {
    BuyToCover(lots,open+minpoint);
    }


    if (time>=0.145500 and MarketPosition<>0 )
    {
    sell(lots,open-minpoint);
    BuyToCover(lots,open+minpoint);

    }

    end

 

有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友

可联系技术人员 QQ: 511411198  点击这里给我发消息进行 有偿 编写!不贵!点击查看价格!


【字体: 】【打印文章】【查看评论

相关文章

    没有相关内容