以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  笨人请求帮忙  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=11346)

--  作者:liboyi
--  发布时间:2012/4/26 22:19:33
--  笨人请求帮忙

下面公式用在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

 

 


--  作者:just
--  发布时间:2012/4/27 9:22:00
--  
返回当前帐户平仓盈亏TACCOUNT(30)
--  作者:liboyi
--  发布时间:2012/4/27 11:03:45
--  

多谢回答。

但不是我想要的答案啊。

 

Taacount(30) 这是计算帐户的盈亏的。

 

我未说清楚。

我再说一下,看有无朋友可以帮忙。

请把我的公式复入金字塔。在期指中,用5分钟K线。

我是想看到在每日的收盘K线上,每日盈亏了多少点。以指示收盘价开平仓计。


--  作者:just
--  发布时间:2012/4/27 14:03:13
--  
盈亏点数:Taacount(30)/300,linethick0;//股指为例
--  作者:liboyi
--  发布时间:2012/4/27 16:42:20
--  

再次多谢just.

老话讲:笨人无药医。

我怎么就做不了呢?。

 

我加下面 语句到我的公式后面,怎么就得不到正确结果呢。每天都是-1.

应不关300的事,若Taacount(30)加上对。应得总金额。除300就是点数了。这个我会的。

 

 DRAWNUMBER(time=151500 ,h +10,  TACCOUNT(30)   ,1)  ,COLORWHITE ;
 

 

请Just  把我的公式放入金字塔中运行一下好吗?

 

我想得到在time=151500,时显示出全天所平仓的金额或点数。


--  作者:董小球
--  发布时间:2012/4/28 16:28:34
--  
想得到在time=151500,时显示出全天所平仓的金额或点数。

这个恐怕是做不到的
你只能算算上日权益跟当前权益相差的数值

--  作者:liboyi
--  发布时间:2012/4/28 20:19:47
--  

多谢大哥。

‘你只能算算上日权益跟当前权益相差的数值’
我不用进入帐户的。只是在行情公式中计算。应不用到上日权益吧。


 

真的就这么难吗?

还有哪位肯帮一下啊。

我想检验我的方法可行否。

一天一天用眼睛看来检查一下。

每天的开仓价知道,平仓价知道。就想怎么把这几次相加。就计一天。