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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 关于策略编写问题?

   

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


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

主题:关于策略编写问题?

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


加好友 发短信
等级:罗宾汉 帖子:46311 积分:50819 威望:0 精华:2 注册:2011/3/23 8:50:25
  发帖心情 Post By:2017/1/4 13:07:28    Post IP:180.169.30.6[只看该作者]


 

//1 上穿20曰线平空开多,下穿20日线平多开空


ma20:=ma(c,20);

ma60:=ma(c,60);

if cross(c,ma20)  then begin

   sellshort(1,0,thisclose);

    buy(holding=0,1,thisclose);

end

 

if cross(ma20,c) then begin

   sell(1,0,thisclose);

   buyshort(holding=0,1,thisclose);

end

//2 上穿20日线开多后,再次上穿60日线,这持有多单,只能在下穿60日线平多(小级别建仓,大级别平仓)

//2 下穿20日线开空后,再次下穿60日线,这持有空单,只能在上穿60日线平空(小级别建仓,大级别平仓)

if enterbars>1 and cross(ma60,c) and count(cross(c,ma60),enterbars+1)>0 then sell(1,0,marketr);

if enterbars>1 and cross(c,ma60) and count(cross(ma60,c),enterbars+1)>0 then sellshort(1,0,marketr);

//3 止盈和止损,两种条件holding<0 and h>=min(enterprice+zsx,kstop1) 和holding>0 and l<=max(enterprice-zsx,dstop1) 

if holding<0 and h>=min(enterprice+zsx,kstop1) then sellshort(1,0,thisclose);

if holding>0 and l<=max(enterprice-zsx,dstop1)  then sell(1,0,thisclose);



金字塔—专业程序化交易量化投资平台

客户服务部

----------------------------------------------------------- 欢迎您参加我公司的技术培训,具体培训需求请发邮件到service@weistock.com

您的宝贵建议或者投诉,请发往邮箱:weiwei@weistock.com

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


加好友 发短信
等级:论坛游民 帖子:169 积分:0 威望:0 精华:0 注册:2016/8/28 16:11:16
  发帖心情 Post By:2017/1/4 14:17:44    Post IP:116.29.216.165[只看该作者]

有关键问题没有解决,就是:
    1.持有多单上穿60日线后,只能下穿60日线才能平仓,也就是说下穿20日线不能平仓,

    2.持有多单沒有上穿60日线情况下,下穿20日线才可以平仓,

    

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


加好友 发短信
等级:罗宾汉 帖子:46311 积分:50819 威望:0 精华:2 注册:2011/3/23 8:50:25
  发帖心情 Post By:2017/1/4 14:27:19    Post IP:180.169.30.6[只看该作者]

//1 上穿20曰线平空开多,下穿20日线平多开空


ma20:=ma(c,20);

ma60:=ma(c,60);

if cross(c,ma20)  then begin

  

    buy(holding=0,1,thisclose);

end

 

if cross(ma20,c) then begin

  

   buyshort(holding=0,1,thisclose);

end

//2 上穿20日线开多后,再次上穿60日线,这持有多单,只能在下穿60日线平多(小级别建仓,大级别平仓)

//2 下穿20日线开空后,再次下穿60日线,这持有空单,只能在上穿60日线平空(小级别建仓,大级别平仓)

if enterbars>1 and cross(ma60,c) and count(cross(c,ma60),enterbars+1)>0 then sell(1,0,marketr);

if enterbars>1 and cross(c,ma60) and count(cross(ma60,c),enterbars+1)>0 then sellshort(1,0,marketr);

//3 止盈和止损,两种条件holding<0 and h>=min(enterprice+zsx,kstop1) 和holding>0 and l<=max(enterprice-zsx,dstop1) 

if holding<0 and h>=min(enterprice+zsx,kstop1) then sellshort(1,0,thisclose);

if holding>0 and l<=max(enterprice-zsx,dstop1)  then sell(1,0,thisclose);

 

if holding<0 and enterbars>1 and cross(c,ma20) and count(cross(ma60,c),enterbars+1)=0 then sellshort(1,0,marketr);
if holding>0 and enterbars>1 and cross(ma20,c) and count(cross(c,ma60),enterbars+1)=0 then sell(1,0,marketr);


金字塔—专业程序化交易量化投资平台

客户服务部

----------------------------------------------------------- 欢迎您参加我公司的技术培训,具体培训需求请发邮件到service@weistock.com

您的宝贵建议或者投诉,请发往邮箱:weiwei@weistock.com

 回到顶部
总数 13 上一页 1 2