Rss & SiteMap

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

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

标题:隔天开平仓的改动。

1楼
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);以上是现有的平仓策略
现在想改成隔天平仓,当天不平仓不新开仓。
隔天开盘价超过平仓价(超过止盈止损位),则开盘平仓。否则继续执行原来的平仓策略。
2楼
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);
3楼
holysss 发表于:2016/9/12 10:25:26
谢谢。
4楼
holysss 发表于:2016/9/12 18:50:46
我拿这个替换我原来的平仓策略以后,
测试的时候从几百次交易变成只有一次交易了,从第一次开仓然后持有到最后一天平仓,问题在哪里呢?

5楼
jinzhe 发表于:2016/9/13 9:07:01
贴下你的全部代码
6楼
holysss 发表于:2016/9/13 19:45:25


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


7楼
jinzhe 发表于:2016/9/14 9:06:11
麻烦贴下全部代码,你的代码编译不通过
8楼
holysss 发表于:2016/9/18 13:15:52



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;

9楼
jinzhe 发表于:2016/9/18 13:38:14
代码还是编译不过
10楼
holysss 发表于:2016/9/19 10:44:37


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
共15 条记录, 每页显示 10 条, 页签: [1] [2]


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