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


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

   

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


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

主题:求改写金字塔模型

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


加好友 发短信
等级:论坛游民 帖子:122 积分:0 威望:0 精华:0 注册:2015/12/9 12:32:38
  发帖心情 Post By:2016/1/11 11:01:51    Post IP:101.90.255.181[只看该作者]

仅仅执行开平仓信号,不执行止盈止损信号。目前程序如下:
sell(C<ENTERPRICE-12*MINDIFF,holding,marketr);
sellshort(C>ENTERPRICE+12*MINDIFF,holding,marketr);

if hhv(h,enterbars+1)>=enterprice+4 and hhv(h,enterbars+1)<=enterprice+9 and c<=enterprice+1 then sell(1,0,market);
if hhv(h,enterbars+1)>=enterprice+10 and hhv(h,enterbars+1)<=enterprice+14 and c<=enterprice+3 then sell(1,0,market);
if hhv(h,enterbars+1)>=enterprice+15 and hhv(h,enterbars+1)<=enterprice+19 and c<=enterprice+8 then sell(1,0,market);
if hhv(h,enterbars+1)>=enterprice+20 and hhv(h,enterbars+1)<=enterprice+22 and c<=enterprice+18 then sell(1,0,market);
if llv(l,enterbars+1)<=enterprice-4 and llv(l,enterbars+1)>=enterprice-9 and c>=enterprice-1 then sellshort(1,0,market);
if llv(l,enterbars+1)<=enterprice-10 and llv(l,enterbars+1)>=enterprice-14 and c>=enterprice-3 then sellshort(1,0,market);
if llv(l,enterbars+1)<=enterprice-15 and llv(l,enterbars+1)>=enterprice-19 and c>=enterprice-8 then sellshort(1,0,market);
if llv(l,enterbars+1)<=enterprice-20 and llv(l,enterbars+1)>=enterprice-22 and c>=enterprice-18 then sellshort(1,0,market);
if hhv(h,enterbars+1)>enterprice+20 and hhv(h,enterbars+1)+23 and cross(enterprice-2,close) then sell(1,0,market);
if llv(l,enterbars+1)<enterprice-20 and llv(l,enterbars+1)-23 and cross(c,enterprice+2) then sellshort(1,0,market);
if openprofit>=0 and time0>=timetot0(closetime(0))-60*2 then begin
    sell(1,0,market);
    sellshort(1,0,market);
end

图片点击可在新窗口打开查看此主题相关图片如下:qq图片20160111110048.jpg
图片点击可在新窗口打开查看



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


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

说明并没有满足止盈止损 条件


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

客户服务部

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

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

 回到顶部
客人(101.90.*.*)
  73楼


  发帖心情 Post By:2016/1/11 11:21:45    Post IP:101.90.255.181[只看该作者]

71楼图片中的第二次空开(价格为100.230)后,价格最低到达100.120,盈利达到22跳,按照设定应在回到18跳时平仓,而结果在程序开多仓时才平仓。
if llv(l,enterbars+1)<=enterprice-20 and llv(l,enterbars+1)>=enterprice-22 and c>=enterprice-18 then sellshort(1,0,market);

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


加好友 发短信
等级:论坛游民 帖子:122 积分:0 威望:0 精华:0 注册:2015/12/9 12:32:38
  发帖心情 Post By:2016/1/11 11:23:59    Post IP:101.90.255.181[只看该作者]

71楼图片中的第二次空开(价格为100.230)后,价格最低到达100.120,盈利达到22跳,按照设定应在回到18跳时平仓,而结果在程序开多仓时才平仓。
if llv(l,enterbars+1)<=enterprice-20 and llv(l,enterbars+1)>=enterprice-22 and c>=enterprice-18 then sellshort(1,0,market);


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


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

跳数的话需要做这的修改:

 

 

