以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://222.73.7.161/bbs/index.asp)
--  公式模型编写问题提交  (http://222.73.7.161/bbs/list.asp?boardid=4)
----  隔天开平仓的改动。  (http://222.73.7.161/bbs/dispbbs.asp?boardid=4&id=139467)

--  作者:holysss
--  发布时间:2016/9/12 7:29:23
--  隔天开平仓的改动。
if c>enterprice*(1+0.05) then sell(1,0,marketr);

if c<enterprice*(1-0.05) then sell(1,0,marketr);以上是现有的平仓策略
现在想改成隔天平仓,当天不平仓不新开仓。
隔天开盘价超过平仓价(超过止盈止损位),则开盘平仓。否则继续执行原来的平仓策略。

--  作者:jinzhe
--  发布时间:2016/9/12 9:41:09
--  
h1:=ref(holding,todaybar);
if c>enterprice*(1+0.05)and ref(holding,todaybar)>0 then sell(1,h1marketr);

if c<enterprice*(1-0.05) and ref(holding,todaybar)>0 then sell(1,h1,marketr);

--  作者:holysss
--  发布时间:2016/9/12 10:25:26
--  回复:(jinzhe)h1:=ref(holding,todaybar);if c&g...
谢谢。
--  作者:holysss
--  发布时间:2016/9/12 18:50:46
--  回复:(jinzhe)h1:=ref(holding,todaybar);if c&g...
我拿这个替换我原来的平仓策略以后,
测试的时候从几百次交易变成只有一次交易了,从第一次开仓然后持有到最后一天平仓,问题在哪里呢?


--  作者:jinzhe
--  发布时间:2016/9/13 9:07:01
--  
贴下你的全部代码
--  作者:holysss
--  发布时间:2016/9/13 19:45:25
--  回复:(jinzhe)贴下你的全部代码


variable:n=0;

if isup then n:=n+1;  
if isdown then n:=0;
 
if n>=3   then buy(holding=0,1,market);

if c>enterprice*(1+0.05) then sell(1,0,marketr);

if c<enterprice*(1-0.05 then sell(1,0,marketr);


if time=closetime(0) then begin

   k:=0;

   m:=0;


end



--  作者:jinzhe
--  发布时间:2016/9/14 9:06:11
--  
麻烦贴下全部代码,你的代码编译不通过
--  作者:holysss
--  发布时间:2016/9/18 13:15:52
--  回复:(jinzhe)麻烦贴下全部代码,你的代码编译不通...



variable:n=0;

if isup then n:=n+1;  
if isdown then n:=0;
 
if n>=3   then buy(holding=0,1,market);

if c>enterprice*(1+0.05) then sell(1,0,marketr);

if c<enterprice*(1-0.05) then sell(1,0,marketr);


if time=closetime(0) then begin

   k:=0;

   m:=0;


--  作者:jinzhe
--  发布时间:2016/9/18 13:38:14
--  
代码还是编译不过
--  作者:holysss
--  发布时间:2016/9/19 10:44:37
--  回复:(jinzhe)代码还是编译不过


variable:n=0;

if isup then n:=n+1;  
if isdown then n:=0;
 
if n>=3   then buy(holding=0,1,market);

if c>enterprice*(1+0.05) then sell(1,0,marketr);

if c<enterprice*(1-0.05) then sell(1,0,marketr);


if time=closetime(0) then begin

   k:=0;

   m:=0;
end