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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 笨人请求帮忙

   

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


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

主题:笨人请求帮忙

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


加好友 发短信
等级:新手上路 帖子:68 积分:436 威望:0 精华:0 注册:2011/1/16 22:06:51
笨人请求帮忙  发帖心情 Post By:2012/4/26 22:19:33    Post IP:14.150.53.142[只看该作者]

下面公式用在5分钟K线,开平反手到最后平仓。现本人想在当日收盘时看到平仓总收益。

不知怎么设计公式,肯请朋友们帮忙。上次的删除文件还未搞好。

 

 

 
 RUNMODE:0;
 variable:a=0,b=0;
 
nn:=barslast(date<>ref(date,1))+1;
cc:=valuewhen(nn=5,c);
ma5:ma(c,5);

ma10:ma(c,10);

a :=valuewhen(nn=1,0);
b :=valuewhen(nn=1,0);
 
if nn=15 and cc>=ma5 and a=0 then  begin
buy(holding=0,1,thisclose);
end

if nn=15 and cc<ma5 and b=0 then begin
buyshort(holding=0,1,thisclose);
end

TT :=time<150900;
 反手1:=a=1 and   ref(c,1) < ref(ma5,1) and   c < ma5 -5  and TT;
 反手2:=b=1 and   ref(c,1) > ref(ma5,1) and   c > ma5 +5  and TT;

 
反手3:=     ref(c,1) < ref(ma5,1) and   c <    ma5 -5  and TT;
反手4:=     ref(c,1) > ref(ma5,1) and   c  >   ma5 +5  and TT;

if 反手2 or ( 反手4 and  holding <0    ) then begin
 sellshort(holding<0,0,thisclose);
 buy(holding=0,1,thisclose);
 
 end
if 反手1 or (反手3 and  holding >0) then begin
 sell(holding>0,0,thisclose);
 buyshort(holding=0,1,thisclose);
 
end
if  time >151000 and time <= 1515000 then begin
 sellshort(holding<0,0,thisclose);
 sell(holding>0,0,thisclose);
  DRAWTEXT(1   , h +6,'每日平仓所得')  ,COLORWHITE ;
// 在这加语句得当日收益,怎么做?
end

 

 


 回到顶部