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

测试很好,看不懂,希望改成文华 [文华财经]

  • 咨询内容:  

    测试很好,看不懂,希望改成文华

    input:inb(20,1,500,1),outb(10,1,500,1),risk(2,0,10,0.1);
    variable:times=0,i=0,n=0;
    rn:=ema(ref(tr,1),20);
    n:=valuewhen(holding=0,rn);
    rh:=ref(h,1);
    rl:=ref(l,1);
    h1:hhv(rh,inb);
    h2:hhv(rh,outb),linedot;
    l1:llv(rl,inb);
    l2:llv(rl,outb),linedot;
    lotst:asset*risk*0.01/(n*2*multiplier),linethick0;
    lots:=if(risk=0,1,lotst); //如果risk取0,表示固定开1手
    tbc:=h<>l;//判断是否停板
    partline(holding>0,enterprice-2*n);
    if barpos<inb+1 then exit;
    if holding=0 and tbc then //不是停板才可以交易
    begin
    if h>h1 then //开多
    begin
    buyp:=max(o,h1);
    buy(1,lots,limitr,buyp);
    times:=1;
    while h>enterprice+n*0.5 and times<4 do
    begin
    buyp:=max(o,enterprice+n*0.5);
    buy(1,lots,limitr,buyp);
    times:=times+1;
    end;//连续开仓
    end;//开多结束
    else if l<l1 then //开空
    begin
    sellp:=min(o,l1);
    buyshort(1,lots,limitr,sellp);
    times:=1;
    while l<enterprice-n*0.5 and times<4 do
    begin
    sellp:=min(o,enterprice-n*0.5);
    buyshort(1,lots,limitr,sellp);
    times:=times+1;
    end;//连续开仓
    end;
    end;//holding=0

    if holding>0 and tbc then //已有多仓
    begin
    exitlongp:=max(enterprice-2*n,l2);
    if l<exitlongp and enterbars<>0 then //出场
    begin
    exitp:=min(o,exitlongp);
    sell(1,0,limitr,exitp);
    times:=0;
    end;//出场
    else
    begin
    while h>enterprice+n*0.5 and times<4 do //开多
    begin
    buyp:=max(o,enterprice+n*0.5);
    buy(1,lots,limitr,buyp);
    times:=times+1;
    end;//连续开仓
    end;//else


    end;//holding>0

    if holding<0 and tbc then //已有空仓
    begin
    exitlongp:=min(enterprice+2*n,h2);
    if h>exitlongp and enterbars<>0 then //出场
    begin
    exitp:=max(o,exitlongp);
    sellshort(1,0,limitr,exitp);
    times:=0;
    end;//出场
    else
    begin
    while l<enterprice-n*0.5 and times<4 do //开多
    begin
    sellp:=min(o,enterprice-n*0.5);
    buyshort(1,lots,limitr,sellp);
    times:=times+1;
    end;//连续开仓
    end;//else
    end;//holding<0

     

     

     来源:程序化99

  • 文华技术人员:

    VARIABLE:TIMES1:=0,I:=0,N:=0;
    INB:=20;
    OUTB:=10;
    RISK:=2;
    TR:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
    RN:=EMA(REF(TR,1),20);
    N:=VALUEWHEN(BKVOL+SKVOL=0,RN);
    RH:=REF(H,1);
    RL:=REF(L,1);
    H1:HHV(RH,INB);
    H2:HHV(RH,OUTB),DOT;
    L1:LLV(RL,INB);
    L2:LLV(RL,OUTB),DOT;
    LOTST:MONEYTOT*RISK*0.01/(N*2*UNIT),NODRAW;
    LOTS:=IF(RISK=0,1,LOTST); //如果RISK取0,表示固定开1手
    TBC:=H<>L;//判断是否停板
    PARTLINE(BKVOL>0,BKPRICE-2*N,COLORRED);

    IF  TBC THEN //不是停板才可以交易
    BEGIN
    IF H>H1 THEN //开多
    BEGIN
    BUYP:=MAX(O,H1);
    //BUY(1,LOTS,LIMITR,BUYP);
    BKVOL=0,BK(1);

    TIMES1:=1;
    IF H>BKPRICE+N*0.5 AND TIMES1<4 THEN
    BEGIN
    BUYP:=MAX(O,BKPRICE+N*0.5);
    BKVOL>0,BK(1);
    TIMES1:=TIMES1+1;
    END//连续开仓
    END//开多结束
    IF L<L1 THEN //开空
    BEGIN
    SELLP:=MIN(O,L1);
    SKVOL=0,SK(1);
    TIMES1:=1;
    IF L<SKPRICE-N*0.5 AND TIMES1<4 THEN
    BEGIN
    SELLP:=MIN(O,SKPRICE-N*0.5);
    SKVOL>0,SK(1);
    TIMES1:=TIMES1+1;
    END//连续开仓
    END
    END//HOLDING=0

    IF BKVOL>0 AND TBC THEN //已有多仓
    BEGIN
    EXITLONGP:=MAX(BKPRICE-2*N,L2);
    IF L<EXITLONGP  THEN //出场
    BEGIN
    EXITP:=MIN(O,EXITLONGP);
    1,SP(BKVOL);
    TIMES1:=0;
    END//出场
    END//HOLDING>0

    IF SKVOL>0 AND TBC THEN //已有空仓
    BEGIN
    EXITLONGP:=MIN(SKPRICE+2*N,H2);
    IF H>EXITLONGP THEN //出场
    BEGIN
    EXITP:=MAX(O,EXITLONGP);
    1,BP(SKVOL);
    TIMES1:=0;
    END//出场
    END//HOLDING<0

     

     来源: WWW.CXH99.COM

  • 文华客服:  老师能改6用的吗?用图标提示开仓平仓

     

  • 网友回复:

    这是程序化模型,请在WH8使用  http://cxh.wenhua.com.cn/index.asp

     

    WH6是看盘软件不支持的

 

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

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


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

相关文章

    没有相关内容