if hhv(h,enterbars+1)>=enterprice+4*mindiff and hhv(h,enterbars+1)<=enterprice+9*mindiff  and c<=enterprice+1*mindiff  then sell(1,0,market);
if hhv(h,enterbars+1)>=enterprice+10*mindiff  and hhv(h,enterbars+1)<=enterprice+14*mindiff  and c<=enterprice+3*mindiff  then sell(1,0,market);
if hhv(h,enterbars+1)>=enterprice+15*mindiff  and hhv(h,enterbars+1)<=enterprice+19*mindiff  and c<=enterprice+8*mindiff  then sell(1,0,market);
if hhv(h,enterbars+1)>=enterprice+20*mindiff  and hhv(h,enterbars+1)<=enterprice+22*mindiff  and c<=enterprice+18*mindiff  then sell(1,0,market);
if llv(l,enterbars+1)<=enterprice-4*mindiff  and llv(l,enterbars+1)>=enterprice-9*mindiff  and c>=enterprice-1*mindiff  then sellshort(1,0,market);
if llv(l,enterbars+1)<=enterprice-10*mindiff  and llv(l,enterbars+1)>=enterprice-14*mindiff  and c>=enterprice-3*mindiff  then sellshort(1,0,market);
if llv(l,enterbars+1)<=enterprice-15*mindiff  and llv(l,enterbars+1)>=enterprice-19*mindiff  and c>=enterprice-8*mindiff  then sellshort(1,0,market);
if llv(l,enterbars+1)<=enterprice-20*mindiff  and llv(l,enterbars+1)>=enterprice-22*mindiff  and c>=enterprice-18*mindiff  then sellshort(1,0,market);
if hhv(h,enterbars+1)>enterprice+20*mindiff  and hhv(h,enterbars+1)+23*mindiff  and cross(enterprice-2*mindiff ,close) then sell(1,0,market);
if llv(l,enterbars+1)<enterprice-20*mindiff  and llv(l,enterbars+1)-23*mindiff  and cross(c,enterprice+2*mindiff ) then sellshort(1,0,market);


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

客户服务部

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

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

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


加好友 发短信
等级:论坛游民 帖子:122 积分:0 威望:0 精华:0 注册:2015/12/9 12:32:38
  发帖心情 Post By:2016/1/11 17:03:52    Post IP:101.90.255.181[只看该作者]

