以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  止赢止损后,不同向开仓  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=154410)

--  作者:南宁老农民
--  发布时间:2017/5/31 13:08:41
--  止赢止损后,不同向开仓
请教。如果止赢止损之后,不在当天同向开仓。这个怎么编写呢。谢谢
--  作者:yukizzc
--  发布时间:2017/5/31 13:10:19
--  

variable:n=0;

if 止盈止损 then

begin

sell();

n:=1;

end

 

if 开仓条件 and n=1 then

begin

buy();

end

 

if time =150000 then n:=0;


--  作者:pyd
--  发布时间:2017/5/31 13:16:20
--  

楼上笔误,用这个

variable:n=0;

if 开仓条件 and n=0 then

begin

buy();

end

 

if 止盈止损 then

begin

sell();

n:=1;

end

  

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

[此贴子已经被作者于2017/5/31 13:17:38编辑过]

--  作者:南宁老农民
--  发布时间:2017/5/31 13:18:59
--  

variable:n=0;

if 多单止盈 then

begin

sell();

n:=1;

end

 

if 空单止盈 then

begin

sellshort();

n:=1;

end



if 多单开仓条件 and n=0 then

begin

buy();

end


f 空单开仓条件 and n=0 then

begin

buyshort();

end


 

if time =150000 then n:=0;


--  作者:pyd
--  发布时间:2017/5/31 13:45:20
--  

上边是开多的例子,也有开空的话再加一个变量

variable:n=0,m=0;

if 多单止盈 then

begin

sell();

n:=1;

end

 

if 空单止盈 then

begin

sellshort();

m:=1;

end

 

if 多单开仓条件 and n=0 then

begin

buy();

end

 
if 空单开仓条件 and m=0 then

begin

buyshort();

end

  

if time =closetime(0) then begin
n:=0;
m:=0;
end