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

我编了一个程序,但和我的想法不一,请看看

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

    //本策略主要是整合了网上的一些方法,我主要是想做日内单边上涨或下跌,加载在一分钟周期上,用走完k线模式。


    1.开多条件是:5日线和10日线多头排列时,10点前涨幅超过0.5%,在time>=100000 and time<=143000时,如果再次突破10点前高点,在下一根k线做多;反之,做空。

    2.平仓分收盘平仓,止损平仓,止盈平仓。止损点为10个指数点;止盈条件为当盈利超过10个指数点后,如回撤幅度达到50%,就平仓,并且当日不再开仓。

    3.现在的问题是信号没有,比如今天可以开仓的,但没有信号

     


    INPUT:跌幅(0.005,0.001,0.025,0.001);

    INPUT:止损(50,10,100,1);

    INPUT:时间(60,30,120,10);

    INPUT:回撤(0.5,0.1,1,0.1);

    VARIABLE:aa:=0;//判断开仓的次数,如果止盈平仓,就不再开仓

    昨收:=ref(c,todaybar);

    10点前最高价:=valuewhen(todaybar<=45,hhv(h,todaybar));

    10点前最低价:=valuewhen(todaybar<=45,llv(l,todaybar));

    10点前涨幅:=(10点前最高价-昨收)/昨收;

    10点前跌幅:=(昨收-10点前最低价)/昨收;

    开仓时间:=time>=100000 and time<=143000;

    收盘平仓时间:=time>145500;

    多头止损价:=enterprice-止损*mindiff;

    空头止损价:=enterprice+止损*mindiff;

    开仓后最高:=hhv(h,enterbars+1);

    开仓后最低:=llv(l,enterbars+1);

    开多仓后最高盈利:=开仓后最高-enterprice;

    开空仓后最高盈利:=enterprice-开仓后最低;

    多仓当前盈利:=c-enterprice;

    空仓当前盈利:=enterprice-c;

    //交易条件

    多仓条件:=10点前涨幅>=涨幅 and 开仓时间 and ref(c,1)>=10点前最高价 and holding=0 and aa=0;

    空仓条件:=10点前跌幅>=跌幅 and 开仓时间 and ref(c,1)<=10点前最低价 and holding=0 and aa=0;

    //交易系统

     

    //收盘平仓

    if 收盘平仓时间 and holding<>0 then begin

       平多:sell(1,holding,limit,o);

       平空:sellshort(1,holding,limit,o);

        aa:=0;

       end

    //止损平仓

    if  holding>0 and ref(c,1)<=多头止损价 then begin

        止损价格:=多头止损价;

        if o<止损价格 then begin

         止损价格:=o;

         止损平多:sell(1,holding,limit,止损价格);

         aa:=0;

         end;

         end;

    if  holding<0 and ref(c,1)>=空头止损价 then begin

        止损价格:=空头止损价;

        if o>止损价格 then begin

         止损价格:=o;

         止损平空:sellshort(1,holding,limit,止损价格);

         aa:=0;

          end;

         end;

    //止盈平仓

    if  holding>0 and 开多仓后最高盈利>=50*mindiff and 多仓当前盈利<=回撤*开多仓后最高盈利 and enterbars>0 and aa=0 then begin

       止盈平多:sell(1,holding,limit,o);

       aa:=1;

       if time=closetime(0)then begin

       aa:=0;

       end;

       end;

    if  holding<0 and 开空仓后最高盈利>=50*mindiff and 空仓当前盈利<=回撤*开空仓后最高盈利 and enterbars>0 and aa=0 then begin

       止盈平空:sellshort(1,holding,limit,o);

        aa:=1;

       if time=closetime(0)then begin

       aa:=0;

       end;

       end;

    //开仓

    buy(多仓条件=1,1,limit,o);

    sell(空仓条件=1,1,limit,o);

     

  • 金字塔客服: 涨幅和跌幅是怎么定义的?

     

  • 用户回复: NPUT:跌幅(0.005,0.001,0.025,0.001);

     

  • 网友回复: 涨幅忘了

     

  • 网友回复: 加了还是不行
打印本文打印本文 关闭窗口关闭窗口