Rss & SiteMap

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

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

标题:怎么把oo定义成为 平空? 或者平多 处的价位呢???

1楼
W4739889 发表于:2017/5/19 15:33:32

怎么把oo定义成为 平空  或者平多 处的价位呢???

下文定义oo是当日开盘价,我想把它改成 平仓处的价位 ,怎么写呢?求指导


input:grid(3,1,60,1);

variable:level=0;

dist:=barslast(date<>ref(date,1));
oo:=ref(open,dist);
 

if holding=0 then begin
 dnprice:=oo-grid*mindiff;
 
 if low<=dnprice then begin
  buy(1,1,limitr,dnprice);
  level:=-1;
 end
end 

if holding=0 then begin
 upprice:=oo+grid*mindiff;
 
 if high>=upprice then begin
  buyshort(1,1,limitr,upprice);
  level:=1;
 end 
end

if holding>0 then begin
 upprice:=oo+(level+1)*grid*mindiff;
 dnprice:=oo+(level-1)*grid*mindiff;
 
 if high>=upprice then begin
  sell(1,1,limitr,upprice);
  level:=level+1;
 end
 
 if low<=dnprice then begin
  buy(1,1,limitr,dnprice);
  level:=level-1;
 end
 
 if time=closetime(0) then
  sell(1,holding,limitr,close);
end 

if holding<0 then begin 
 upprice:=oo+(level+1)*grid*mindiff;
 dnprice:=oo+(level-1)*grid*mindiff;
 
 if low<=dnprice then begin
  sellshort(1,1,limitr,dnprice);
  level:=level-1;
 end
 
 if high>=upprice then begin
  buyshort(1,1,limitr,upprice);
  level:=level+1;
 end
 
 if time=closetime(0) then
  sellshort(1,holding,limitr,close);
end

2楼
pyd 发表于:2017/5/19 16:41:41

limitr 后边的参数就是限价的价格,改成oo就可以了。

input:grid(3,1,60,1);

variable:level=0;

dist:=barslast(date<>ref(date,1));
oo:=ref(open,dist);
 

if holding=0 then begin
 dnprice:=oo-grid*mindiff;
 
 if low<=dnprice then begin
  buy(1,1,limitr,dnprice);
  level:=-1;
 end
end 

if holding=0 then begin
 upprice:=oo+grid*mindiff;
 
 if high>=upprice then begin
  buyshort(1,1,limitr,upprice);
  level:=1;
 end 
end

if holding>0 then begin
 upprice:=oo+(level+1)*grid*mindiff;
 dnprice:=oo+(level-1)*grid*mindiff;
 
 if high>=upprice then begin
  sell(1,1,limitr,oo);
  level:=level+1;
 end
 
 if low<=dnprice then begin
  buy(1,1,limitr,dnprice);
  level:=level-1;
 end
 
 if time=closetime(0) then
  sell(1,holding,limitr,oo);
end 

if holding<0 then begin 
 upprice:=oo+(level+1)*grid*mindiff;
 dnprice:=oo+(level-1)*grid*mindiff;
 
 if low<=dnprice then begin
  sellshort(1,1,limitr,oo);
  level:=level-1;
 end
 
 if high>=upprice then begin
  buyshort(1,1,limitr,upprice);
  level:=level+1;
 end
 
 if time=closetime(0) then
  sellshort(1,holding,limitr,oo);
end


[此贴子已经被作者于2017/5/19 16:43:26编辑过]
共2 条记录, 每页显示 10 条, 页签: [1]


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