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


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

   

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


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

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

帅哥哟,离线,有人找我吗?
fly
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | 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

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


加好友 发短信
等级:管理员 帖子:5082 积分:17642 威望:0 精华:6 注册:2010/7/15 9:05:58
  发帖心情 Post By:2011/11/28 10:59:55 [显示全部帖子]

上次写的总共也就没限定最多开仓32手.

还请您仔细看看,策略本身就是没有单子的时候才开仓.策略本身也限定了,只当天满足止损平仓翻倍,第2天重新又从1手开始开起.

该策略本身就是个可执行的策略,直接加载该策略在合约1分钟K线上,本地已经调试跟踪过.一切正常.

 

大体思路就是使用全局变量,您不满意之处,请自行修改

//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);
if buynum<16 then buynum:=2*buynum;
else buynum:=32;
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);
if sellnum<16 then sellnum:=2*sellnum;
else sellnum:=32;
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

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


加好友 发短信
等级:管理员 帖子:5082 积分:17642 威望:0 精华:6 注册:2010/7/15 9:05:58
  发帖心情 Post By:2011/11/28 15:04:43 [显示全部帖子]

//5分钟K线
variable:buynum=1,sellnum=1;//控制开多和开空的数量

 

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


long:=cross(ma5,ma20) and time>090500 and time<145500;
short:=cross(ma20,ma5) and time>090500 and time<145500;

 

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);
if buynum<16 then buynum:=2*buynum;
else buynum:=32;
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);
if sellnum<16 then sellnum:=2*sellnum;
else sellnum:=32;
end

 

//收盘前平仓
if time>=145500 then
begin
 sell(holding>0,0,thisclose);
 sellshort(holding<0,0,thisclose);
end



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

客户服务部

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

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

service@weistock.com

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

 回到顶部