Rss & SiteMap

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

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

标题:金字塔加仓后怎么分批减仓呢?

1楼
qq代人发帖 发表于:2014/4/8 11:04:47
请教:我想问一下金字塔加仓后怎么分批减仓呢?
原始的关原始的平,就是加仓的管加仓的平。


2楼
jinzhe 发表于:2014/4/8 11:09:19

http://www.weistock.com/bbs/dispbbs.asp?boardid=4&Id=63556

 

3楼
superspider 发表于:2014/4/8 11:11:29

variable:n=0;

if n=0 and kd then begin
   buy(kd ,1,thisclose);
   n:=1;
end//开仓语句,记录开仓状态
ifif n=1 and kd2 then begin
   buy(kd2 and n=1,1,thisclose);//加仓语句
   n:=2;
end
这样加仓了 ,但是如果kd平仓条件到了先平了,由于n不能归0,会导致再次满足kd就无法开仓,而如果使n归0,那仅仅kd平了以后kd可以再开 单如果kd2又满足条件则又会多开一手,请各位大大帮忙解决一

4楼
superspider 发表于:2014/4/8 11:14:01

不一样啊 仓位都是一手没问题 我的意思是怎么管理n

variable:n=0;

if n=0 and kd then begin
   buy(kd ,1,thisclose);
   n:=1;
end//开仓语句,记录开仓状态
ifif n=1 and kd2 then begin
   buy(kd2 and n=1,1,thisclose);//加仓语句
   n:=2;
end
这样加仓了 ,但是如果kd平仓条件到了先平了,由于n不能归0,会导致再次满足kd就无法开仓,而如果使n归0,那仅仅kd平了以后kd可以再开 单如果kd2又满足条件则又会多开一手

5楼
jinzhe 发表于:2014/4/8 11:24:34
再写个全局变量记录平多,分别标记开仓平多和加仓平多
6楼
superspider 发表于:2014/4/8 11:24:39
求助
7楼
jinzhe 发表于:2014/4/8 11:35:31

也就是开仓和加仓各管各的?

variable:n=0,m=0;

if kd and m=0 then begin

   buy....;

   M:=1;

end

 

if m=1 and 平多 then begin

   sell........;

   m:=0;

end

 

if n=0 and 加多1 then begin

    buy......;

    n:=1;

end

 

if n=1 and 平加多 then begin

   sell.......;

   n:=0;

end

 

8楼
superspider 发表于:2014/4/8 13:18:43

试验了一下 还是有个问题

variable:d1=0,d2=0,k1=0,k2=0;

if d1=0 and kd then begin
开多1:buy(kd,1,thisclose);
   d1:=1;
end
if d1=1 and pd then begin
平多1:sell(pd,1,thisclose);
   d1:=0;
end

if d2=0 and kd2 then begin
开多2:buy(kd2,1,thisclose);
   d2:=1;
end
if d2=1 and pd2 then begin
平多2:sell(pd2,1,thisclose);
   d2:=0;
end

if k1=0 and kk then begin
开空1:buyshort(kk,1,thisclose);
   k1:=1;
end
if k1=1 and pk then begin
平空1:sellshort(pk,1,thisclose);
   k1:=0;
end

if k2=0 and kk2 then begin
开空2:buyshort(kk2,1,thisclose);
   k2:=1;
end
if k2=1 and pk2 then begin
平空2:sellshort(pk2,1,thisclose);
   k2:=0;
end

 

 

为什么只有一个方向的开平仓 我设计的应该是平仓加反手

9楼
jinzhe 发表于:2014/4/8 13:38:21

要反手的,你把平仓反手写一起

比如这样的

if  反手  then beign

   sell.......;

   buyshort.....;

end

 

或者你把条件写直接写IF后面不写前面

 

比如你喜欢这样

kk:=c>o;

 

if kk then ....;

 

写成

 

if c>o then ..........;

10楼
superspider 发表于:2014/4/8 13:41:11
嗯 试过了 但是还有一个题 当持有多单时开不出空单 有解决的办法吗?
共16 条记录, 每页显示 10 条, 页签: [1] [2]


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