下面公式用在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
多谢回答。
但不是我想要的答案啊。
Taacount(30) 这是计算帐户的盈亏的。
我未说清楚。
我再说一下,看有无朋友可以帮忙。
请把我的公式复入金字塔。在期指中,用5分钟K线。
我是想看到在每日的收盘K线上,每日盈亏了多少点。以指示收盘价开平仓计。
再次多谢just.
老话讲:笨人无药医。
我怎么就做不了呢?。
我加下面 语句到我的公式后面,怎么就得不到正确结果呢。每天都是-1.
应不关300的事,若Taacount(30)加上对。应得总金额。除300就是点数了。这个我会的。
DRAWNUMBER(time=151500 ,h +10, TACCOUNT(30) ,1) ,COLORWHITE ;
请Just 把我的公式放入金字塔中运行一下好吗?
我想得到在time=151500,时显示出全天所平仓的金额或点数。
多谢大哥。
真的就这么难吗?
还有哪位肯帮一下啊。
我想检验我的方法可行否。
一天一天用眼睛看来检查一下。
每天的开仓价知道,平仓价知道。就想怎么把这几次相加。就计一天。