按你给我的回复,我再增加少少语句,但还没有完全能实现我的想法.
我的本意是要统计总盈亏.
下面的公式好乱,但复进金字塔后能显示了.请再次帮忙.
如统计2011.05.18后开多的总盈亏.
止损价数 :=30;
止盈价数 :=60;
开仓价位差 :=50;
nn:=barslast(date<>ref(date,1))+1;
jsj:=ref(sum(amount,nn)/sum(vol,nn)/multiplier,nn);//昨日结算价
kcj:=valuewhen((o>jsj+50 or o<jsj-50) and count(o>jsj+50 or o<jsj-50,nn)=1,o);//开仓价
b1 :=o>jsj+开仓价位差 and count(o>jsj+开仓价位差 or o<jsj-开仓价位差,nn)=1;
enterlong:o>jsj+50 and count(o>jsj+50 or o<jsj-50,nn)=1,tfilter;
exitlong:o>kcj+60 or o<kcj-30 or time>=145500,tfilter;
DRAWTEXT(o>jsj+50 and count(o>jsj+50 or o<jsj-50,nn)=1 ,h +40,'开多价') ,COLORWHITE ;
drawnumber(o>jsj+50 and count(o>jsj+50 or o<jsj-50,nn)=1 ,h +30, ref(o,barslast(o>jsj+50 and count(o>jsj+50 or o<jsj-50,nn)=1)) ,0) ,COLORWHITE ;
b11 :=(o>kcj+止盈价数 or o<kcj-止损价数 or time=145500) and date=ref(date,barslast(b1)) ;
b111 :=b11 and sum(b11,nn)=1;
drawtext(b111,h +68,'平多价') ,COLORWHITE ;
drawnumber( b111,h +60, ref(o,barslast( b111)) ,0) ,COLORWHITE ;
drawtext(b111,h +50,'平多盈利') ,COLORWHITE ;
平多盈利 :=ref(o,barslast(b111)) -ref(o,barslast(b1));
drawnumber( b111,h +40,ref(o,barslast(b111)) -ref(o,barslast(b1)) ,0) ,COLORWHITE ;
entershort:o<jsj-50 and count(o>jsj+50 or o<jsj-50,nn)=1,tfilter;
exitshort:o>kcj+30 or o<kcj-60 or time>=145500,tfilter;
加了.想了好久.不会啊.
请朋友们帮下.把这复进.用在一分K.我是专用SR1109的.能帮下吗?
5月18日后的开多总盈亏?
nn:=barslast(date<>ref(date,1))+1;
jsj:=ref(sum(amount,nn)/sum(vol,nn)/multiplier,nn);//昨日结算价
if date<1110518 then exit;
kcj:=valuewhen((o>jsj+50 or o<jsj-50) and count(o>jsj+50 or o<jsj-50,nn)=1,o);//开仓价
enterlong:o>jsj+50 and count(o>jsj+50 or o<jsj-50,nn)=1,tfilter;
exitlong:o>kcj+60 or o<kcj-30 or time>=145500,tfilter;
//只有enterlong和exitlong即可,然后补充数据,然后测试,测试时选用 开盘价
谢谢上面各位.
因没钱购标准版,只能花时间手工检验.
经几天的努力,终于解决了.