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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件策略编写求助区 → 请老师帮忙编一个模型

   

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


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

主题:请老师帮忙编一个模型

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


加好友 发短信
等级:新手上路 帖子:10 积分:23 威望:0 精华:0 注册:2011/11/19 10:03:09
请老师帮忙编一个模型  发帖心情 Post By:2011/11/24 21:28:07 [只看该作者]

1、开仓(A,开多;B,开空;有持仓条件成立也不开仓、前面平仓是止损平仓时开仓手数是亏损仓位的2倍、最多仓位开到32手、是盈利平仓时就开1手,)。

2、平仓(止损止盈平仓,10点止损30点止盈,收盘平仓1458时间平仓)。

3、要可以全自动交易。

  谢谢!


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


加好友 发短信
等级:黑侠 帖子:676 积分:2548 威望:0 精华:3 注册:2011/4/13 16:18:50
  发帖心情 Post By:2011/11/25 8:26:07 [只看该作者]

开仓条件是什么?


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


加好友 发短信
等级:新手上路 帖子:10 积分:23 威望:0 精华:0 注册:2011/11/19 10:03:09
  发帖心情 Post By:2011/11/25 8:49:51 [只看该作者]

开仓条件就是A与B,我自己会编,我就是要学会怎样编后面的源码


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


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

前面平仓是止损平仓时开仓手数是亏损仓位的2倍、最多仓位开到32手、是盈利平仓时就开1手

这句话能否详细的讲解一下,不明白



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

客户服务部

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

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

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


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

td:= (time>=090000 and time<=145800);
variable:aa=1,bb=1;

if A and td then buy(holding=0,1,thisclose);

if B and td then buyshort(holding=0,1,thisclose);

//止损止盈平仓,10点止损30点止盈

if c-enterprice >=30 or enterprice-c>=10 then
  sell(holding>0,0,thisclose);
 


if enterprice-c>=30 or c-enterprice>=10 then 
 sellshort(holding<0,0,thisclose);
 

if numprofit(1)>0 and A and td then buy(holding=0,1,thisclose);

if numprofit(1)>0 and B and td then buyshort(holding=0,1,thisclose);

if numprofit(1)<0 and A and td and aa<=32 then begin
 buy(holding=0,aa,thisclose);
 aa:=aa*2;
end

if numprofit(1)<0 and b and td and bb<=32 then begin
 buyshort(holding=0,bb,thisclose);
 bb:=bb*2;
end

if time>145800 then begin
 sell(holding>0,0,thisclose);
  sellshort(holding<0,0,thisclose);
 end
 
 if time>=150000 then begin
  aa:=1;
  bb:=1;
 end



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

客户服务部

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

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

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


加好友 发短信
等级:新手上路 帖子:10 积分:23 威望:0 精华:0 注册:2011/11/19 10:03:09
  发帖心情 Post By:2011/11/25 12:50:30 [只看该作者]

我加载试试,(前面一次平仓如果是亏损平仓,接下来的开仓就是前面平仓手数的2倍,如果是盈利平仓,接下来的开仓就是1手)。


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


加好友 发短信
等级:新手上路 帖子:10 积分:23 威望:0 精华:0 注册:2011/11/19 10:03:09
  发帖心情 Post By:2011/11/25 13:05:31 [只看该作者]

模型与我的要求不一致。模型每次开仓都是1手,我要的是前面亏损平仓,接下来就开前面仓位的2倍,直到32手。前面盈利平仓就回到1手开仓


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


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

不好意思,上面写得逻辑不够严密,刚改了下,再试试

 

variable:aa=2,bb=2,cc=0,dd=0;
td:= (time>=090000 and time<=145800);
if A and td and cc=0 then begin
buy(holding=0,1,thisclose);
cc:=1;
end

if B and td and dd=0 then  begin
buyshort(holding=0,1,thisclose);
dd:=1;
end

//止损止盈平仓,10点止损30点止盈

if c-enterprice >=30 or enterprice-c>=10 then
  sell(holding>0,0,thisclose);
 


if enterprice-c>=30 or c-enterprice>=10 then 
 sellshort(holding<0,0,thisclose);
 

if numprofit(1)>0 and A and td and cc=1 then buy(holding=0,1,thisclose);

if numprofit(1)>0 and B and td and dd=1 then buyshort(holding=0,1,thisclose);

if numprofit(1)<0 and A and td and aa<=32 and cc=1 then begin
 buy(holding=0,aa,thisclose);
 aa:=aa*2;
end

if numprofit(1)<0 and b and td and bb<=32 and dd=1then begin
 buyshort(holding=0,bb,thisclose);
 bb:=bb*2;
end

if time>145800 then begin
 sell(holding>0,0,thisclose);
  sellshort(holding<0,0,thisclose);
 end
 
 if time>=150000 then begin
  aa:=2;
  bb:=2;
  cc:=0;
  dd:=0;
 end



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

客户服务部

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

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

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


加好友 发短信
等级:管理员 帖子:5082 积分:17642 威望:0 精华:6 注册:2010/7/15 9:05:58
  发帖心情 Post By:2011/11/25 14:32:19 [只看该作者]

//1分钟K线

variable:buynum=1,sellnum=1;//控制开多和开空的数量


ma5:ma(close,5);
ma20:ma(close,20);


long:=cross(ma5,ma20) and time>090100 and time<145800;
short:=cross(ma20,ma5) and time>090100 and time<145800;

 

if long and holding=0 then buy(1,buynum,thisclose);

 

//止损止盈平仓,10个最小变动价位止损,30个最小变动价位止损止盈
if c>enterprice+30*mindiff and holding>0 and enterbars>2 then
begin
多赢:sell(1,0,thisclose);
buynum:=1;
end
if c<enterprice-10*mindiff and holding>0 and enterbars>2 then
begin
多损:sell(1,0,thisclose);
buynum:=2*buynum;
end

 

if short and holding=0 then buyshort(1,sellnum,thisclose);


if c<enterprice-30*mindiff and holding<0 and enterbars>2 then
begin
空赢:sellshort(1,0,thisclose);
sellnum:=1;
end
if c>enterprice+10*mindiff and holding<0 and enterbars>2 then
begin
空损:sellshort(1,0,thisclose);
sellnum:=2*sellnum;
end


if time>=145800 then
begin
 sell(holding>0,0,thisclose);
 sellshort(holding<0,0,thisclose);
end
 
 if time>=150000 then
 begin
  buynum:=1;
  sellnum:=1;
 end



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

客户服务部

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

欢迎您参加我公司的技术培训,具体培训需求请发邮件到

service@weistock.com

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

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


加好友 发短信
等级:新手上路 帖子:10 积分:23 威望:0 精华:0 注册:2011/11/19 10:03:09
  发帖心情 Post By:2011/11/25 16:05:09 [只看该作者]

还是不对,下面一种就开到2手,又回到1手了


 回到顶部
总数 19 1 2 下一页