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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 关于开仓

   

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


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

主题:关于开仓

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


加好友 发短信
等级:论坛游民 帖子:270 积分:0 威望:0 精华:0 注册:2015/10/11 9:07:21
关于开仓  发帖心情 Post By:2015/11/19 14:18:30    Post IP:124.152.32.98[只看该作者]

老师,我的策略怎么1个周期内开多次仓??
源码:

GLOBALVARIABLE:n1=0,n2=0,n3=0;

GLOBALVARIABLE:tt1=0,tt2=0,tt3=0;

oo:=VALUEWHEN(todaybar=1,o);

 

if l<open-20*mindiff and n1=0 and time<>tt1  then begin

   tbuy(1,11,mkt);

   n1:=1;

   tt1:=time;

end

 

if c<oo-60*mindiff and n2=0 and time<>tt2 then begin

 tbuy(1,22,mkt);

 n2:=1;

 tt2=TIME;

END

 

if c<oo-80*mindiff and n3=0 and time<>tt3 then begin

tbuy(1,44,mkt);

n3:=1;

tt3=time;

end

if time=closetime(0) then begin

n1:=0;

n2:=0;

n3:=0;

tt1:=0;

tt2:=0;

tt3:=0;

end

GLOBALVARIABLE:num=0;

PD:=(DYNAINFO(7)-TAVGENTERPRICEEX2('','',0))*TBUYHOLDING(1)*DYNAINFO(209)>500;

debugfile('D:\test.txt','当前盈亏为%.2f',TOPENPROFIT);

盈亏:=(DYNAINFO(7)-TAVGENTERPRICEEX2('','',0))*TBUYHOLDING(1)*DYNAINFO(209);

debugfile('D:\test2.txt','当前盈亏为%.2f',盈亏);

if PD  and tbuyholding(1)>0 and num=0 THEN begin

tsell(1,TbuyHOLDING(1)/3,mkt);

num:=1;

end

PD2:=(DYNAINFO(7)-TAVGENTERPRICEEX2('','',0))*TBUYHOLDING(1)*DYNAINFO(209)>1000;

if PD2  and tbuyholding(1)>0 and num=1 THEN begin

tsell(1,TbuyHOLDING(1)/3,mkt);

num:=2;

end

 

PD3:=(DYNAINFO(7)-TAVGENTERPRICEEX2('','',0))*TBUYHOLDING(1)*DYNAINFO(209)>2000;

if PD3  and tbuyholding(1)>0  THEN begin

tsell(1,TbuyHOLDING(1),mkt);

end

4.逆势加仓(空)

GLOBALVARIABLE:n1=0,n2=0,n3=0;

GLOBALVARIABLE:tt1=0,tt2=0,tt3=0;

oo:=VALUEWHEN(todaybar=1,o);

 

if c>oo+20*DYNAINFO(208)and n1=0 and time>tt1+15 then begin

    TBUYSHORT(1,11,mkt);

    n1:=1;

    tt1>TIME;

END

 

 

if c>oo+40*DYNAINFO(208) and n2=0 and time>tt2+15 then begin

   TBUYSHORT(1,22,mkt);

    n2:=1;

    tt2>TIME;

END

 

if c>oo+80*DYNAINFO(208) and n3=0 and time>tt3+15 then begin

   TBUYSHORT(1,44,mkt);

   n3:=1;

   tt3>time;

end

 

GLOBALVARIABLE:num=0;

PK:=(TAVGENTERPRICEEX2('','',1)-DYNAINFO(7))*TSELLHOLDING(1)*DYNAINFO(209)>500;

debugfile('D:\test.txt','当前盈亏为%.2f',TOPENPROFIT);

盈亏:=(DYNAINFO(7)-TAVGENTERPRICEEX2('','',0))*TBUYHOLDING(1)*DYNAINFO(209);

debugfile('D:\test2.txt','当前盈亏为%.2f',盈亏);

if PK  and TSELLHOLDING(1)>0 and num=0 THEN begin

tsellshort(1,TSELLHOLDING(1)/3,mkt);

num:=1;

end

 

PK2:=(TAVGENTERPRICEEX2('','',1)-DYNAINFO(7))*TSELLHOLDING(1)*DYNAINFO(209)>1000;

if PK2  and TSELLHOLDING(1)>0 and num=1 THEN begin

tsellshort(1,TSELLHOLDING(1)/3,mkt);

num:=2;

end

 

PK3:=(TAVGENTERPRICEEX2('','',1)-DYNAINFO(7))*TSELLHOLDING(1)*DYNAINFO(209)>2000;

if PK3  and TSELLHOLDING(1)>0  THEN begin

tsellshort(1,TSELLHOLDING(1),mkt);

end

 


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


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

if c>oo+20*DYNAINFO(208)and n1=0 and time>tt1+15 then begin

    TBUYSHORT(1,11,mkt);

    n1:=1;

    tt1>TIME;

END



