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

[求助]为何这段代码编译通不过请高手帮忙改改看看问题在哪 [金字塔]

  • 咨询内容:

    last_high_0:=EXTGBDATA('last_high');
    last_low_0:=EXTGBDATA('last_low');
    kc_price_0:=EXTGBDATA('kc_price');
    tx_holding_0:=EXTGBDATA('tx_holding');

    high_0:=high;
    close_0:=close;
    low_0:=low;


    if tx_holding_0>0 and high_0>last_high_0 then EXTGBDATASET('last_high',high_0);
    if tx_holding_0<0 and low_0<last_low_0 then EXTGBDATASET('last_low',low_0);


    if last_high_0=kc_price_0 then last_high_0:=last_high_0+50;
    if last_low_0 =kc_price_0 then last_low_0 :=last_low_0-50;

    开多仓后最高涨幅:=(last_high_0-kc_price_0)/kc_price_0;
    开多涨回撤比例限制:=1/sqrt(开多仓后最高涨幅*100+止赢系数);
    开多涨回撤幅度限制:=(last_high_0-kc_price_0)*开多涨回撤比例限制;
    开多涨回撤价格限制:=last_high_0-开多涨回撤幅度限制;
    if 开多仓后最高涨幅<1.5% then  开多涨回撤价格限制:=last_high_0*(1-止损百分比);

     

    pd_tj_多头止损:=tx_holding_0>0  and     ( close_0<kc_price_0*(1-止损百分比)  );
    pd_tj_多头止赢:=tx_holding_0>0  and     (  close_0<开多涨回撤价格限制 );


    开空仓后最大跌幅:=(kc_price_0-last_low_0)/kc_price_0;
    开空跌回撤比例限制:=1/sqrt(开空仓后最大跌幅*100+止赢系数);
    开空跌回撤幅度限制:=(kc_price_0-last_low_0)*开空跌回撤比例限制;
    开空跌回撤价格限制:=last_low_0+开空跌回撤幅度限制;
    if 开空仓后最大跌幅<1.5% then  开空跌回撤价格限制:=last_low_0*(1+止损百分比);


    pk_tj_空头止损:=tx_holding_0<0  and     ( close_0>kc_price_0*(1+止损百分比)  );
    pk_tj_空头止赢:=tx_holding_0<0  and     ( close_0>开空跌回撤价格限制 );

     

     

     

     

    {平多}EXITLONG:    pd_tj_多头止损  or pd_tj_多头止赢  ,ORDERQUEUE ;  {  ,TFILTER; }
    {平空}EXITSHORT:  pk_tj_空头止损  or pk_tj_空头止赢  ,ORDERQUEUE ;  {  ,TFILTER; }
     
    {开多}ENTERLONG:  KD_TJ    ,ORDERQUEUE        ;  { ,TFILTER;  }
    {开空}ENTERSHORT: KK_TJ    ,ORDERQUEUE        ;  { ,TFILTER;  }

     

     

    // 开多 保存全局变量
    if ( KD_TJ  and tx_holding_0<1  ) then   
                                                          begin  EXTGBDATASET('last_high',high_0);
                                                                 EXTGBDATASET('last_low',low_0);
                                                                 EXTGBDATASET('tx_holding',1);
                                                                 EXTGBDATASET('kc_price',close_0);
                                                               
                                                          end
    // 开空 保存全局变量                                                     
    if ( KK_TJ and tx_holding_0>-1 ) then   
                                                          begin  EXTGBDATASET('last_high',high_0);
                                                                 EXTGBDATASET('last_low',low_0);
                                                                 EXTGBDATASET('tx_holding',-1);
                                                                 EXTGBDATASET('kc_price',close_0);
                                                          end 
                  
                 

    // 平多仓后保存全局变量
    if (( pd_tj_多头止损  or pd_tj_多头止赢 ) and tx_holding_0>0 ) then   
                                                                                                                     begin  EXTGBDATASET('last_high',1);
                                                                                                                            EXTGBDATASET('last_low',1);
                                                                                                                            EXTGBDATASET('tx_holding',0);
                                                                                                                            EXTGBDATASET('kc_price',1);
                                                                                                                      end

    // 平空仓后保存全局变量                                                                                                                 
    if (( pk_tj_空头止损  or pk_tj_空头止赢 ) and tx_holding_0<0 )   then   
                                                                                                                     begin  EXTGBDATASET('last_high',1);
                                                                                                                            EXTGBDATASET('last_low',1);
                                                                                                                            EXTGBDATASET('tx_holding',0);
                                                                                                                            EXTGBDATASET('kc_price',1);
                                                                                                                      end

     

  • 金字塔客服:

    这段公式代码不是完整的代码,而只是一段伪代码,里面很多地方需要用户自己填写自己的交易设置的。

    如果你看不懂这些代码,请用户认真的先从金字塔的最基础的地方开始学起,不要急躁

     

    《金字塔决策交易系统公式编程》(基础篇)

    下载地址:http://www.weistock.com/download/FormulaHelp1.rar 


     

    《金字塔程式化交易设计指南》(高级篇)

    下载地址:http://www.weistock.com/download/FormulaHelp2.rar  

     

  • 用户回复:

    代码不全。

     

     KD_TJ  没有定义。 KD_TJ  就是开多仓的条件

     

     KK_TJ    开空条件没有定义

     

  • 网友回复: 1.5%  要改成0.015

 

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

可联系技术人员 QQ: 1145508240  有需要帮忙请点击这里留言!!!进行 有偿 编写!不贵!点击查看价格!


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

相关文章

    没有相关内容