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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件策略编写求助区 → [求助]

   

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


  共有3360人关注过本帖平板打印复制链接

主题:[求助]

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


加好友 发短信
等级:新手上路 帖子:10 积分:0 威望:0 精华:0 注册:2013/8/28 11:08:41
  发帖心情 Post By:2015/5/21 12:05:21 [只看该作者]

自己学写如下,不知哪里出错,请帮忙指出,谢谢!!!

 

//声明变量
variable: myprice =0 ;   //开仓价格
variable: exprice =0 ; 
variable:n=0;
variable:m=0;
variable:bj=0;

//准备需要计算的变量
H2 := REF(H,2) ;
L2 := REF(L,2) ;

H1:=ref(H,1);
L1:=ref(L,1);

ZS:=30;  //止损,根据不同品种设定
SS:=1 ; //开仓手数

DZY:=L<ref(L,1);//多止盈
KZY:=H>ref(H,1);//空止盈

dzs:=c<myprice-zs;//多止损
kzs:=c>myprice+zs;//空止损

//开多

if h2>=h1 and bj=0 then begin
myprice:=if(o<=h2 and h>h2,h2+mindiff,h2);
myprice:=if(o>h2,o+zs,h2);
buy(n<=2,ss,limitr,myprice);
n:=n+1;
end

//开空

if h2<=h1 and bj=0 then begin
myprice:=if(o>=h2 and h<h2,h2-mindiff,h2);
myprice:=if(o<h2,o-zs,h2);
buyshort(m<=2,ss,limitr,myprice);
m:=m+1;
end

//止损

if dzs   then begin
exprice:=if(enterbars<1,myprice-zs,myprice-zs-mindiff);
exprice:=if(enterbars=1 and o<(myprice-zs),o-mindiff,o);
sell(holding>0,0,limitr,exprice);
end

if kzs and enterbars<=1 then begin
exprice:=if(enterbars<1,myprice+zs,myprice+zs+mindiff);
exprice:=if(enterbars=1 and o>(myprice+zs),o+mindiff,o);
sellshort(holding<0,0,limitr,exprice);
end

//止盈

if dzy and enterbars>1 then begin
sell(1,0,market);
end

if kzy and enterbars>1 then begin
sellshort(1,0,market);
end


 回到顶部