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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件策略编写求助区 → 老师,帮我写个模型。感激不尽

   

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


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

主题:老师,帮我写个模型。感激不尽

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


加好友 发短信
等级:论坛游侠 帖子:129 积分:559 威望:0 精华:0 注册:2012/8/28 13:09:08
  发帖心情 Post By:2012/9/18 14:40:23 [只看该作者]

老师,能不能留个联系方式啊!


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


加好友 发短信
等级:罗宾汉 帖子:46311 积分:50819 威望:0 精华:2 注册:2011/3/23 8:50:25
  发帖心情 Post By:2012/9/18 15:21:05 [只看该作者]

{每天价格上涨A个点做多,下降A个点做空。
B个点的最初止损,C个点浮动止损,止损后反手。若连续亏损3次(注意不是止损,是亏损,不计算昨天的)直接平仓并且不反手。
所有交易D个点止盈,最后一小时不入场,最后两分钟平仓。
}
input:a(10),b(8),cc(5),d(8);
variable:hh=0,ll=0,cishuduo=0,cishukong=0;
dayopen:=valuewhen(date<>ref(date,1),o);//今开

time1:= time>090100 and time <140000;//交易时间

time2:= time>145800 and time<= 150000;//最后2分钟强平

if c>dayopen+a*mindiff and time1 and cishuduo=0 then begin
buy(holding=0,1,market);
hh:=h;
cishuduo:=1;
end//上涨A个点做多
if h>hh then hh:=h;
if c<dayopen-a*mindiff  and time1 and cishukong=0 then begin
buyshort(holding=0,1,market);
ll:=l;
cishukong:=1;
end//下跌A个点做空
 if l<ll then ll:=l;
if holding>0 and enterprice-c>=b*mindiff then begin
sell(holding>0,0,market);
buyshort(holding=0,1,market);
end//多头止损反手

if holding<0 and c-enterprice>=b*mindiff  then begin
sellshort(holding<0,0,market);
buy(holding=0,1,market);
end//空头止损反手
if hh-c>=cc*mindiff and holding>0 then sell(holding>0,0,market);//CC个点多头浮动止损,下为空头

if c-ll>=cc*mindiff and holding>0 then sellshort(holding<0,0,market);

if numlosstrade>=3 and holding>0 then sell(holding>0,0,market);//多头连亏三次后平仓不反手,下为空头

if numlosstrade>=3 and holding<0 then sellshort(holding<0,0,market);

if holding>0 and c>=enterprice+d*mindiff then sell(holding>0,0,market);//多头d个点止盈
if holding<0 and c<=enterprice-d*mindiff then sell(holding<0,0,market);//多头d个点止盈

if time2 then BEGIN
sell(1,0,market);
sellshort(1,0,market);
cishuduo:=0;
cishukong:=0;
end//收盘前平仓



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

客户服务部

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

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

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


加好友 发短信
等级:论坛游侠 帖子:129 积分:559 威望:0 精华:0 注册:2012/8/28 13:09:08
  发帖心情 Post By:2012/9/18 16:25:54 [只看该作者]

老师,代码有问题,计算hh是开多仓后的最高值,当开第二个多单时hh需要重新计算,不是今天最高点。下面是我写的代码,有些可能是我没有说清楚,请老师改正一下。

 

下面的代码,模拟测试的时候开仓平仓点不对,我想问问下面代码有问题吗?如果有,问题出在哪儿?

 

variable:n=0,m=0,a=0,hh=0,ll=100000,ykcs=0;;
oo:=valuewhen(date<>ref(date,1),open);
sx:=oo+5;
xx:=oo-5;
n:=barslast(holding=1)+1;
hh:=hhv(h,n);
m:=barslast(holding=-1)+1;
ll:=llv(l,m);
if c>=sx and a=0 then begin
  if holding=0 then buy(1,1,market);
  a:=1;
end
if c<=xx and a=0 then begin
  if holding=0 then buyshort(1,1,market);
  a:=1;
end
yingkui:=exitprice-enterprice;
cound1:=(holding=-1 and (cross(c,enterprice+3) or cross(c,ll+4))) and time<=1400;
cound2:=(holding=1 and (cross(enterprice-3,c) or cross(hh-4,c))) and time<=1400;
if cound1 then begin
  sellshort(1,1,market);
  if yingkui>=0 then ykcs:=ykcs+1,;
  if yingkui<0 then ykcs:=0;
  if holding=0 and ykcs<3 then buy(1,1,market);