if c>oo+40*DYNAINFO(208) and n2=0 and time>tt2+15 then begin

   TBUYSHORT(1,22,mkt);

    n2:=1;

    tt2>TIME;

END


if c>oo+80*DYNAINFO(208) and n3=0 and time>tt3+15 then begin

   TBUYSHORT(1,44,mkt);

   n3:=1;

   tt3>time;

end


里面的 tt1>TIME;这类的语句意义不明,改成tt1:=time;tt2:=time;tt3:=time;


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

客户服务部

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

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

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


加好友 发短信
等级:论坛游民 帖子:270 积分:0 威望:0 精华:0 注册:2015/10/11 9:07:21
  发帖心情 Post By:2015/11/19 14:37:23    Post IP:124.152.32.98[只看该作者]

我把GLOBALVARIABLE改成EXTGBDATA可以吗??


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


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

可以,但是修改之后此类全局变量是所有公式都能用的,而不是仅限于当前的策略;

 

赋值方法:

if c>o then extgbdataset('tt1',time);//当c>O时把time赋值给tt1

 

取值方法:

ss:=extgbdata('tt1');//获取tt1的值,并赋值给ss

[此贴子已经被作者于2015/11/19 14:41:59编辑过]


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

客户服务部

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

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

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


加好友 发短信
等级:论坛游民 帖子:270 积分:0 威望:0 精华:0 注册:2015/10/11 9:07:21
  发帖心情 Post By:2015/11/19 14:49:34    Post IP:124.152.32.98[只看该作者]

不会啊,老师,怎么修改???

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


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

举个例子:

if l<open-20*mindiff and n1=0 and time<>tt1  then begin

   tbuy(1,11,mkt);

   n1:=1;

   tt1:=time;

end

改成

if l<open-20*mindiff and extgbdata('n1')=0 and time<>extgbdata('tt1')  then begin

   tbuy(1,11,mkt);

   extgbdataset('n1',1);

   extgbdataset('tt1',time);

end



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

客户服务部

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

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

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


加好友 发短信
等级:论坛游民 帖子:270 积分:0 威望:0 精华:0 注册:2015/10/11 9:07:21
  发帖心情 Post By:2015/11/19 16:48:55    Post IP:124.152.32.98[只看该作者]

oo:=VALUEWHEN(todaybar=1,o);
ma60:=ma(c,60);
 
if c>oo+2*mindiff and c>ma60  and extgbdata('num1')=0 then begin
tbuy(1,25,mkt);
extgbdataset('num1',1);
END
 

if c>oo+4*mindiff and c>ma60 and extgbdata('num2')=0 and tenterbars>1 then begin
tbuy(1,24,mkt);
extgbdataset('num2',1);
END
 
if c>oo+6*mindiff and c>ma60 and extgbdata('num3')=0 and tenterbars>1 then begin 
tbuy(1,23,mkt);
extgbdataset('num3',1);
end

if c>oo+8*mindiff and c>ma60 and extgbdata('num4')=0 and tenterbars>1 then begin 
tbuy(1,22,mkt);
extgbdataset('num4',1);
end

if c>oo+10*mindiff and c>ma60 and extgbdata('num5')=0 and tenterbars>1 then begin 
tbuy(1,21,mkt);
extgbdataset('num5',1);
end

if c>oo+12*mindiff and c>ma60 and extgbdata('num6')=0 and tenterbars>1 then begin 
tbuy(1,20,mkt);
extgbdataset('num6',1);
end
if c>oo+14*mindiff and c>ma60 and extgbdata('num7')=0 and tenterbars>1 then begin 
tbuy(1,19,mkt);
extgbdataset('num7',1);
end

if c>oo+16*mindiff and c>ma60 and extgbdata('num8')=0 and tenterbars>1 then begin 
tbuy(1,18,mkt);
extgbdataset('num8',1);
end

if c>oo+18*mindiff and c>ma60 and extgbdata('num9')=0 and tenterbars>1 then begin 
extgbdataset('num9',1);
tt9:=time;
end

if c>oo+20*mindiff and c>ma60 and extgbdata('num10')=0 and tenterbars>1 then begin 
tbuy(1,16,mkt);
extgbdataset('num10',1);
end

if c>oo+22*mindiff and c>ma60 and extgbdata('num11')=0 and tenterbars>1 then begin 
tbuy(1,15,mkt);
extgbdataset('num11',1);
end

if c>oo+24*mindiff and c>ma60 and extgbdata('num12')=0 and tenterbars>1 then begin 
tbuy(1,14,mkt);
extgbdataset('num12',1);
end

if c>oo+26*mindiff and c>ma60 and extgbdata('num13')=0 and tenterbars>1 then begin 
tbuy(1,13,mkt);
extgbdataset('num13',1);
end

if c>oo+28*mindiff and c>ma60 and extgbdata('num14')=0 and tenterbars>1 then begin 
tbuy(1,12,mkt);
extgbdataset('num14',1);
end

