以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- [求助] (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=80425) |
-- 作者:冷锋566 -- 发布时间:2015/7/3 20:22:06 -- [求助] 当一个条件成立后开仓,后面的条件再成立则不再开仓???谢谢! 比如下面的如何修改 /引用kdj的数值; k:"kdj.k"; d:"kdj.d"; //建立多头条件 long:k>65; if long then begin sellshort(holding<0,0,thisclose); buy(long,1,thisclose); end //建立空头条件 short:k<50; if short then begin sell(holding>0,0,thisclose); buyshort(short,1,thisclose); end |
-- 作者:jinzhe -- 发布时间:2015/7/6 8:47:51 -- k:"kdj.k";
d:"kdj.d";
//建立多头条件
long:k>65;
variable:duo=0,kong=0;
if long then
begin
sellshort(holding<0,0,thisclose);
if holding=0 and long and duo=0 then begin
buy(long,1,thisclose);
duo:=1;
kong:=0;
end
end
//建立空头条件
short:k<50;
if short then
begin
sell(holding>0,0,thisclose);
if holding=0 and short and kong=0 then begin
buyshort(short,1,thisclose);
kong:=1;
duo:=0;
end
end
|