ma250:=ma(close,250),colormagenta,linethick3;{n(3,30,5);}【箱顶:peak(3,n,1)*0.999;【箱底】:trough(3,n,1)*0.999;【箱高】:=1*(【箱顶】-【箱底】)/【箱底】; k运行的升幅:=(ma(h,3)-ref(ma(h,3),1))*100/ref(ma(h,3),1);{nodraw;} {ml:=ema(l,7),colormagenta; mh:=ma(h,7),colorgray;趋势线:ma((mh+ml)/2,3),linethick1,colorgreen;趋势线1:if(趋势线>ref(趋势线,1),趋势线,draw**),linethick2,colormagenta;}{均线}var1:ma(c,7),colorgreen; var1a:if(var1>ref(var1,1),var1,draw**),colorred;drawicon(cross(c,var1),l*0.99,1);drawicon(cross(var1,c),h*1.00,2); xdu:=if(ema(ema(ema(c,2),2),2)>ref(ema(ema(ema(c,2),2),2),1),【箱底】,【箱顶】);xtb:=【箱底】!=ref(【箱底】,2) &&【箱底】=ref(【箱底】,1);xts:=【箱顶】!=ref(【箱顶】,2) &&【箱顶】=ref(【箱顶】,1);买点:=(【箱底】!=ref(【箱底】,2) && 【箱底】=ref(【箱底】,1));卖点:=(【箱顶】!=ref(【箱顶】,2) && 【箱顶】=ref(【箱顶】,1)); drawicon(xtb,min(【箱底】,l)*0.979,1); drawtext(xtb,min(【箱底】,l)*0.977,'[到底了,抢钱!]'),color0000dd; drawicon(xts,max(【箱顶】,h)*1.018,2); drawtext(xts,min(【箱顶】,h)*1.028,'[到顶了,快跑!]')color00dd00;上升段:drawline(xtb,min(llv(l,1),【箱底】),xts,max(hhv(h,1),【箱顶】),0) color000099,linethick2;下跌段:drawline(xts,max(hhv(h,1),【箱顶】),xtb,min(llv(l,1),【箱底】),0) color009900,linethick2;{主图中涨停板,跌停板颜色。}c6:=ref(c,1);涨停:=if((c-c6)*100/c6>=(10-0.01*100/c6),1,0);stickline(涨停,open,close,2,0),colormagenta;stickline(涨停,h,l,0,0),colorlired;跌停:=(ref(c,1)-c)*100/ref(c,1)>=(10-1/ref(c,1)) and (ref(c,1)-c)*100/ref(c,1)<=(10+1/ref(c,1)) and l=c;stickline(跌停,open,close,2,0),coloryellow;送你一个我自己优化过的小箱体公式,箱体本身就是含有未来函数的,还有顶底也是有未来函数的,所以用的时候要注意。 20210311