if c>oo+30*mindiff and c>ma60 and extgbdata('num15')=0 and tenterbars>1 then begin 
tbuy(1,11,mkt);
extgbdataset('num15',1);
end
if c>oo+32*mindiff and c>ma60 and extgbdata('num16')=0 and tenterbars>1 then begin 
tbuy(1,10,mkt);
extgbdataset('num16',1);
end

if c>oo+34*mindiff and c>ma60 and extgbdata('num17')=0 and tenterbars>1 then begin 
tbuy(1,9,mkt);
extgbdataset('num17',1);
end

if c>oo+36*mindiff and c>ma60 and extgbdata('num18')=0 and tenterbars>1 then begin 
tbuy(1,8,mkt);
extgbdataset('num18',1);
end

if c>oo+38*mindiff and c>ma60 and extgbdata('num19')=0 and tenterbars>1 then begin 
tbuy(1,7,mkt);
extgbdataset('num19',1);
end

if c>oo+40*mindiff and c>ma60 and extgbdata('num20')=0 and tenterbars>1 then begin 
tbuy(1,6,mkt);
extgbdataset('num20',1);
end

if c>oo+42*mindiff and c>ma60 and extgbdata('num21')=0 and tenterbars>1 then begin 
tbuy(1,5,mkt);
extgbdataset('num21',1);
end

if c>oo+44*mindiff and c>ma60 and extgbdata('num22')=0 and tenterbars>1 then begin 
tbuy(1,4,mkt);
extgbdataset('num22',1);
end

if c>oo+46*mindiff and c>ma60 and extgbdata('num23')=0 and tenterbars>1 then begin 
tbuy(1,3,mkt);
extgbdataset('num23',1);
end

if c>oo+48*mindiff and c>ma60 and extgbdata('num24')=0 and tenterbars>1 then begin 
tbuy(1,2,mkt);
extgbdataset('num24',1);
end

if c>oo+50*mindiff and c>ma60 and extgbdata('num25')=0 and tenterbars>1 then begin 
tbuy(1,1,mkt);
extgbdataset('num25',1);
end


if DYNAINFO(207)=closetime(0) and tenterbars>0 then begin
    extgbdataset('num1',0);
    extgbdataset('num2',0);
    extgbdataset('num3',0);
    extgbdataset('num4',0);
    extgbdataset('num5',0);
    extgbdataset('num6',0);
    extgbdataset('num7',0);
    extgbdataset('num8',0);
    extgbdataset('num9',0);
    extgbdataset('num10',0);
    extgbdataset('num11',0);
    extgbdataset('num12',0);
    extgbdataset('num13',0);
    extgbdataset('num14',0);
    extgbdataset('num15',0);
    extgbdataset('num16',0);
    extgbdataset('num17',0);
    extgbdataset('num18',0);
    extgbdataset('num19',0);
    extgbdataset('num20',0);
    extgbdataset('num21',0);
    extgbdataset('num22',0);
    extgbdataset('num23',0);
    extgbdataset('num24',0);
    extgbdataset('num25',0);
 end
GLOBALVARIABLE:num=0;
PD:=(DYNAINFO(7)-TAVGENTERPRICEEX2('','',0))*TBUYHOLDING(1)*DYNAINFO(209)>500;
debugfile('D:\test.txt','当前盈亏为%.2f',TOPENPROFIT);
盈亏:=(DYNAINFO(7)-TAVGENTERPRICEEX2('','',0))*TBUYHOLDING(1)*DYNAINFO(209);
debugfile('D:\test2.txt','当前盈亏为%.2f',盈亏);
if PD  and tbuyholding(1)>0 and num=0 THEN begin
tsell(1,10,mkt);
num:=1;
end
PD2:=(DYNAINFO(7)-TAVGENTERPRICEEX2('','',0))*TBUYHOLDING(1)*DYNAINFO(209)>1000;
if PD2  and tbuyholding(1)>0 and num=1 THEN begin
tsell(1,20,mkt);
num:=2;
end

PD3:=(DYNAINFO(7)-TAVGENTERPRICEEX2('','',0))*TBUYHOLDING(1)*DYNAINFO(209)>2000;
if PD3  and tbuyholding(1)>0 THEN begin
tsell(1,TbuyHOLDING(1),mkt);
end



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


加好友 发短信
等级:论坛游民 帖子:270 积分:0 威望:0 精华:0 注册:2015/10/11 9:07:21
  发帖心情 Post By:2015/11/19 16:49:15    Post IP:124.152.32.98[只看该作者]

老师,你看一下正确不????

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


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

不对,少了time和tt的判断,


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

客户服务部

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

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

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


加好友 发短信
等级:论坛游民 帖子:270 积分:0 威望:0 精华:0 注册:2015/10/11 9:07:21
  发帖心情 Post By:2015/11/19 17:11:37    Post IP:124.152.32.98[只看该作者]

图片点击可在新窗口打开查看

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