以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  请教老师!!!!  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=89023)

--  作者:BB2015
--  发布时间:2015/12/30 12:23:24
--  请教老师!!!!
问题1.
        日盘:止损2次不再开仓,止盈1次不再开仓,收盘前提前一根K线平仓;
        夜盘:止损2次不再开仓,止盈1次不再开仓,收盘前提前一根K线平仓;
问题2.
       如果品种为橡胶   参数M=8,品种为白糖   参数M=6,品种为甲醇   参数M=3;

请问老师如何表达??O(∩_∩)O谢谢

--  作者:jinzhe
--  发布时间:2015/12/30 13:28:38
--  
1.根据需求要这样写,必须在止盈止损语句里面加上全局变量计算

variable:dy=0,ds=0;
variable:yy=0,ys=0;

if 多头止损条件 and holding>0   then begin
 sell(1,0,market);
 if time>010000 and time<=063000 then ys:=ys+1;
 if time>130000 and time<=190000 then ds:=ds+1;
end

if 空头止损条件 and holding<0   then begin
 sellshort(1,0,market);
 if time>010000 and time<=063000 then ys:=ys+1;
 if time>130000 and time<=190000 then ds:=ds+1;
end

if 多头止赢条件 and holding>0   then begin
 sell(1,0,market);
 if time>010000 and time<=063000 then yy:=yy+1;
 if time>130000 and time<=190000 then dy:=dy+1;
end

if 空头止赢条件 and holding<0   then begin
 sellshort(1,0,market);
 if time>010000 and time<=063000 then yy:=yy+1;
 if time>130000 and time<=190000 then dy:=dy+1;
end

if time=closetime(1) then begin
 yy:=0;
 ys:=0;
end

if time=closetime(0) then BEGIN
    dy:=0;
    ds:=0;
end

 

 

需要在开仓条件里面加上 (ds<2 or ys<2 or dy<1 or dy<1)

 

 

2.

nn:=STRLEN(stklabel);
ss:=strleft(stklabel,nn-2);


if stricmp(ss,\'rb\')=0 then m:=8;
if stricmp(ss,\'srx\')=0 then m:=6;
if stricmp(ss,\'ma\')=0 then m:=8;


--  作者:BB2015
--  发布时间:2015/12/30 13:31:53
--  
谢谢,老师辛苦!!