您现在的位置:程序化交易>> 期货公式>> 金字塔等>> 金字塔知识>>正文内容

求版主给修改一下.... [金字塔]

  • 咨询内容:

    开平条件一多就通不过了,请版主帮忙搞定.再帮我加一个9点05开始执行,14点55平仓离场.谢谢!!

     

     

     

     

     


    RUNMODE:1;
    AA:=(HHV(HIGH,120)-LLV(LOW,120))/30,LINETHICK;
    Var1:=(2*CLOSE+HIGH+LOW)/4;
    转换线1:(HHV(H,100)+LLV(L,10))/2,coloraaff99,LINETHICK;
    基准线1:(HHV(L,100)+LLV(H,10))/2,colorff6dd8,LINETHICK;
    先行带1:(HHV(HIGH,100)+LLV(LOW,100))/2,colorff6dd8,LINETHICK;
    先行带1A:REF((转换线1+基准线1+先行带1)/3,1),COLORYELLOW,LINETHICK;
    先行带1B:REF((转换线1+基准线1+先行带1A)/3,3),COLORYELLOW,LINETHICK;
    转换线11:(HHV(HIGH,10)+LLV(LOW,10))/2,coloraaff99,LINETHICK;
    基准线11:(LLV(HIGH,1)+HHV(LOW,10))/2,colorff6dd8,LINETHICK;
    转换线11A:(HHV(HIGH,10)+LLV(LOW,1))/2,coloraaff99,LINETHICK;
    基准线11A:(LLV(HIGH,1)+HHV(LOW,100))/2,colorff6dd8,LINETHICK;
    先行带11A:REF((转换线1+基准线1)/2,10),COLORYELLOW,LINETHICK;
    先行带11B:REF((转换线11A+基准线11A)/2,1),color909090;


    DRAWTEXT(CROSS(转换线1,先行带11A) AND Var1>MAX(基准线11,先行带1A),LOW-AA*0.5,'▲\n▲\n▲\n▲\n▲'),COLORred,ALIGN0;
    DRAWTEXT(CROSS(转换线11,先行带1B) AND Var1>MAX(转换线11,先行带11A),LOW-AA*0.5,'▲\n▲\n▲\n▲\n▲'),COLORred,ALIGN0;

     


    转换线2:(HHV(HIGH,100)+LLV(LOW,1))/2,coloraaff99,LINETHICK;
    基准线2:(LLV(HIGH,10)+HHV(LOW,100))/2,colorff6dd8,LINETHICK;
    转换线2A:(HHV(HIGH,10)+LLV(LOW,100))/2,coloraaff99,LINETHICK;
    基准线2A:(LLV(HIGH,1)+HHV(LOW,1))/2,colorff6dd8,LINETHICK;
    先行带2A:REF((转换线2+基准线2)/2,1),COLORYELLOW,LINETHICK;
    先行带2B:REF((转换线2A+基准线2A)/2,1),color909090;
    转换线21:(HHV(HIGH,1)+LLV(LOW,10))/2,coloraaff99,LINETHICK;
    基准线21:(LLV(HIGH,10)+HHV(LOW,1))/2,colorff6dd8,LINETHICK;
    转换线21A:(HHV(HIGH,1)+LLV(LOW,10))/2,coloraaff99,LINETHICK;
    基准线21A:(LLV(HIGH,1)+HHV(LOW,1))/2,colorff6dd8,LINETHICK;

     

    DRAWTEXT(CROSS(先行带2B,转换线21) AND Var1<MIN(转换线21,转换线2),MAX(基准线2,HIGH)+AA*2,'▼\n▼\n▼\n▼\n▼'),COLORFF9966,ALIGN0;
    DRAWTEXT(CROSS(基准线21A,转换线2A) AND Var1<MIN(转换线21,转换线2),MAX(基准线2,HIGH)+AA*2,'▼\n▼\n▼\n▼\n▼'),COLORFF9966,ALIGN0;

    DRAWTEXT(CROSS(先行带2B,基准线2) AND Var1<MIN(转换线21,转换线21A),MAX(基准线2,HIGH)+AA*2,'▼\n▼\n▼\n▼\n▼'),COLORFF9966,ALIGN0;
    DRAWTEXT(CROSS(基准线2,先行带2A) AND Var1<MIN(转换线21,转换线2),MAX(基准线2,HIGH)+AA*2,'▼\n▼\n▼\n▼\n▼'),COLORFF9966,ALIGN0;

     

     

    转换线3:(HHV(HIGH,100)+LLV(LOW,10))/2,coloraaff99,LINETHICK;
    基准线3:(LLV(HIGH,1)+HHV(LOW,100))/2,colorff6dd8,LINETHICK;
    转换线3A:(HHV(HIGH,100)+LLV(LOW,10))/2,coloraaff99,LINETHICK;
    基准线3A:(LLV(HIGH,10)+HHV(LOW,100))/2,colorff6dd8,LINETHICK;
    先行带3A:REF((转换线3+基准线3)/2,10),COLORYELLOW,LINETHICK;
    先行带3B:REF((转换线3A+基准线3A)/2,10),color909090;
    转换线31:(HHV(HIGH,100)+LLV(LOW,100))/2,coloraaff99,LINETHICK;
    基准线31:(LLV(HIGH,10)+HHV(LOW,100))/2,colorff6dd8,LINETHICK;
    转换线31A:(HHV(HIGH,10)+LLV(LOW,10))/2,coloraaff99,LINETHICK;
    基准线31A:(LLV(HIGH,10)+HHV(LOW,10))/2,colorff6dd8,LINETHICK;

     

    DRAWTEXT(CROSS(先行带3B,转换线31) AND Var1<MIN(转换线31,转换线3),MAX(基准线3,HIGH)+AA*2,'▼\n▼\n▼\n▼\n▼'),COLORFF9966,ALIGN0;
    DRAWTEXT(CROSS(基准线31A,转换线3A) AND Var1<MIN(转换线31,转换线3),MAX(基准线3,HIGH)+AA*2,'▼\n▼\n▼\n▼\n▼'),COLORFF9966,ALIGN0;

    DRAWTEXT(CROSS(先行带3B,基准线3) AND Var1<MIN(转换线31,转换线31A),MAX(基准线3,HIGH)+AA*2,'▼\n▼\n▼\n▼\n▼'),COLORFF9966,ALIGN0;
    DRAWTEXT(CROSS(基准线3,先行带3A) AND Var1<MIN(转换线31,转换线3),MAX(基准线3,HIGH)+AA*2,'▼\n▼\n▼\n▼\n▼'),COLORFF9966,ALIGN0;

     

     

    转换线4:(HHV(H,100)+LLV(L,1))/2,coloraaff99,LINETHICK;
    基准线4:(HHV(L,10)+LLV(H,100))/2,colorff6dd8,LINETHICK;
    先行带4:(HHV(HIGH,100)+LLV(LOW,1000))/2,colorff6dd8,LINETHICK;
    先行带4A:REF((转换线4+基准线4+先行带4)/3,2),COLORYELLOW,LINETHICK;
    先行带4B:REF((转换线4+基准线4+先行带4A)/3,10),COLORYELLOW,LINETHICK;
    转换线41:(HHV(HIGH,1)+LLV(LOW,10))/2,coloraaff99,LINETHICK;
    基准线41:(LLV(HIGH,1)+HHV(LOW,1))/2,colorff6dd8,LINETHICK;
    转换线41A:(HHV(HIGH,1)+LLV(LOW,100))/2,coloraaff99,LINETHICK;
    基准线41A:(LLV(HIGH,10)+HHV(LOW,1))/2,colorff6dd8,LINETHICK;
    先行带41A:REF((转换线4+基准线4)/2,100),COLORYELLOW,LINETHICK;
    先行带41B:REF((转换线41A+基准线41A)/2,1),color909090;


    DRAWTEXT(CROSS(转换线4,先行带41A) AND Var1>MAX(基准线41,先行带4A),LOW-AA*0.5,'▲\n▲\n▲\n▲\n▲'),COLORred,ALIGN0;
    DRAWTEXT(CROSS(转换线41,先行带4B) AND Var1>MAX(转换线41,先行带41A),LOW-AA*0.5,'▲\n▲\n▲\n▲\n▲'),COLORred,ALIGN0;
    DRAWTEXT(CROSS(基准线41,先行带4A) AND Var1<MIN(先行带4A,转换线41),MAX(基准线4,HIGH)+AA*2,'▼\n▼\n▼\n▼\n▼'),COLORFF9966,ALIGN0;
    DRAWTEXT(CROSS(基准线4,先行带41B) AND Var1<MIN(先行带4A,基准线4),MAX(基准线4,HIGH)+AA*2,'▼\n▼\n▼\n▼\n▼'),COLORFF9966,ALIGN0;

     


    转换线5:(HHV(HIGH,10)+LLV(LOW,10))/2,coloraaff99,LINETHICK;
    基准线5:(LLV(HIGH,10)+HHV(LOW,10))/2,colorff6dd8,LINETHICK;
    转换线5A:(HHV(HIGH,100)+LLV(LOW,1))/2,coloraaff99,LINETHICK;
    基准线5A:(LLV(HIGH,100)+HHV(LOW,1))/2,colorff6dd8,LINETHICK;
    先行带5A:REF((转换线5+基准线5)/2,1),COLORYELLOW,LINETHICK;
    先行带5B:REF((转换线5A+基准线5A)/2,1),color909090;

    转换线51:(HHV(HIGH,100)+LLV(LOW,10))/2,coloraaff99,LINETHICK;
    基准线51:(LLV(HIGH,100)+HHV(LOW,1))/2,colorff6dd8,LINETHICK;
    转换线51A:(HHV(HIGH,100)+LLV(LOW,10))/2,coloraaff99,LINETHICK;
    基准线51A:(LLV(HIGH,10)+HHV(LOW,10))/2,colorff6dd8,LINETHICK;


    DRAWTEXT(CROSS(先行带5A,基准线51A) AND Var1>MAX(转换线51,基准线5),LOW-AA*0.5,'▲\n▲\n▲\n▲\n▲'),COLORred,ALIGN0;
    DRAWTEXT(CROSS(转换线51,基准线5A) AND Var1>MAX(基准线51A,先行带5B),LOW-AA*0.5,'▲\n▲\n▲\n▲\n▲'),COLORred,ALIGN0;

    DRAWTEXT(CROSS(先行带5A,基准线51) AND Var1>MAX(转换线51,基准线5),LOW-AA*0.5,'▲\n▲\n▲\n▲\n▲'),COLORred,ALIGN0;
    DRAWTEXT(CROSS(转换线51A,基准线5) AND Var1>MAX(基准线51A,先行带5B),LOW-AA*0.5,'▲\n▲\n▲\n▲\n▲'),COLORred,ALIGN0;

     

    //平空开多
    kd:=(CROSS(转换线1,先行带11A) AND Var1>MAX(基准线11,先行带1A))or (CROSS(转换线11,先行带1B) AND Var1>MAX(转换线11,先行带11A));
    if kd then begin
    sellshort(holding<0,holding,market);
    buy(holding=0,1,market);
    end
    //平多
    pd:(CROSS(先行带2B,转换线21) AND Var1<MIN(转换线21,转换线2)) or (CROSS(基准线21A,转换线2A) AND Var1<MIN(转换线21,转换线2))or (CROSS(先行带2B,基准线2) AND Var1<MIN(转换

    线21,转换线21A))or (CROSS(基准线2,先行带2A) AND Var1<MIN(转换线21,转换线2))or (CROSS(先行带3B,转换线31) AND Var1<MIN(转换线31,转换线3))or (CROSS(基准线31A,转换线3A)

    AND Var1<MIN(转换线31,转换线3))or (CROSS(先行带3B,基准线3) AND Var1<MIN(转换线31,转换线31A))or (CROSS(基准线3,先行带3A) AND Var1<MIN(转换线31,转换线3));
    sell(pd and holding>0,holding,market);
    //平空
    pk:(CROSS(转换线4,先行带41A) AND Var1>MAX(基准线41,先行带4A)) or (CROSS(转换线41,先行带4B) AND Var1>MAX(转换线41,先行带41A))or (CROSS(先行带5A,基准线51A) AND Var1>MAX(

    转换线51,基准线5))or (CROSS(转换线51,基准线5A) AND Var1>MAX(基准线51A,先行带5B))or (CROSS(先行带5A,基准线51) AND Var1>MAX(转换线51,基准线5))or (CROSS(转换线51A,基准线

    5) AND Var1>MAX(基准线51A,先行带5B));
    sellshort(pk and holding<0,holding,market);
    //平多开空
    kk:(CROSS(基准线41,先行带4A) AND Var1<MIN(先行带4A,转换线41)) or (CROSS(基准线4,先行带41B) AND Var1<MIN(先行带4A,基准线4));
    if kk then begin
    sell(holding>0,holding,market);
    buyshort(holding=0,1,market);
    end
     

     

  • 金字塔客服:

    首先,图表交易,只能是逐k线模式.第一句,一定要是runmode:0;

    然后就是你一直报错的问题,

    pd:(CROSS(先行带2B,转换线21) AND Var1<MIN(转换线21,转换线2)) or (CROSS(基准线21A,转换线2A) AND Var1<MIN(转换线21,转换线2)) or (CROSS(先行带2B,基准线2) AND Var1<MIN(转换线21,转换线21A))
    or (CROSS(基准线2,先行带2A) AND Var1<MIN(转换线21,转换线2)) or (CROSS(先行带3B,转换线31) AND Var1<MIN(转换线31,转换线3)) or (CROSS(基准线31A,转换线3A) AND Var1<MIN(转换线31,转换线3))
    or (CROSS(先行带3B,基准线3) AND Var1<MIN(转换线31,转换线31A)) or (CROSS(基准线3,先行带3A) AND Var1<MIN(转换线31,转换线3));

    //平空
    pk:(CROSS(转换线4,先行带41A) AND Var1>MAX(基准线41,先行带4A)) or (CROSS(转换线41,先行带4B) AND Var1>MAX(转换线41,先行带41A))
    or (CROSS(先行带5A,基准线51A) AND Var1>MAX(转换线51,基准线5))or
    (CROSS(转换线51,基准线5A) AND Var1>MAX(基准线51A,先行带5B))or
    (CROSS(先行带5A,基准线51) AND Var1>MAX(转换线51,基准线5))or (CROSS(转换线51A,基准线5) AND Var1>MAX(基准线51A,先行带5B));

     

    这两句里面,你不要随意的换行,换行一定要是一个整体写完整了再换行.

    比如( a and b) 这一句写完了再换行,而不是写成

    (a and

    b )

    甚至写成

    (a  an

    d b)

    这样写软件不明白

     

    最后,开仓时间限定:增加开仓条件 time>090500 and time<145500;

    收盘前平仓代码:

    if time>145500 then begin

       sell(1,0,market);

       sellshort(1,0,market);

    end

     

     

  • 用户回复: 搞定,谢谢版主的帮助..

 

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

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


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

相关文章

    没有相关内容