171.问:
求资金进出指标
答(杨文亮):
tt:=if(c>=ref(c,1),amount,0);
AA:=sum(amount,0);
AB:=sum(tt,10)*1000/aa;
总体入场金额:100*ab;
tt1:=if(c<ref(c,1),amount,0);
AA1:=sum(amount,0);
AB1:=sum(tt1,10)*1000/aa1;
总体下跌金额:100*ab1;
mm:=if(c>=ref(c,1),v/ref(v,1),0);
mm1:=if(c<ref(c,1),v/ref(v,1),0);
时段入场金额:10000*sum(mm,10)/sum(mm,50);
时段下跌金额:10000*sum(mm1,10)/sum(mm1,50);
QUOTE:
172.问:
想在k线上显示那根k线距今天换手100/100那根k线距今天换手200/100显示数字
答(阿福):
f:=MOD(SUM(100*VOL/CAPITAL,0),100);
n:=(SUM(100*VOL/CAPITAL,0)-f)/100;
tj:=f<REF(f,1);
VERTLINE(tj);
fd:=REF(BARSLAST(tj),1)+1;
DRAWNUMBER(tj,50,n,0),ALIGN1,COLORffffff;
DRAWTEXT(tj,40,'次'),ALIGN1,COLORGREEN;
DRAWTEXT(tj,30,'换'),ALIGN1,COLORGREEN;
DRAWTEXT(tj,20,'手'),ALIGN1,COLORGREEN;
DRAWNUMBER(tj,10,fd,0),ALIGN1,COLORred;
DRAWTEXT(tj,0,'天'),ALIGN1,COLORGREEN;
还可这样写:
input:n(1040102,700101,1341231);//设置日期调整范围
n1:=BARSLAST(if(date=n,DATACOUNT-barpos,0)<>0);//计算起始开始的数据周期
hsl:=100*VOL/CAPITAL,LINETHICK0;
f:=MOD(SUM(hsl,n1),100),LINETHICK0;//数据统计从输入日期开始
tj:=f<REF(f,1);
VERTLINE(tj),POINTDOT,colorff...;
fd:=REF(BARSLAST(tj),1)+1;
DRAWNUMBER(tj,CLOSE,fd,0),ALIGN5;
周期天数:fd,LINETHICK0;
换手累积:f,LINETHICK0;
周期均价:SUM(AMOUNT,fd)/SUM(VOL,fd)/100;
bf1:=0;
for i:=SYSPARAM(1) to DATACOUNT do begin
IF bf1>=100 then BREAK else bf1:=bf1+hsl;
end;
btj:=BARPOS=i,LINETHICK0;
VERTLINE(btj),LINEDOT,COLORYELLOW;
DRAWTEXT(btj,HIGH,'完成100%换手\n共 '+NUMTOSTR((i-SYSPARAM(1)),0)+' 天'),ALIGN4,COLORRED;
再给一个钻心虫编的:
自动标出换手达100%(缺省参数)的前面K线位置--源码
偶也编了个小东东:当十字光标移到某一位置时,自动标出换手达100%(缺省参数)的前面K线位置。源码可加在主图公式中。
INPUT:%(100,1,999);//设定换手率缺省参数
周期:SUMBARS(v,capital/100*%),LINETHICK0;
KS:=BACKSET(BARSCOUNT(v)=sysparam(1),周期);
VERTLINE(cross(KS,1)),LINEDOT,COLORYELLOW;
DRAWNUMBER((cross(KS,1)),sysparam(5),DATE,0),COLORGREEN;
|