模型总是赔钱哦。请做以下优化:

    一、开仓以排队价,平仓以对手价;

    二、平仓要求:

      1、当符合价(要求最大亏损12跳;盈利4跳至9跳,如果回调至盈利1跳时平仓;盈利10跳至14跳,如果回调至盈利3跳时平仓;盈利15跳至19跳,如果回调至盈利8跳时平仓;盈利20跳至22跳,如果回调至盈利18跳时平仓;23跳以上跟踪止盈,则最新价从上一次高点回撤3跳,止赢;立即以对手价平仓,不以收盘价平仓。

      2持有多单时

        (1)当出现卖出信号,立即以对手价平仓,不以收盘价平仓;

    (2)当价格跌破H1白线》=4跳时,,以对手价平仓;

    (3)当收盘价超过布林线上轨后,收盘价又跌回布林线内,立即以对手价平仓。

3持有空单时,则相反。空单止赢止损及平仓与多单原理相同。

三、目前开平仓程序如下:

sellshort(CROSS(H1,H2)&&COUNT(enterbars=1,N)<25 ,0,thisclose);

buy(CROSS(H1,H2)&&COUNT(ENTERBARS=1,N)<25 and holding=0,1,thisclose);

sell(CROSS(H2,H1)&&COUNT(enterbars=1,N)<25,0,thisclose);

buyshort(CROSS(H2,H1)&&COUNT(enterbars=1,N)<25 and holding=0,1,thisclose);

sell(C<ENTERPRICE-12*MINDIFF,holding,marketr);

sellshort(C>ENTERPRICE+12*MINDIFF,holding,marketr);


if hhv(h,enterbars+1)>=enterprice+4*mindiff and hhv(h,enterbars+1)<=enterprice+9*mindiff  and c<=enterprice+1*mindiff  then sell(1,0,market);

if hhv(h,enterbars+1)>=enterprice+10*mindiff  and hhv(h,enterbars+1)<=enterprice+14*mindiff  and c<=enterprice+3*mindiff  then sell(1,0,market);

if hhv(h,enterbars+1)>=enterprice+15*mindiff  and hhv(h,enterbars+1)<=enterprice+19*mindiff  and c<=enterprice+8*mindiff  then sell(1,0,market);

if hhv(h,enterbars+1)>=enterprice+20*mindiff  and hhv(h,enterbars+1)<=enterprice+22*mindiff  and c<=enterprice+18*mindiff  then sell(1,0,market);

if llv(l,enterbars+1)<=enterprice-4*mindiff  and llv(l,enterbars+1)>=enterprice-9*mindiff  and c>=enterprice-1*mindiff  then sellshort(1,0,market);

if llv(l,enterbars+1)<=enterprice-10*mindiff  and llv(l,enterbars+1)>=enterprice-14*mindiff  and c>=enterprice-3*mindiff  then sellshort(1,0,market);

if llv(l,enterbars+1)<=enterprice-15*mindiff  and llv(l,enterbars+1)>=enterprice-19*mindiff  and c>=enterprice-8*mindiff  then sellshort(1,0,market);

if llv(l,enterbars+1)<=enterprice-20*mindiff  and llv(l,enterbars+1)>=enterprice-22*mindiff  and c>=enterprice-18*mindiff  then sellshort(1,0,market);

if hhv(h,enterbars+1)>enterprice+20*mindiff  and hhv(h,enterbars+1)+23*mindiff  and cross(enterprice-2*mindiff ,close) then sell(1,0,market);

if llv(l,enterbars+1)<enterprice-20*mindiff  and llv(l,enterbars+1)-23*mindiff  and cross(c,enterprice+2*mindiff ) then sellshort(1,0,market);


if openprofit>=0 and time0>=timetot0(closetime(0))-60*2 then begin

    sell(1,0,market);

    sellshort(1,0,market);

end



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


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

if hhv(h,enterbars+1)>=enterprice+4*mindiff and hhv(h,enterbars+1)<=enterprice+9*mindiff  and c<=enterprice+1*mindiff  then sell(1,0,thisclose);

if hhv(h,enterbars+1)>=enterprice+10*mindiff  and hhv(h,enterbars+1)<=enterprice+14*mindiff  and c<=enterprice+3*mindiff  then sell(1,0,thisclose);

if hhv(h,enterbars+1)>=enterprice+15*mindiff  and hhv(h,enterbars+1)<=enterprice+19*mindiff  and c<=enterprice+8*mindiff  then sell(1,0,thisclose);

if hhv(h,enterbars+1)>=enterprice+20*mindiff  and hhv(h,enterbars+1)<=enterprice+22*mindiff  and c<=enterprice+18*mindiff  then sell(1,0,thisclose);

if llv(l,enterbars+1)<=enterprice-4*mindiff  and llv(l,enterbars+1)>=enterprice-9*mindiff  and c>=enterprice-1*mindiff  then sellshort(1,0,thisclose);

if llv(l,enterbars+1)<=enterprice-10*mindiff  and llv(l,enterbars+1)>=enterprice-14*mindiff  and c>=enterprice-3*mindiff  then sellshort(1,0,thisclose);

if llv(l,enterbars+1)<=enterprice-15*mindiff  and llv(l,enterbars+1)>=enterprice-19*mindiff  and c>=enterprice-8*mindiff  then sellshort(1,0,thisclose);

if llv(l,enterbars+1)<=enterprice-20*mindiff  and llv(l,enterbars+1)>=enterprice-22*mindiff  and c>=enterprice-18*mindiff  then sellshort(1,0,thisclose);

if hhv(h,enterbars+1)>=enterprice+23*mindiff  and close<=hhv(h,enterbars+1)-3*mindifff then sell(1,0,thisclose);

if llv(l,enterbars+1)<enterprice-23*mindiff  and close>=llv(l,enterbars+1)+3*mindiff then sellshort(1,0,thisclose);

if close<=h1-4*mindiff then sell(1,0,thisclose);

if close>=h2+4*mindiff then sellshort(1,0,thisclose);

 

    (3)当收盘价超过布林线上轨后,收盘价又跌回布林线内,立即以对手价平仓。

收盘价超过上轨后,然后收盘价又跌回布林线,是同一根k线的吗?



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

客户服务部

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

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

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


加好友 发短信
等级:论坛游民 帖子:122 积分:0 威望:0 精华:0 注册:2015/12/9 12:32:38
  发帖心情 Post By:2016/1/11 17:28:13    Post IP:101.90.255.181[只看该作者]

谢谢,77楼所问回答:不是同一根K线。

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


加好友 发短信
等级:罗宾汉 帖子:46311 积分:50819 威望:0 精华:2 注册:2011/3/23 8:50:25
  发帖心情 Post By:2016/1/11 17:30:15    Post IP:58.246.57.26[只看该作者]

那么这之间有多少根k线的?


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

客户服务部

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

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

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


加好友 发短信
等级:论坛游民 帖子:122 积分:0 威望:0 精华:0 注册:2015/12/9 12:32:38
  发帖心情 Post By:2016/1/11 17:38:03    Post IP:101.90.255.181[只看该作者]

哦 , 
1、大于等于1的间隔即可。即如果前一根K线收盘价超过布林线上轨后,第二根K线收盘价又跌回布林线内,立即以对手价平仓。
2、另请关注开仓均已排队价的修改;
3、收盘前2分钟,持仓若有盈利立即以对手价平仓。当之后至收盘不再开仓。

 回到顶部
总数 84 上一页 1 2 3 4 5 6 7 8 9 下一页