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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 请求老师帮忙检查完善一下程序

   

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


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

主题:请求老师帮忙检查完善一下程序

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


加好友 发短信
等级:新手上路 帖子:2 积分:15 威望:0 精华:0 注册:2013/4/5 19:52:04
请求老师帮忙检查完善一下程序  发帖心情 Post By:2013/4/5 20:01:19    Post IP:61.171.22.45[只看该作者]

我参照别人的程序写了个简单股指期货日内交易程序,但是还是有问题,请老师帮忙指导,检查改正下错误,谢谢。

 

策略:9:15分钟股指期货开盘,以1分钟为K线,到9:30分钟,判断这前15分钟的最高价与最低价,9:30分01秒起,若当前价高于最高价则开盘,若低于最低价则开空,止损8点(40个价位),止赢20点(100个价位),每天只开仓一次,也就是开盘了就不再开空,反之也是。15:00钟,如还有持仓,则平,如无持仓,也结束一切交易(也就是如果前面没有达到开仓条件也不再开仓)。

 

下面是参照别人的改的,请老师指正,谢谢。

 

input:n(2,1,100);
 variable:n1=0;//计算次数
M:=BARSLAST(DATE<>REF(DATE,1))+1;
zuigao:valuewhen(time<=093000,hhv(h,M));//前15分钟最高价
zuidi:valuewhen(time<=093000,llv(l,M));//前15分钟最高价

if h>zuigao and M>15 and n1=0 and time<151500 then begin
  buy(holding=0,1,market);
  n1:=1;
 end

if l<zuidi and M>15 and n1=0 and time<151500 then begin
  buyshort(holding=0,1,market);
  n1:=1;
 end

if c-enterprice>=8 and holding<0 then sellshort(holding<0,0,market);

if enterprice-c>=8 and holding>0 then sell(holding>0,0,market);//止损

if c-enterprice>=20 and holding>0 then sell(holding>0,0,market);

if enterprice-c>=20 and holding<0 then sellshort(holding<0,0,market);//止盈

if time>=150000 then begin
  sell(holding>0,0,market);
  sellshort(holding<0,0,market);
  n1:=0;
 end

if datatype<>1 then exit;

 


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


加好友 发短信
等级:新手上路 帖子:2 积分:15 威望:0 精华:0 注册:2013/4/5 19:52:04
  发帖心情 Post By:2013/4/5 21:06:27    Post IP:61.171.22.45[只看该作者]

我重新改动了一下,感觉基本可以用了。但测试当日时,不知为何赢利可达7220元(我是止赢20个点,6000元),亏抽也是3440元(我是止损8个点,2400元),不知为何有这样大的相差。改动如下,请老师指正,谢谢:

 

input:ss(1,1,100,1);//交易手数
 variable:n1=0;//计算次数
N:=BARSLAST(DATE<>REF(DATE,1))+1;
HH:valuewhen(time<=093000,hhv(h,N));//前15分钟最高价
LL:valuewhen(time<=093000,llv(l,N));//前15分钟最高价

if h>HH and time>093000 and n1=0 and time<150000 then begin
  buy(holding=0,ss,market);
  n1:=1;
 end

if l<LL and time>093000 and n1=0 and time<150000 then begin
  buyshort(holding=0,ss,market);
  n1:=1;
 end

if c-enterprice>=8 and holding<0 then sellshort(holding<0,0,market);

if enterprice-c>=8 and holding>0 then sell(holding>0,0,market);//止损

if c-enterprice>=20 and holding>0 then sell(holding>0,0,market);

if enterprice-c>=20 and holding<0 then sellshort(holding<0,0,market);//止盈

if time>=150000 then begin
  sell(holding>0,0,market);
  sellshort(holding<0,0,market);
  n1:=0;
 end

if datatype<>1 then exit;

 


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


加好友 发短信
等级:罗宾汉 帖子:11808 积分:20695 威望:0 精华:10 注册:2009/8/18 8:15:13
  发帖心情 Post By:2013/4/5 22:47:46    Post IP:61.174.53.126[只看该作者]

这种图表交易用的是K线中的价格,不会那么精确的。

如果你需要尽可能的精确的数据,那么就因该使用更小的周期进行测试



金字塔—专业程序化软件提供商

金字塔-技术部

-----------------------------------------------------------------------------------------------------

工作时间:周一至周五 08:30 - 17:30   周末及法定节假日休息

Email:service@weistock.com
 回到顶部