欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 怎么把oo定义成为 平空? 或者平多 处的价位呢???

   

欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。    


  共有2268人关注过本帖树形打印复制链接

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

帅哥哟,离线,有人找我吗?
W4739889
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:21 积分:0 威望:0 精华:0 注册:2017/4/13 13:38:30
怎么把oo定义成为 平空? 或者平多 处的价位呢???  发帖心情 Post By:2017/5/19 15:33:32    Post IP:49.77.140.83[只看该作者]

怎么把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


 回到顶部
美女呀,离线,留言给我吧!
pyd
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:8439 积分:0 威望:0 精华:0 注册:2014/7/14 13:43:36
  发帖心情 Post By:2017/5/19 16:41:41    Post IP:180.169.30.6[只看该作者]

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编辑过]

 回到顶部