以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  金字塔软件问题提交  (http://weistock.com/bbs/list.asp?boardid=2)
----  金字塔可否实现开平仓分组功能?  (http://weistock.com/bbs/dispbbs.asp?boardid=2&id=136830)

--  作者:strenjoy
--  发布时间:2016/7/25 9:55:40
--  金字塔可否实现开平仓分组功能?
比如像文华里面有这样的功能:

BK("A",1);
SP("A",1);
BK("B",1);
SP("B",1);

金子塔可以实现这个吗

--  作者:pyd
--  发布时间:2016/7/25 10:02:28
--  

可以分开写

sell(cond1,1,market);//平多

buyshort(cond2,1,market)//开空

sellshort(cond3,1,market);//平空

buy(cond4,1,market);//开多


--  作者:strenjoy
--  发布时间:2016/7/25 13:24:25
--  飞
但是这样并没有成为分组啊。 这样只要一符合平仓条件就立马平掉了。
没有实现分组的功能

--  作者:pyd
--  发布时间:2016/7/25 13:48:57
--  
具体解释下您说的分组功能
--  作者:strenjoy
--  发布时间:2016/7/25 16:11:46
--  飞
比如分组为A和B

那么通过A开仓的,就只能A来平仓

A: buy(1,1,thisclose);
A: SELL(1,1,thisclose);
B: buy(1,1,thisclose);
B: SELL(1,1,thisclose);


第四行语句,哪怕条件符合,也不会把第一行开的仓位平掉的


--  作者:wenarm
--  发布时间:2016/7/26 9:30:48
--  

 使用全局变量定义一个flag标志位。进行区分。

VARIABLE:a=0,b=0;
if cond1 and a=0 then begin
buy(1,1,MARKET);
a:=1;
end
if cond2 and a=1 then begin
buy(1,1,MARKET);
a:=0;
end
if cond1 and b=0 then begin
buy(1,1,MARKET);
b:=1;
end
if cond2 and b=1 then begin
buy(1,1,MARKET);
b:=0;
end