end
if cound2 then begin
  if holding=1 then sell(1,1,market);
  if yingkui>=0 then ykcs:=0;
  if yingkui<0 then ykcs:=ykcs+1;
  if holding=0 and ykcs<3 then buyshort(1,1,market);
end
if (holding=1 and cross(c,enterprice+10)) or time>=1458 then sell(1,1,market);
if (holding=-1 and cross(enterprice-10,c)) or time>=1458 then sellshort(1,1,market);


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


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

if c>dayopen+a*mindiff and time1 and cishuduo=0 then begin
buy(holding=0,1,market);
hh:=h;
cishuduo:=1;
这个就是每次做多后重新赋值HH,然后再重新比较H和HH的大小


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

客户服务部

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

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

 回到顶部
帅哥哟,离线,有人找我吗?
漫步金字塔
  15楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游侠 帖子:129 积分:559 威望:0 精华:0 注册:2012/8/28 13:09:08
  发帖心情 Post By:2012/9/18 17:41:39 [只看该作者]

if holding<0 and c-enterprice>=b*mindiff then begin
sellshort(holding<0,0,market);

buy(holding=0,1,market);

是不是也应该改为

if holding<0 and c-enterprice>=b*mindiff then begin
sellshort(holding<0,0,market);
buy(holding=0,1,market);
hh=h;

if h>hh then hh:=h;

还有,老师

if numlosstrade>=3 and holding>0 then sell(holding>0,0,market);//多头连亏三次后平仓不反手,下为空头

if numlosstrade>=3 and holding<0 then sellshort(holding<0,0,market);

numlosstrade是到现在为止亏损次数,会不会还加上昨天的呢?老师我说的是连续亏损啊!!!

 

if holding>0 and enterprice-c>=b*mindiff then begin
sell(holding>0,0,market);
buyshort(holding=0,1,market);
end//多头止损反手

if holding<0 and c-enterprice>=b*mindiff then begin
sellshort(holding<0,0,market);
buy(holding=0,1,market);
end//空头止损反手

老师,这句是不是三次亏损后要开仓,但是到后面有马上平仓呢???老师辛苦了,恳请仔细解答!

 


 回到顶部
帅哥哟,离线,有人找我吗?
漫步金字塔
  16楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游侠 帖子:129 积分:559 威望:0 精华:0 注册:2012/8/28 13:09:08
  发帖心情 Post By:2012/9/19 16:50:57 [只看该作者]

您的IP(221.3.133.230)被系统限制,或者您可以和管理员联系。 

这个是怎么回事?老师,能解除限制吗???

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


加好友 发短信
等级:罗宾汉 帖子:46311 积分:50819 威望:0 精华:2 注册:2011/3/23 8:50:25
  发帖心情 Post By:2012/9/19 16:59:10 [只看该作者]

有人用221.3.133.*这个IP发广告,被禁掉了,解禁的话就会有人用这个IP段发广告了



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

客户服务部

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

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

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


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

如果需要控制今日的话那个连亏函数就没有用,要重新计算连亏的方式


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

客户服务部

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

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

 回到顶部
帅哥哟,离线,有人找我吗?
漫步金字塔
  19楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游侠 帖子:129 积分:559 威望:0 精华:0 注册:2012/8/28 13:09:08
  发帖心情 Post By:2012/9/20 16:52:39 [只看该作者]

variable:a=0,;
input:kl(20);
oo:=valuewhen(time=0901,open);
if time=901 then a=0; 
sx:=oo+kl;
xx:=oo-kl;
if c>=sx and a=0 then begin
  buy(1,1,market);
  a:=1;
end
if c<=xx and a=0 then begin
  buyshort(1,1,market);
  a:=1;
end
if time>=1458 then begin
  sell(1,1,market);
  sellshort(1,1,market)
end

 

老师,模型开盘走出20个点买入或卖出,怎么今天没有信号呢?

 


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


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

写time不要偷懒,写全了


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

客户服务部

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

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

 回到顶部
总数 33 上一页 1 2 3 4 下一页