INPUT:定位年(2008,1990,3400),百分比(15,5,50);
v1:=zig(4,百分比);{调整需要的百分比转向}
sj:=BARSSINCE(YEAR>=定位年);{时间定位 年}
bb:=v1[
s:=sum(bb,sj);]
ss:=s[datacount]-s+1;
a:=barssince(ss=1);
aa:=if(a>=a[LBOUND(a)+1],a,1);
sjj:=STKTYPE=1 or STKTYPE=2 or STKTYPE=3 or STKTYPE=5 or STKTYPE=11;
低1:IF(NOT(sjj),ma(c,aa),sum(AMOUNT,aa)/sum(v,aa)/100),PRECISION2,Color00FF00;
d2:=barssince(ss=1+1);
dd2:=if(d2>=d2[LBOUND(d2)+1],d2,1);
低2:IF(NOT(sjj),ma(c,dd2),sum(AMOUNT,dd2)/sum(v,dd2)/100),PRECISION2,Color00B700;
d3:=barssince(ss=1+2);
dd3:=if(d3>=d3[LBOUND(d3)+1],d3,1);
低3:IF(NOT(sjj),ma(c,dd3),sum(AMOUNT,dd3)/sum(v,dd3)/100),PRECISION2,Color8BC800;
{}
bb1:=v1>ref(v1,1) and v1>refx(v1,1);
s1:=sum(bb1,sj);
ss1:=s1[datacount]-s1+1;
a1:=barssince(ss1=1);
aa1:=if(a1>=a1[LBOUND(a1)+1],a1,1);
高1:IF(NOT(sjj),ma(c,aa1),sum(AMOUNT,aa1)/sum(v,aa1)/100),PRECISION2,Color00FFFF;
d21:=barssince(ss1=1+1);
dd21:=if(d21>=d21[LBOUND(d21)+1],d21,1);
高2:IF(NOT(sjj),ma(c,dd21),sum(AMOUNT,dd21)/sum(v,dd21)/100),PRECISION2,Color00D4FF;
d31:=barssince(ss1=1+2);
dd31:=if(d31>=d31[LBOUND(d31)+1],d31,1);
高3:IF(NOT(sjj),ma(c,dd31),sum(AMOUNT,dd31)/sum(v,dd31)/100),PRECISION2,Color0098FF;
{}
bc:=barslast(SYSPARAM(1)=barpos)+1;
fc:=sum(v,bc)/capital*100;
hsl:=refx(fc,bc[datacount]-1);
jjc:=sum(AMOUNT,bc)/sum(v,bc)/100;
均价:=refx(jjc,bc[datacount]-1);//光标后均价
偏离:=(C-均价)/均价*100;
{}
DRAWTEXT(ISLASTBAR,均价,'均价
偏离
'+NUMTOSTR(偏离[DATACOUNT],1)+'%'),PXUP20,SHIFT1,COLORWHITE;
PARTLINE(C,均价),Color8B9091;//均价横线
DRAWTEXT(SYSPARAM(1)=barpos,均价,'
换手'+NUMTOSTR(hsl,2)+'%'),SHIFT1,PXUP10,ColorFF89FF;
DRAWTEXT(SYSPARAM(1)=barpos,均价,'均价:'+NUMTOSTR(均价,2)+'元 '),PXUP8,ALIGN2,Color0098FF;