Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共2 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:这样的程序怎么写?

1楼
gzarmstrong 发表于:2015/6/1 21:27:24
BUY(开多, 1, thisclose);
SELL(平多, 1, thisclose);

BUYSHORT(开空, 1, thisclose);
SELLSHORT(平空, 1, thisclose);

有以上的程序,需要增加下面的思路
平多或者平空以后,判断盈利超过50点,那么后面的3个开多或开空条件成立,也不开仓。

请问这样如何写程序?
2楼
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
共2 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.00781 s, 3 queries.