参考唐仁政老师的四季变天源码,及论坛多位老师的公式,,纯属组合而成,涨跌停提示,顶底背离提示,输出趋势线跟生命线,支撑与压力有未来函数,非喜勿用。
NN:=100;
AA:=REF(H,N)=HHV(H,2*N+1); AA1:=REF(L,N)=LLV(L,2*N+1);
QY:=BACKSET(AA,N+1); QY1:=BACKSET(AA1,N+1);
CC:=FILTER(QY,N) AND H=HHV(H,N+1); CC1:=FILTER(QY1,N) AND L=LLV(L,N+1);
DDD:=BARSLAST(CC); DD1:=BARSLAST(CC1);
GDTS:=IF(CC,CURRBARSCOUNT,0); DDTS:=IF(CC1,CURRBARSCOUNT,0);
DINGBUTS:=IF(DDD,REF(GDTS,DDD),GDTS); DDTS1:=IF(DD1,REF(DDTS,DD1),DDTS);
GDCS1:=CONST(DINGBUTS); DDCS1:=CONST(DDTS1);
GDCS13:=CONST(REF(HIGH,GDCS1-1)); DDCS13:=CONST(REF(L,DDCS1-1));
DINGBUTS1:=REF(DINGBUTS,DDD+1); DDTS2:=REF(DDTS1,DD1+1);
GDCS2:=CONST(DINGBUTS1); DDCS2:=CONST(DDTS2);
M:=INTPART(3*N/5);
AAA:=REF(H,M)=HHV(H,2*M+1);
QYY:=BACKSET(AAA,M+1);
CCC:=FILTER(QYY,M) AND H=HHV(H,M+1);
DDDD:=BARSLAST(CCC),NODRAW;
GDTSS:=IF(CCC,CURRBARSCOUNT,0);
DINGBUTSS:=IF(DDDD,REF(GDTSS,DDDD),GDTSS);
GDCS11:=CONST(DINGBUTSS);
DINGBUTS11:=REF(DINGBUTSS,DDDD+1);
GDCS22:=CONST(DINGBUTS11);
AA11:=REF(L,M)=LLV(L,2*M+1);
QY11:=BACKSET(AA11,M+1);
CC11:=FILTER(QY11,M) AND L=LLV(L,M+1);
DD11:=BARSLAST(CC11);
DDTSS:=IF(CC11,CURRBARSCOUNT,0);
DDTS11:=IF(DD11,REF(DDTSS,DD11),DDTSS);
DDCS11:=CONST(DDTS11);
DDTS22:=REF(DDTS11,DD11+1);
DDCS22:=CONST(DDTS22);
ZGD:=HHV(H,60)*1.01.00;
ZGD2:=CONST(ZGD);
高点压力M:=DRAWLINE(CURRBARSCOUNT=GDCS22,H,CURRBARSCOUNT=GDCS11,H,1),COLORRED,LINETHICK2;
低点支撑M:=DRAWLINE(CURRBARSCOUNT=DDCS22,L,CURRBARSCOUNT=DDCS11,L,1) COLORRED,LINETHICK2;
高点压力1:=DRAWLINE(CURRBARSCOUNT=GDCS2,H,CURRBARSCOUNT=GDCS1,H,1) ,COLORBLUE,LINETHICK2;
低点支撑1:=DRAWLINE(CURRBARSCOUNT=DDCS2,L,CURRBARSCOUNT=DDCS1,L,1),COLORBLUE,LINETHICK2;
高点:=CONST(HHV(H,NN));
低点:=CONST(LLV(L,NN));
GJ:=(C+H+L+O)/4;
明日阻力:=L+(GJ-L)+(C-L);
明日支撑:=L+(C-GJ);
明日阻力2:=L+2*(GJ-L)+(C-L);
明日支撑2:=L+(C-GJ)-(GJ-L);
今日阻力:=CONST(REF(明日阻力 , 1)),NODRAW;
今日支撑:=CONST(REF(明日支撑 , 1)),NODRAW;
今日阻力2:=CONST(REF(明日阻力2 , 1)),NODRAW;
今日支撑2:=CONST(REF(明日支撑2 , 1)),NODRAW;
STICKLINE(ISLASTBAR,今日阻力,今日阻力2,10,0),COLOR555555;
DRAWTEXT(ISLASTBAR,今日阻力,' 阻'),COLOR0000FF;
STICKLINE(ISLASTBAR,今日支撑,今日支撑2,10,0),COLOR555555;
DRAWTEXT(ISLASTBAR,今日支撑,' 支'),COLOR00FF00;
IF(BETWEEN(高点压力M,高点,低点),高点压力M,DRAWNULL),COLORWHITE,LINETHICK2;
IF(BETWEEN(低点支撑M,高点,低点),低点支撑M,DRAWNULL),COLORWHITE,LINETHICK2;
IF(BETWEEN(高点压力1,高点,低点),高点压力1,DRAWNULL),COLORGREEN,LINETHICK2;
IF(BETWEEN(低点支撑1,高点,低点),低点支撑1,DRAWNULL),COLORGREEN,LINETHICK2;
涨停:=C>REF(C,1)*1.099;
开盘价:REF(O,BARSLAST(涨停)),COLORWHITE,CIRCLEDOT;
DRAWNUMBER(涨停,L,O),COLORRED;
C3:=REF(C,1);
跌停:=IF((C3-C)*100/C3>=(10-0.01*100/C3),1,0);
STICKLINE(跌停,OPEN,CLOSE,4,0),COLORGREEN;
STICKLINE(跌停,OPEN,CLOSE,3,0),COLORBLUE;
DRAWTEXT(跌停,H+0.3,'跌停'),COLORBLUE;
{原文链接:HTTP://WWW.55188.COM/THREAD-4453918-1-1.HTML};
STICKLINE(V>=REF(V,1)*2,O,C,3,0)COLORBLUE;
STICKLINE(V>=REF(V,1)*2,H,L,0,0)COLORBLUE;
STICKLINE(C/REF(C,1)>=1.098,O,C,3,0)COLORRED;
STICKLINE(C/REF(C,1)>=1.098,H,L,0,0)COLORRED;
STICKLINE(C/REF(C,1)<=0.901,O,C,3,0)COLORBLUE;
STICKLINE(C/REF(C,1)<=0.901,H,L,0,0)COLORBLUE;
ZT:=C/REF(C,1)>1.097;
BH:=BARSLAST(ZT);
CZ:=REF(H,BH)-REF(L,BH);
STICKLINE(C AND BH<100,(REF(L,BH)+CZ*0.5),(REF(L,BH)+CZ*0.5),3,0),COLORRED;
STICKLINE(C AND BH<100,REF(L,BH),REF(L,BH),3,0),COLORWHITE,CIRCLEDOT;
STICKLINE(C AND BH<100,REF(H,BH),REF(H,BH),3,0),COLORWHITE;
HHH:=CONST(HHV(H,100));
LLL:=CONST(LLV(L,100));
HH:=HHH-LLL;
TJ2:= CURRBARSCOUNT=58;
总家数:INDEXADV+INDEXDEC,NODRAW;
涨家数:INDEXADV,NODRAW;
跌家数:INDEXDEC,NODRAW;
差数:INDEXADV-INDEXDEC,NODRAW;
半分位:=(O+C)/2;
昨半分位:=REF(半分位,1);
STICKLINE(ISLASTBAR,昨半分位,昨半分位,10,0);
DRAWNUMBER(ISLASTBAR,昨半分位,昨半分位);
DRAWTEXT(ISLASTBAR,昨半分位,' 昨半分位');
底:=SUM(MA(CLOSE,10),9)/11.114;
DRAWTEXT(CROSS(LOW,底) AND REF(底,1)>REF(HIGH,1) OR CROSS(HIGH,底),L,'---铁底'),COLOR00FF00;
{原文链接:HTTP://WWW.55188.COM/THREAD-4648365-1-1.HTML};
VAR3:=PEAKBARS(3,10,1)<10;
VAR5:=IF(VAR3=1,2,0);
顶:= IF(VAR5=2,2,0);
DRAWICON(顶>REF(顶,1),H*1.005,2);
DRAWICON(CROSS(ZIG(3,10) ,REF(ZIG(3 ,10),1)),L,1);
DRAWICON(CROSS(REF(ZIG(3,10),1),ZIG(3,10)),H,12);
DRAWGBK(1,RGB(0,0,0),RGB(0,0,0),0,'00',0);{原文链接:HTTP://WWW.55188.COM/THREAD-4726228-1-1.HTML};
生命线:=(EMA(C,10)*14+EMA(C,20)*6)/20;
生命线12:=(EMA(生命线,10)*14+EMA(生命线,20)*6)/20;
变异1:=生命线+生命线-生命线12;
变异线1:=(EMA(变异1,10)*14+EMA(变异1,20)*6)/20;
趋势线:变异1+变异1-变异线1,COLORRED;
平衡线:(EMA(趋势线,10)*14+EMA(趋势线,20)*6)/20,COLORWHITE;
AAA1:=CLOSE>REF(CLOSE,1) AND REF(CLOSE,1)>REF(CLOSE,2) AND REF(CLOSE,1)=REF(CLOSE,5)),IF(REF(CLOSE,5)
BBB1:=CLOSEREF(CLOSE,3) AND IF(REF(CLOSE,3)>REF(CLOSE,4),1,IF(REF(CLOSE,4)>REF(CLOSE,5),REF(CLOSE,1)>REF(CLOSE,4) OR (REF(CLOSE,2)>REF(CLOSE,4) AND REF(CLOSE,3)<=REF(CLOSE,5)),IF(REF(CLOSE,5)>REF(CLOSE,6),1,REF(CLOSE,6)>REF(CLOSE,7)))); VAR26:=(CLOSE-LLV(LOW,21))/(HHV(HIGH,21)-LLV(LOW,21))*100; H1:=MAX(DYNAINFO(3),DYNAINFO(5));
DRAWICON(AAA1 AND CLOSE>REF(OPEN,3),0.99*LOW,1);
DRAWICON(BBB1 AND CLOSE
DRAWTEXT(AAA1 AND CLOSE>REF(OPEN,3),LOW*0.98,'平底翻红');
DRAWTEXT(BBB1 AND CLOSE
LC:=REF(CLOSE,1);
RSI:=((SMA(MAX((CLOSE - LC),0),3,1) / SMA(ABS((CLOSE - LC)),3,1)) * 100);
FF:=EMA(CLOSE,3);
MA15:=EMA(CLOSE,21);
DRAWTEXT(CROSS(FF,MA15),(LOW * 0.99),'底背离'),COLORA6E500;
DRAWTEXT(CROSS(88,RSI),(HIGH * 1.02),'顶背离'),COLOR1880FF;
MTM:=C-REF(C,1);
DX:=100*EMA(EMA(MTM,6),6)/EMA(EMA(ABS(MTM),6),6);
买:=IF(LLV(DX,2)=LLV(DX,7) AND COUNT(DX<0,2) AND CROSS(DX,MA(DX,2)),1,0);
VAR27:=REVERSE(VAR26);
VAR28:=SMA(VAR26,3,1);
波段王:= SMA(VAR28,3,1);
波段鬼:= SMA(波段王,8,1);
地狱:DRAWICON(CROSS(波段王,波段鬼) AND 波段王<40,LOW,1);
天堂: DRAWICON(CROSS(波段鬼,波段王) AND 波段鬼>75,HIGH,2);
DRAWTEXT(CROSS(波段王,波段鬼) AND 波段王<40,LOW*1.01,'低吸做波段'), COLORWHITE;
DRAWTEXT(CROSS(波段鬼,波段王) AND 波段鬼>75,HIGH*1.01,'减磅'),COLOR00FF00;
L1:=MIN(DYNAINFO(3),DYNAINFO(6));
P1:=H1-L1;
阻力:L1+P1*7/8,COLOR005100,,LINETHICK2,DOTLINE;
支撑:L1+P1*0.5/8,COLOR000075,,LINETHICK2,DOTLINE;
现价:=CLOSE,COLORWHITE,LINETHICK1;