欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 以下策略为金字塔程序化双边策略(可开多,可开空),请老师更改为两个单边策略(只开空一个策略,只开多一个策略)

   

欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。    


  共有3103人关注过本帖树形打印复制链接

主题:以下策略为金字塔程序化双边策略(可开多,可开空),请老师更改为两个单边策略(只开空一个策略,只开多一个策略)

美女呀,离线,留言给我吧!
代人发贴
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:金字塔客服 帖子:610 积分:0 威望:0 精华:0 注册:2013/10/22 14:33:15
以下策略为金字塔程序化双边策略(可开多,可开空),请老师更改为两个单边策略(只开空一个策略,只开多一个策略)  发帖心情 Post By:2021/1/4 9:49:18    Post IP:58.246.57.26[只看该作者]

以下策略为金字塔程序化双边策略(可开多,可开空),请老师更改为两个单边策略(只开空一个策略,只开多一个策略),谢谢

//该策略适用于图表程序化交易

 

            //该范例适用于5分钟周期

 

            //此策略仅供参考学习,请勿直接用于实盘

 

 

 

            INPUT:N(55,1,100,1),SS(1,1,100,1),NMIN(10,1,100,1),LONG_CO(0.999,0.001,1.1,0.001),SHORT_CO(1.001,0.001,1.1,0.001);

 

 

 

            BUYTIME:=TIME>OPENTIME(1) AND TIME<CLOSETIME(0)-NMIN*100;      //设置日内交易的开仓时段           

 

            SELLTIME:=TIME>=CLOSETIME(0)-NMIN*100;                                        //设置尾盘的清仓时段      

 

            UP_LINE:REF(HHV(H,N),1)*LONG_CO;                                                    //设置上轨线

            DOWN_LINE:REF(LLV(L,N),1)*SHORT_CO;                                              //设置下轨线

            MIDDLE_LINE:(UP_LINE+DOWN_LINE)/2;                                               //设置中轨线

 

            CONKD:H>=UP_LINE AND BUYTIME ;                                                     //设置开多条件

            CONKK:L<=DOWN_LINE AND BUYTIME;                                                 //设置开空条件

            CONPD:C<MIDDLE_LINE;                                                                      //设置平多条件

            CONPK:C>MIDDLE_LINE;                                                                      //设置平空条件

 

 

 

            SELLSHORT(CONPK AND HOLDING<0,HOLDING,MARKET);

            SELL(CONPD AND HOLDING>0,HOLDING,MARKET);

            BUY(CONKD AND HOLDING=0,SS,MARKET);

            BUYSHORT(CONKK AND HOLDING=0,SS,MARKET);

 

 

 

            IF SELLTIME THEN                                                                               //收盘前全部平仓

                BEGIN

                SELL(HOLDING>0,HOLDING,MARKET);

                SELLSHORT(HOLDING<0,HOLDING,MARKET);

                END


 回到顶部
帅哥哟,离线,有人找我吗?
FireScript
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:14496 积分:0 威望:0 精华:0 注册:2017/7/4 13:40:18
  发帖心情 Post By:2021/1/4 9:54:23    Post IP:58.246.57.26[只看该作者]

 只开空
INPUT:N(55,1,100,1),SS(1,1,100,1),NMIN(10,1,100,1),LONG_CO(0.999,0.001,1.1,0.001),SHORT_CO(1.001,0.001,1.1,0.001);
BUYTIME:=TIME>OPENTIME(1) AND TIME<CLOSETIME(0)-NMIN*100;      //设置日内交易的开仓时段           
SELLTIME:=TIME>=CLOSETIME(0)-NMIN*100;                                     
UP_LINE:REF(HHV(H,N),1)*LONG_CO;                                             
DOWN_LINE:REF(LLV(L,N),1)*SHORT_CO;                                            
MIDDLE_LINE:(UP_LINE+DOWN_LINE)/2;                                            
                                                    
CONKK:L<=DOWN_LINE AND BUYTIME;                                                                                                                //设置平多条件
CONPK:C>MIDDLE_LINE;                                                                   

 
SELLSHORT(CONPK AND HOLDING<0,HOLDING,MARKET);
BUYSHORT(CONKK AND HOLDING=0,SS,MARKET);
IF SELLTIME THEN                                                                               //收盘前全部平仓
BEGIN
SELLSHORT(HOLDING<0,HOLDING,MARKET);
END



只开多
INPUT:N(55,1,100,1),SS(1,1,100,1),NMIN(10,1,100,1),LONG_CO(0.999,0.001,1.1,0.001),SHORT_CO(1.001,0.001,1.1,0.001);
BUYTIME:=TIME>OPENTIME(1) AND TIME<CLOSETIME(0)-NMIN*100;      //设置日内交易的开仓时段           
SELLTIME:=TIME>=CLOSETIME(0)-NMIN*100;                                        
UP_LINE:REF(HHV(H,N),1)*LONG_CO;                                           
DOWN_LINE:REF(LLV(L,N),1)*SHORT_CO;                                   
MIDDLE_LINE:(UP_LINE+DOWN_LINE)/2;                                             

CONKD:H>=UP_LINE AND BUYTIME ;                                                                                                 
CONPD:C<MIDDLE_LINE;                                                               
                                                               
SELL(CONPD AND HOLDING>0,HOLDING,MARKET);
BUY(CONKD AND HOLDING=0,SS,MARKET);

 IF SELLTIME THEN                                                                               //收盘前全部平仓
BEGIN
SELL(HOLDING>0,HOLDING,MARKET);
END



命数如织,当如磐石。
 回到顶部