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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件策略编写求助区 → [求助][讨论]股指日内交易

   

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


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

主题:[求助][讨论]股指日内交易

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


加好友 发短信
等级:论坛游侠 帖子:121 积分:390 威望:0 精华:0 注册:2011/12/9 19:52:04
[求助][讨论]股指日内交易  发帖心情 Post By:2012/2/10 17:06:21 [只看该作者]

请大侠们我编个程序

股指日内交易

条件以下

 

1.开仓条件:大于等于开盘价10个点就做多,小于等于10个点就做空;这是开仓条件

2.止损:20个点止损

3.止赢:按时间止赢,15:10分

4.一天就做一次

5.不按k线走完模型,就是最高最低价碰到就开仓,平仓也是同理


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


加好友 发短信
等级:论坛游侠 帖子:121 积分:390 威望:0 精华:0 注册:2011/12/9 19:52:04
  发帖心情 Post By:2012/2/10 18:57:36 [只看该作者]

想了下好像写出来了,我自己把模型发出来。但最后一条,

//5.不按k线走完模型,就是最高最低价碰到就开仓,平仓也是同理

请高手解决下。//

variable:次数=1;
Dayopen:valuewhen(date<>ref(date,1),o);
上规线:Dayopen+10;
下规线:Dayopen-10;
多开:=h>上规线;
空开:=l<下规线;
//交易时间区间
交易时间:=if(time>091500 and time<=151300,1,0);
//交易开始加仓
if 交易时间>0  and 次数=1 then
begin
buy(holding=0 and 多开,1,thisclose);
buyshort(holding=0 and 空开,1,thisclose);
end

//正常交易过程
if 交易时间>0 then
begin
if l<下规线 then
begin
sell(holding>0,0,thisclose);
次数:=0;
end
if h>上规线 then
begin
sellshort(holding<0,0,thisclose);
次数:=0;
end
end

//收盘前清仓
if time>=151000 then
begin
sellshort(holding<0,0,thisclose);
sell(holding>0,0,thisclose);
次数:=1;
end


持仓:holding,colorwhite,linethick0;
交易总数:totaltrade,colorwhite,linethick0;
盈亏:asset-1000000,noaxis,colorred,linethick1;

 


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


加好友 发短信
等级:论坛游民 帖子:262 积分:2802 威望:0 精华:0 注册:2011/11/17 19:20:51
  发帖心情 Post By:2012/2/11 22:59:27 [只看该作者]

我给过你类似的模型,结果不好。再有为什么要限制交易次数?这在策略设计时是没有道理的。

variable:a1=0;

r1:=barslast(day-ref(day,1)<>0);

r2:ref(o,r1);

r3:r2+10;

r4:r2-10;

r5:=time>091500 and time<151000;

if cross(h,r2) and r5 and holding=0 and a1=0 then

     begin

     buy(1,1,limitr,r3)

     end

if cross(r4,l) and r5 and holding=0 and a1=0 then

     begin

     buyshort(1,1,limitr,r4);

     end

if holding>0 and cross(r4,l) and r5 then

     begin

     sell(1,0,limitr,r4);

     a1:=1;

     end

if holding<0 and cross(h,r3) and r5 then

     begin

     sellshort(1,0,limitr,r3);

     a1:=1;

     end

if time>=151000 and holding<>0 then

     begin

     sell(holding>0,0,thisclose);

     sellshort(holding<0,0,thisclose);

     a1:=1;

     end

以上的代码用于测试,实际交易时用如下代码:

variable:a1=0;

r1:=barslast(day-ref(day,1)<>0);

r2:ref(o,r1);

r3:r2+10;

r4:r2-10;

r5:=time>091500 and time<151000;

if cross(c,r2) and r5 and holding=0 and a1=0 then

begin

buy(1,1,limitr,r3)

end

if cross(r4,c) and r5 and holding=0 and a1=0 then

begin

buyshort(1,1,limitr,r4);

end

if holding>0 and cross(r4,c) and r5 then

begin

sell(1,0,limitr,r4);

a1:=1;

end

if holding<0 and cross(c,r3) and r5 then

begin

sellshort(1,0,limitr,r3);

a1:=1;

end

if time>=151000 and holding<>0 then

begin

sell(holding>0,0,thisclose);

sellshort(holding<0,0,thisclose);

a1:=1;

end

以上代码没有测试,估计不会有大问题,


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


加好友 发短信
等级:论坛游民 帖子:262 积分:2802 威望:0 精华:0 注册:2011/11/17 19:20:51
  发帖心情 Post By:2012/2/11 23:11:02 [只看该作者]

我理解你限制明天只交易一次,是为了抓单边市。如果这样你用SAR的思路可能更好。试试看吧

 


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


加好友 发短信
等级:论坛游民 帖子:262 积分:2802 威望:0 精华:0 注册:2011/11/17 19:20:51
  发帖心情 Post By:2012/2/12 14:57:40 [只看该作者]

把你的思路改了一下,下面的代码可以实用,长期使用肯定亏不了钱,但也赚不了大钱。建议用5分钟周期

 

 

 

//股指期货自动交易程序
//编制:zg611029 qq:2313936161

input:n(13,5,30,1);

//交易手数:
tn:=1;

r1:=barslast(day-ref(day,1)<>0);

r5:ref(o,r1);
r6:r5+n;
r7:r5-n;

if cross(h,r6)  then
 begin
 buy(holding=0,tn,limitr,r6);
 end
if cross(r7,l) then
 begin
 buyshort(holding=0,tn,limitr,r7);
 end
if holding>0 and cross(r5,l) then
 begin
 sell(1,0,limitr,r5);
 end
if holding<0 and cross(h,r5) then
 begin
 sellshort(1,0,limitr,r5);
 end
  
//收盘前清仓
if time>=151400 then
 begin
 sellshort(holding<0,0,thisclose);
 sell(holding>0,0,thisclose);
 end
 
持仓:holding,colorwhite,linethick0;
交易总数:totaltrade,colorwhite,linethick0;
盈亏:asset-1000000,noaxis,colorred,linethick1;


 


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


加好友 发短信
等级:新手上路 帖子:11 积分:23 威望:0 精华:0 注册:2012/2/15 10:45:25
  发帖心情 Post By:2012/2/15 10:55:10 [只看该作者]

图片点击可在新窗口打开查看,随便来看看有没有能带走的

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


加好友 发短信 czt
等级:蜘蛛侠 帖子:1445 积分:6114 威望:0 精华:3 注册:2012/1/16 10:31:19
答复  发帖心情 Post By:2012/2/16 11:00:22 [只看该作者]

您可以通过每隔几秒钟去检测,是否满足条件,来完成此操作,弊端就是,比如一旦在一根K线中,检测到10次满足,信号会出现10次,但是只有在第一次信号的时候开仓,但是后面9次都不开,除非就是下一根K线的时候再有信号再开了


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


加好友 发短信 czt
等级:蜘蛛侠 帖子:1445 积分:6114 威望:0 精华:3 注册:2012/1/16 10:31:19
  发帖心情 Post By:2012/2/16 14:00:37 [只看该作者]

或者您可以用启用交易时自带的一个“走完一根K线”或者“固定间隔时间”

 回到顶部