打印本文打印本文 关闭窗口关闭窗口

老师,图表怎么修改编写成后台交易的

作者:金字塔 来源:cxh99.com 发布时间:2016年01月14日
  • 咨询内容:

    老师 请帮忙改一下,图表交易的转化为后台交易的,应该修改编写

     

     


    DIFF := EMA(CLOSE,360) - EMA(CLOSE,1440);
    DEA  := EMA(DIFF,160);
    macd_M5:= 2*(DIFF-DEA);

     

     MA1:MA(C,60),COLORRED;

     

    S:= ABS(MA1-H)<=12*mindiff;

     

    n:=10;//加仓次数
    x:=3;//建仓手数
    w:=5;

     

    kong:=S  and macd_m5<0 ;

     

     


    if kong then buyshort(holding=0,x,market);

    if kong and ENTERPRICE-C>=w*MINDIFF and abs(holding)=x  then  buyshort(1,x,market);

    if kong  and  ENTERPRICE-C>=w*MINDIFF and abs(holding)=2*x then  buyshort(1,x,market);

    if kong  and  ENTERPRICE-C>=w*MINDIFF and abs(holding)=3*x then  buyshort(1,x,market);

    if kong  and  ENTERPRICE-C>=w*MINDIFF and abs(holding)=4*x then  buyshort(1,x,market);

    if kong  and  ENTERPRICE-C>=w*MINDIFF and abs(holding)=5*x then  buyshort(1,x,market);
     


     if   macd_m5>0 and holding<0 then sellshort(1,0,market);//平空
     

     

  • 金字塔客服:

    前面的不变,后面的修改如下:

    if kong then tbuyshort(tholding=0,x,mkt);

    if kong and tENTERPRICE-C>=w*MINDIFF and abs(tholding)=x  then  tbuyshort(1,x,mkt);

    if kong  and  tENTERPRICE-C>=w*MINDIFF and abs(tholding)=2*x then  tbuyshort(1,x,mkt);

    if kong  and  tENTERPRICE-C>=w*MINDIFF and abs(tholding)=3*x then  tbuyshort(1,x,mkt);

    if kong  and  tENTERPRICE-C>=w*MINDIFF and abs(tholding)=4*x then  tbuyshort(1,x,mkt);

    if kong  and  tENTERPRICE-C>=w*MINDIFF and abs(tholding)=5*x then  tbuyshort(1,x,mkt);
     


     if   macd_m5>0 and tholding<0 then tsellshort(1,0,mkt);//平空

     

  • 用户回复: 老师 问下 后台交易的 是在逐K线计算模式下 还是序列模式

     

  • 网友回复: 一般序列,除非有特殊的函数,才会用到逐k

     

  • 网友回复: 老师 就上面那个策略,我放在后台交易,为什么 会开仓了就马上平仓
打印本文打印本文 关闭窗口关闭窗口