以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 这样的程序怎么写? (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=79263) |
-- 作者:gzarmstrong -- 发布时间:2015/6/1 21:27:24 -- 这样的程序怎么写? BUY(开多, 1, thisclose); SELL(平多, 1, thisclose); BUYSHORT(开空, 1, thisclose); SELLSHORT(平空, 1, thisclose); 有以上的程序,需要增加下面的思路 平多或者平空以后,判断盈利超过50点,那么后面的3个开多或开空条件成立,也不开仓。 请问这样如何写程序?
|
-- 作者:jinzhe -- 发布时间:2015/6/2 9:02:07 -- variable:bj=0; variable:yl=0; if 开多 and holding=0 and bj=0 then begin BUY(开多, 1, thisclose); bj:=1; end if 开多 and holding=0 and bj=0 then begin
BUYSHORT(开空, 1, thisclose);
bj:=1;
end
if yl=0 and holding<0 and 平空 then begin
SELLSHORT(平空, 1, thisclose);
if numprofit(1)>50 then yl:=1;
end
if yl=0 and holding>0 and 平多 then begin
SELL(平多, 1, thisclose);
if numprofit(1)>50 then yl:=1;
end
if bj=1 and holding=0 and 开多 and ref(count(开多,exitbars+1),1)=3 then begin
buy(开多,1,thisclose);
yl:=0;
end
if bj=1 and holding=0 and 开空 and ref(count(开空,exitbars+1),1)=3 then begin
buyshort(开空,1,thisclose);
yl:=0;
end |