Rss & SiteMap

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

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

标题:全局变量问题

1楼
¥在路上2010 发表于:2014/7/21 14:54:16
咨询版主,日内交易,如若当天有一单被止损掉,则,当天不再开仓,怎么代码化,谢谢。。。
2楼
pyd 发表于:2014/7/21 15:00:11

用全局变量,止损后赋值

VARIABLE:n:=0;
if cond and n=0 and holding=0 then buy();

if 止损条件 then
begin
sell();
n:=1;
end
if time=CLOSETIME(0) then n:=0;

[此贴子已经被作者于2014/7/21 16:09:04编辑过]
3楼
¥在路上2010 发表于:2014/7/21 15:20:11

版主,好像不行啊,我要的效果是,不管多单还是空单止损后,多空都不开仓。。。谢谢啦。。。

4楼
jinzhe 发表于:2014/7/21 15:21:48

那还是一样,和平多一些,多写一个平空的

最后那一句的位置依然是最后一句,写在新加的平空语句后面

5楼
¥在路上2010 发表于:2014/7/21 16:02:50

VARIABLE:n:=0;
if KD and n:=0 then BUY(KD   AND  HOLDING=0,1,MARKET);

if PP1 then
begin
SELL(PD AND HOLDING>0,HOLDING,MARKET);
n:=1;
end

VARIABLE:n:=0;
if KK and n:=0 then ;

if PP2 then BUYSHORT(KK  AND HOLDING=0,1,MARKET);
begin
SELLSHORT(PK AND HOLDING<0,HOLDING,MARKET);
n:=1;
end

if time=CLOSETIME(0) then n:=0;

版主,我改成这样后,直接没有信号了,肿么回事呢?谢谢啦。。。

6楼
pyd 发表于:2014/7/21 16:14:59

修正下是 if cond and n=0 holding=0 then buy()

 

VARIABLE:n:=0;
if 开多条件 and n=0 and holding=0 then buy();
if 开空条件 and n=0 and holding=0 then buyshort();

if 止损条件 and holding>0 then
begin
sell();
n:=1;
end
if 止损条件 and holding<0 then
begin
sellshort();
n:=1;
end

if time=CLOSETIME(0) then n:=0;

 

共6 条记录, 每页显示 10 条, 页签: [1]


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