以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 请老师帮个忙、、、、 (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=86525) |
|
-- 作者:么么 -- 发布时间:2015/10/22 23:28:24 -- 请老师帮个忙、、、、 GLOBALVARIABLE:n=0,m=1; GLOBALVARIABLE:tt=0; c1:=VALUEWHEN(todaybar=1,c); if c>c1 then tbuy(1,1,mkt); if m=n+1 and c>=c1-10*(n+1) and c<c1-10*n and todaybar<>tt then begin tbuy(1,10*n,mkt); n:=n+1; m:=m+1; tt:=time; end PD:=(DYNAINFO(7)-TAVGENTERPRICEEX2(\'\',\'\',0))*TBUYHOLDING(1)*DYNAINFO(209)>500; 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 PD THEN tsell(1,TbuyHOLDING(1),mkt); if PK THEN tsellshort(1,TSELLHOLDING(1),mkt); 请老师把我红色的部分改成低于第一根K线10个点买5手,30个点买20手,60个点买30手。这个策略和这整套策略配合一起,融合成一个策略,谢谢
|
|
-- 作者:么么 -- 发布时间:2015/10/23 8:34:34 -- 修改:“请老师把我红色的部分改成低于第一根K线10个点买5手,30个点买20手,60个点买30手。这个策略和这整套策略配合一起,融合成一个策略,谢谢”这句话改成低于当日开盘价。谢谢 |
|
-- 作者:jinzhe -- 发布时间:2015/10/23 8:57:51 -- GLOBALVARIABLE:n1=0,n2=0,n3=0;
GLOBALVARIABLE:tt1=0,tt2=0,tt3=0;
oo:=VALUEWHEN(todaybar=1,o);
if c>oo+10 and n1=0 and tt1<>time then begin
tbuy(1,5,mkt);
n1:=1;
tt1:=TIME;
END
if c>oo+30 and n2=0 and tt2<>time then begin
tbuy(1,20,mkt);
n2:=1;
tt2:=TIME;
END
if c>oo+60 and n3=0 and tt3<>time then begin
tbuy(1,30,mkt);
n3:=1;
tt3:=time;
end
PD:=(DYNAINFO(7)-TAVGENTERPRICEEX2(\'\',\'\',0))*TBUYHOLDING(1)*DYNAINFO(209)>500;
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 PD and tbuyholding(1)>0 THEN begin
tsell(1,TbuyHOLDING(1),mkt);
n1:=0;n2:=0;n3:=0;
tt1:=0;tt2:=0;tt3:=0;
end
|
|
-- 作者:么么 -- 发布时间:2015/10/23 9:08:33 -- 那如果是相反,就是: GLOBALVARIABLE:n=0,m=1; GLOBALVARIABLE:tt=0; c1:=VALUEWHEN(todaybar=1,c); if c<c1 then tbuyshort(1,1,mkt); GLOBALVARIABLE:n1=0,n2=0,n3=0; GLOBALVARIABLE:tt1=0,tt2=0,tt3=0; oo:=VALUEWHEN(todaybar=1,o); if c<oo-30 and n1=0 and tt1<>time then begin TBUYSHORT((1,10,mkt); n1:=1; tt1:=TIME; END if c<oo-60 and n2=0 and tt2<>time then begin TBUYSHORT(1,20,mkt); n2:=1; tt2:=TIME; END if c<oo-80 and n3=0 and tt3<>time then begin TBUYSHORT(1,30,mkt); n3:=1; tt3:=time; end PK:=(TAVGENTERPRICEEX2(\'\',\'\',1)-DYNAINFO(7))*TSELLHOLDING(1)>500; debugfile(\'D:\\test.txt\',\'当前盈亏为%.2f\',TOPENPROFIT); 盈亏:=(DYNAINFO(7)-TAVGENTERPRICEEX2(\'\',\'\',0))*TBUYHOLDING(1)*DYNAINFO(209); debugfile(\'D:\\test2.txt\',\'当前盈亏为%.2f\',盈亏); if PK THEN tsellshort(1,TSELLHOLDING(1),mkt); 是吗?老师???
|
|
-- 作者:么么 -- 发布时间:2015/10/23 9:13:41 -- 补充:大于开盘价30个点就卖10手??? |
|
-- 作者:jinzhe -- 发布时间:2015/10/23 9:24:14 -- 以下是引用jinzhe在2015/10/23 8:57:51的发言:
GLOBALVARIABLE:n1=0,n2=0,n3=0;
GLOBALVARIABLE:tt1=0,tt2=0,tt3=0;
oo:=VALUEWHEN(todaybar=1,o);
if c>oo+10 and n1=0 and tt1<>time then begin
tbuy(1,5,mkt);
n1:=1;
tt1:=TIME;
END
if c>oo+30 and n2=0 and tt2<>time then begin
tbuy(1,20,mkt);
n2:=1;
tt2:=TIME;
END
if c>oo+60 and n3=0 and tt3<>time then begin
tbuy(1,30,mkt);
n3:=1;
tt3:=time;
end
PD:=(DYNAINFO(7)-TAVGENTERPRICEEX2(\'\',\'\',0))*TBUYHOLDING(1)*DYNAINFO(209)>500;
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 PD and tbuyholding(1)>0 THEN begin
tsell(1,TbuyHOLDING(1),mkt);
n1:=0;n2:=0;n3:=0;
tt1:=0;tt2:=0;tt3:=0;
end
这里大小判断写错了,把c>oo+10 ,c>oo+30 ,c>oo+60都改成小于 |
|
-- 作者:jinzhe -- 发布时间:2015/10/23 9:24:41 -- 不是,你抄错了,多谢了一段开仓 |
|
-- 作者:么么 -- 发布时间:2015/10/23 10:32:43 -- GLOBALVARIABLE:n=0,m=1; GLOBALVARIABLE:tt=0; c1:=VALUEWHEN(todaybar=1,c); if c>c1 then
tbuy(1,1,mkt);
GLOBALVARIABLE:n1=0,n2=0,n3=0; GLOBALVARIABLE:tt1=0,tt2=0,tt3=0; oo:=VALUEWHEN(todaybar=1,o); if c<oo-20 and n1=0 and tt1<>time then begin tbuy(1,10,mkt); n1:=1; tt1:=TIME; END if c<oo-30 and n2=0 and tt2<>time then begin tbuy(1,20,mkt); n2:=1; tt2:=TIME; END if c<oo-60 and n3=0 and tt3<>time then begin tbuy(1,30,mkt); n3:=1; tt3:=time; end
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 THEN tsell(1,TbuyHOLDING(1),mkt); 老师,我这样改了行不行,后面改成逆势加仓的??? |
|
-- 作者:jinzhe -- 发布时间:2015/10/23 10:34:12 -- GLOBALVARIABLE:n1=0,n2=0,n3=0; GLOBALVARIABLE:tt1=0,tt2=0,tt3=0; oo:=VALUEWHEN(todaybar=1,o); if c>oo+20 and c<=oo+30 and n1=0 and tt1<>time then begin tbuy(1,10,mkt); n1:=1; tt1:=TIME; END if c>oo+30 and c<=oo+60 and n2=0 and tt2<>time then begin tbuy(1,20,mkt); n2:=1; tt2:=TIME; END if c>oo+60 and n3=0 and tt3<>time then begin tbuy(1,30,mkt); n3:=1; tt3:=time; end
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 THEN tsell(1,TbuyHOLDING(1),mkt); [此贴子已经被作者于2015/10/23 10:34:56编辑过]
|
|
-- 作者:jinzhe -- 发布时间:2015/10/23 10:35:32 -- GLOBALVARIABLE:n1=0,n2=0,n3=0;
GLOBALVARIABLE:tt1=0,tt2=0,tt3=0;
oo:=VALUEWHEN(todaybar=1,o);
if c<oo-10 and c>=oo-30 and n1=0 and tt1<>time then begin
tbuy(1,5,mkt);
n1:=1;
tt1:=TIME;
END
if c<oo-30 and c<=oo-60 and n2=0 and tt2<>time then begin
tbuy(1,20,mkt);
n2:=1;
tt2:=TIME;
END
if c<oo-60 and n3=0 and tt3<>time then begin
tbuy(1,30,mkt);
n3:=1;
tt3:=time;
end
PD:=(DYNAINFO(7)-TAVGENTERPRICEEX2(\'\',\'\',0))*TBUYHOLDING(1)*DYNAINFO(209)>500;
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 PD and tbuyholding(1)>0 THEN begin
tsell(1,TbuyHOLDING(1),mkt);
n1:=0;n2:=0;n3:=0;
tt1:=0;tt2:=0;tt3:=0;
end
[此贴子已经被作者于2015/10/23 10:36:00编辑过]
|