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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件策略编写求助区 → 均线策略

   

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


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

主题:均线策略

帅哥哟,离线,有人找我吗?
gxx978
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:4994 积分:0 威望:0 精华:0 注册:2016/9/1 10:46:51
  发帖心情 Post By:2016/11/7 12:54:39 [显示全部帖子]

//此策略仅为一个雏形,后续工作人员会持续跟踪调试,请勿直接用于实盘。

 

input:n(38,5,60,1);
variable:maxprofit=0;          //最大获利 
win:=0;                              //盈利
win2:=0;                            //回调                               

ma1:ma(c,n);
cond:o>ma1 and cross(ref(h,1),ref(ma1,1)); //开多条件
conk:o<=ma1 and cross(ref(ma1,1),ref(h,1)); //开空条件

   
if cond then
   begin
   sellshort(holding<0,holding,MARKET);
   buy(holding=0,1,MARKET);
   maxprofit:=0;
   end
  
if conk  then
   begin
   sell(holding>0,holding,MARKET);
   buyshort(holding=0,1,MARKET);
   maxprofit:=0;
   end
  
sells1:l-enterprice>30 and holding>0;
sells2:h-enterprice>30 and holding<0;

 

if sells1 or sells2 then
   begin
   zs1:sell(holding>0,holding,MARKET);
   zs2:sellshort(holding<0,holding,MARKET);
   maxprofit:=0;
   end
  
if holding>0 and enterbars>0 then             //计算持多单盈利及回调
   begin
   win:=(high-enterprice);
   if win>maxprofit then maxprofit:=win;
   win2:=maxprofit-win;
   end
  
if holding<0 and enterbars>0 then             //计算持空单盈利及回调
   begin
   win:=(low-enterprice);
   if win>maxprofit then maxprofit:=win;
   win2:=maxprofit-win;
   end
  
selly1:=win>=130 and win<=180 and win2<=105;
selly2:=win>180 and win<=280 and win2<=145;
selly3:=win>280 and win2<=278;

 

if selly1 or selly2 or selly3 THEN
    begin
    zy1:sell(holding>0,holding,MARKET);
    zy2:sellshort(holding<0,holding,MARKET);
    end


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


加好友 发短信
等级:超级版主 帖子:4994 积分:0 威望:0 精华:0 注册:2016/9/1 10:46:51
  发帖心情 Post By:2016/11/15 15:16:19 [显示全部帖子]

cond:o>ma1 and cross(ref(h,1),ref(ma1,1)); //开多条件

 

以上为本策略中的开多条件,本周期的开盘价在均线之上,且上一周期的最高价上穿均线才开多。一直在均线以上不会触发开多信号。

 


 回到顶部