您现在的位置:程序化交易>> 期货公式>> 文华财经>> 文华财经知识>>正文内容

这个指标提示有未来函数,如何找到并去除未来函数,还有我一使用就提示“两个操作数不可以为空,某个变量或函数未返回数据”什么意思,如何解决??? [文华财经]

  • 咨询内容:  

    DIF:EMA(CLOSE,8)-EMA(CLOSE,13),COLORRED,LINETHICK2;
    DEA:EMA(DIF,9),COLORWHITE,LINETHICK2;
    持仓段:=0,COLOR00CFFF;
    空仓段:=0,COLORFFCCFF;
    STICKLINE(DIF>DEA,-0.5,-0.6,10,1),COLOR00CFFF;
    STICKLINE(DIF<DEA,-0.5,-0.6,10,1),COLORFFCCFF;
    MACD:(DIF-DEA)*2,COLORSTICK;
    STICKLINE(((MACD<REF(MACD,1)) AND (MACD>0)),0,MACD,1,0),COLORLIGHTBLUE,LINETHICK2;
    STICKLINE(((MACD>REF(MACD,1)) AND (MACD<0)),0,MACD,1,0),COLORFF00FF,LINETHICK2;
    建仓:IF(DIF<0,DIF,0),COLORYELLOW,LINETHICK2;
    加仓:IF(DIF<0,0,DIF),COLORRED,LINETHICK2;
    白线破仓:IF(DIF<DEA,DIF,DEA),COLORWHITE,LINETHICK2;
    趋势强弱:IF(DIF>DEA,DEA,DEA),COLORFF937F,LINETHICK2;

    AA:=COUNT(CROSS(DIF,DEA),BARSLAST(DEA>=0));
    二次金叉:=CROSS(DIF,DEA) AND DEA<0 AND COUNT(AA=2,21)=1;
    DRAWTEXT(二次金叉,0.2,' 二次金叉'),COLORYELLOW;
    A1:=BARSLAST(REF(CROSS(DIF,DEA),1));
    底背离:=REF(CLOSE,A1+1)>CLOSE AND DIF>REF(DIF,A1+1) AND CROSS(DIF,DEA);
    STICKLINE(底背离,0,0.03,6,0),COLOR00FF00;
    底背:DRAWLINE(A1=0,DEA,底背离,DEA,0),COLORRED,LINETHICK4;
    DRAWTEXT(底背离,0.12,' 底背离'),COLORFF00FF;
    A2:=BARSLAST(REF(CROSS(DEA,DIF),1));
    顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIF,A2+1)>DIF AND CROSS(DEA,DIF);
    顶背:DRAWLINE(A2=0,DEA,顶背离,DEA,0),COLORGREEN,LINETHICK4;

     

     

  • 文华技术人员:

     上述模型中没有使用到未来函数,提示错误是因为划线函数不能定义变量,为您修改如下:

     

    DIF:EMA(CLOSE,8)-EMA(CLOSE,13),COLORRED,LINETHICK2;
    DEA:EMA(DIF,9),COLORWHITE,LINETHICK2;
    持仓段:=0,COLOR00CFFF;
    空仓段:=0,COLORFFCCFF;
    STICKLINE(DIF>DEA,-0.5,-0.6,10,1),COLOR00CFFF;
    STICKLINE(DIF<DEA,-0.5,-0.6,10,1),COLORFFCCFF;
    MACD:(DIF-DEA)*2,COLORSTICK;
    STICKLINE(((MACD<REF(MACD,1)) AND (MACD>0)),0,MACD,1,0),COLORLIGHTBLUE,LINETHICK2;
    STICKLINE(((MACD>REF(MACD,1)) AND (MACD<0)),0,MACD,1,0),COLORFF00FF,LINETHICK2;
    建仓:IF(DIF<0,DIF,0),COLORYELLOW,LINETHICK2;
    加仓:IF(DIF<0,0,DIF),COLORRED,LINETHICK2;
    白线破仓:IF(DIF<DEA,DIF,DEA),COLORWHITE,LINETHICK2;
    趋势强弱:IF(DIF>DEA,DEA,DEA),COLORFF937F,LINETHICK2;

    AA:=COUNT(CROSS(DIF,DEA),BARSLAST(DEA>=0));
    二次金叉:=CROSS(DIF,DEA) AND DEA<0 AND COUNT(AA=2,21)=1;
    DRAWTEXT(二次金叉,0.2,' 二次金叉'),COLORYELLOW;
    A1:=BARSLAST(REF(CROSS(DIF,DEA),1));
    底背离:=REF(CLOSE,A1+1)>CLOSE AND DIF>REF(DIF,A1+1) AND CROSS(DIF,DEA);
    STICKLINE(底背离,0,0.03,6,0),COLOR00FF00;
    DRAWLINE(A1=0,DEA,底背离,DEA,0),COLORRED,LINETHICK4;
    DRAWTEXT(底背离,0.12,' 底背离'),COLORFF00FF;
    A2:=BARSLAST(REF(CROSS(DEA,DIF),1));
    顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIF,A2+1)>DIF AND CROSS(DEA,DIF);
    DRAWLINE(A2=0,DEA,顶背离,DEA,0),COLORGREEN,LINETHICK4;

     

    仅供参考;

     

  • 文华客服:  非常感谢,指标可以使用了,但是以前背离会自动画线的,现在没了,能加上这个功能吗

     

  • 网友回复:

     为您修改如下

     

    DIF:EMA(CLOSE,8)-EMA(CLOSE,13),COLORRED,LINETHICK2;
    DEA:EMA(DIF,9),COLORWHITE,LINETHICK2;
    持仓段:=0,COLOR00CFFF;
    空仓段:=0,COLORFFCCFF;
    STICKLINE(DIF>DEA,-0.5,-0.6,10,1),COLOR00CFFF;
    STICKLINE(DIF<DEA,-0.5,-0.6,10,1),COLORFFCCFF;
    MACD:(DIF-DEA)*2,COLORSTICK;
    STICKLINE(((MACD<REF(MACD,1)) AND (MACD>0)),0,MACD,1,0),COLORLIGHTBLUE,LINETHICK2;
    STICKLINE(((MACD>REF(MACD,1)) AND (MACD<0)),0,MACD,1,0),COLORFF00FF,LINETHICK2;
    建仓:IF(DIF<0,DIF,0),COLORYELLOW,LINETHICK2;
    加仓:IF(DIF<0,0,DIF),COLORRED,LINETHICK2;
    白线破仓:IF(DIF<DEA,DIF,DEA),COLORWHITE,LINETHICK2;
    趋势强弱:IF(DIF>DEA,DEA,DEA),COLORFF937F,LINETHICK2;

    AA:=COUNT(CROSS(DIF,DEA),BARSLAST(DEA>=0));
    二次金叉:=CROSS(DIF,DEA) AND DEA<0 AND COUNT(AA=2,21)=1;
    DRAWTEXT(二次金叉,0.2,' 二次金叉'),COLORYELLOW;
    A1:=BARSLAST(REF(CROSS(DIF,DEA),1));
    底背离:=REF(CLOSE,A1+1)>CLOSE AND DIF>REF(DIF,A1+1) AND CROSS(DIF,DEA);
    STICKLINE(底背离,0,0.03,6,0),COLOR00FF00;
    DRAWLINE(A1=0,DEA,底背离,DEA,0),COLORRED,LINETHICK4;
    DRAWTEXT(底背离,0.12,' 底背离'),COLORFF00FF;
    A2:=BARSLAST(REF(CROSS(DEA,DIF),1));
    顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIF,A2+1)>DIF AND CROSS(DEA,DIF);
    DRAWLINE1(A2=0,DEA,顶背离,DEA,0),COLORGREEN,LINETHICK4;

     

    仅供参考;

     

  • 网友回复:

    已经麻烦2次了,有点不好意思,但是,指标有点错乱了,我本想让指标自动显示顶底背离,并划线,现在底背离不画线,顶背离无论多远都画线,麻烦您抬手改下,可以为相邻顶底背离,并划线就可以了,再次感谢

 

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

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


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

相关文章

    没有相关内容