如图:把买点出现红箭头所指的 的黄K线,为选股公式,源码如下:
M1:=5;
M2:=10;
M3:=30;
M4:=60;
M5:=80;
MA5:MA(CLOSE,M1),COLORFFFFFF;
MA10:MA(CLOSE,M2),COLORFF00FF;
MA30:MA(CLOSE,M3),COLOR00FFFF;
MA60:MA(CLOSE,M4),COLOR00FF00,LINETHICK2;
MA250:MA(CLOSE,M5),COLOR0000FF,LINETHICK2;
MA5Z:=MA(C,5);
MA10Z:=MA(C,10);
MA30Z:=MA(C,30);
MA60Z:=MA(CLOSE,60),LINETHICK2;
DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:=EMA(DIFF,9);
MACD:=2*(DIFF-DEA);
MACD1:=CROSS(DIFF,DEA) AND COUNT(MACD>0,1)=1;
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(RSV,9,1);
D:=SMA(K,9,1);
J:=3*K-2*D;
KDJ1:=CROSS(K,D) AND CROSS(J,D);
均线:=CROSS(MA(C,5),MA(C,10));
量线:=CROSS(MA(V,5),MA(V,10));
SCC:=MACD1 AND KDJ1 AND 均线 AND 量线;
SC1:=MACD1 AND KDJ1;
SC2:=均线 AND 量线;
SC3:=均线 AND MACD1;
SC4:=量线 AND KDJ1;
SC5:=均线 AND KDJ1;
SC6:=MACD1 AND 量线;
DRAWICON(SC1 OR SC2 OR SC3 OR SC4 OR SC5 OR SC6,L-0.20,9);{www.gszb.com两个以上指标同时金叉显示9号图标}
DRAWICON(SCC,L-0.20,14);{www.gszb.com四个指标同时金叉显示3号图标,便于区别};
EMA13LG:=EMA(C,13),COLORWHITE;
EMA21LG:=EMA(C,21),COLORYELLOW;
EMA34LG:=EMA(C,34),COLORFF00FF;
EMA60LG:=MA(C,60),COLORFFCC66;
X1LG:=(C+L+H)/3;
X2LG:=EMA(X1LG,6);
X3LG:=EMA(X2LG,5);
GR1LG:=BARSLAST(BETWEEN("BIAS.BIAS2"(6,13,24),0,5));
GR2LG:=EMA13LG>EMA21LG AND EMA21LG>EMA34LG AND EMA13LG>REF(EMA13LG,1);
GR3LG:=COUNT("BIAS.BIAS2"(6,13,24)>10 AND H=HHV(H,GR1LG),GR1LG);
GR4LG:=H=HHV(H,GR1LG);
GR5LG:="MACD.MACD"(9,17,8)<REF("MACD.MACD"(9,17,8),1);
GR6LG:=GR2LG AND GR3LG AND GR4LG;
GR7LG:=GR2LG AND GR3LG AND GR4LG AND GR5LG;
GR8LG:=GR6LG AND GR7LG;
LCLG := REF(CLOSE,1);
RSI6:=SMA(MAX(CLOSE-LCLG,0),6,1)/SMA(ABS(CLOSE-LCLG),6,1)*100;
BIAS5:=(CLOSE-MA(CLOSE,13))/MA(CLOSE,13)*100;
换手:=100*V/CAPITAL;
BB13LG:=ATAN(EMA13LG-REF(EMA13LG,1))*3.1416*10;
EMA8LG:=EMA(C,8);
AA1LG:=AMOUNT/VOL;
BB1LG:=L<AA1LG*0.9;
CC1LG:=(C-REF(C,1))/REF(C,1)*100>1.2;
DD1LG:=L<MA(C,6)*0.921;
EE1LG:=VOL<MA(V,5)*1.5;
FF1LG:=BB1LG AND CC1LG AND DD1LG AND EE1LG;
DRAWTEXT(FF1LG,L*0.99,'←买点'),COLOR00FFFF;
STICKLINE(FF1LG,H,L,0.3,0),COLOR00FFFF;
STICKLINE(FF1LG,O,C,3,1),LINETHICK2,COLOR00FFFF;
A2LG:=(C-REF(C,1))/REF(C,1)*100<1.02;
A3LG:=H>MA(C,5)*1.12;
AALG:= A2LG AND A3LG;
DRAWTEXT(AALG,H*1.025,'←粉K卖!'),COLOR00FF00;
STICKLINE(AALG,H,L,3,0),COLORFF00FF;
MA5F:=MA(CLOSE,5);
MA10F:=MA(CLOSE,10);
MA20F:=MA(CLOSE,20);
MA60F:=MA(CLOSE,60);
BB:=REF(INDEXC,1)<REF(INDEXC,2) AND REF(C,2)*0.95>=REF(C,1) AND REF(O,1)/REF(C,1)>=1.05
AND REF(C,1)<REF(O,1) AND C>O AND C/O>=1.05 AND C>REF(O,1)
AND REF(VOL,1)<REF(VOL,2);
STICKLINE(BB,O,C,4,0),COLORRED;
STICKLINE(BB,O,H,0,0),COLORRED;
STICKLINE(BB,L,C,0,0),COLORRED;
DRAWTEXT(BB,L*0.98,'←追!'),COLORYELLOW;
VAR1:=4*SMA((CLOSE-LLV(LOW,5))/(HHV(HIGH,5)-LLV(LOW,5))*100,5,1)-
3*SMA(SMA((CLOSE-LLV(LOW,5))/(HHV(HIGH,5)-LLV(LOW,5))*100,5,1),3.2,1);
VAR2:=8;
CC:=CROSS(VAR1,VAR2);
DRAWTEXT(CC,L*0.98,'←买!'),COLORYELLOW;
TYP:=(H+L+C)/3;
TYP1:=(TYP-MA(TYP,14))/(0.015*AVEDEV(TYP,14))<=20 AND REF(MA(C,21),1)<MA(C,21);
TJ1F:=O<MAX(REF(C,1),REF(O,1));
TJ2:=REF(C,1)>=MA(C,21) AND L/MA(C,21)>=1.015 AND MA(C,144)>MA(C,250) AND V<MA(V,10) AND MIN(REF(V,2),REF(V,1))>V;
TJ3:=REF(MA(C,250),90)<REF(MA(C,144),90) AND MA(C,144)>MA(C,250) AND O>MA(C,250);
TJ4:=MAX(REF(H,10)AND REF(H,9)AND REF(H,8)AND REF(H,7), REF(H,6));
TOUJI:=TYP1 AND TJ1F AND TJ2 AND REF(C,2)/REF(O,2)<1.06 AND C/O<=1.05 AND HHV(H,5)/LLV(L,30)>=1.65 AND REF(H,5)/REF(L,1)>=1.15 AND REF(C,1)/REF(O,1)<=0.995 AND (L<REF(L,2) OR (REF(H,2)-REF(L,2))/(H-L)>=2) AND O/REF(L,1)<=1.04
OR TYP1 AND TJ1F AND O/REF(L,1)<1.05 AND REF(L,1)/REF(O,4)<=0.85 AND REF(C,1)/REF(O,1)<=1.03 AND O<REF(C,1) AND HHV(H,5)/LLV(L,35)>1.35 AND V<MA(V,10);
TOUJI2:=TYP1 AND TJ1F AND TJ2 AND O/REF(L,1)<1.05 AND O/LLV(L,3)<1.1 AND REF(C,1)/REF(0,1)<=1.05 AND HHV(H,4)/LLV(L,16)>=1.35 AND REF(O,4)/REF(C,2)>=1.08 AND REF(C,2)/REF(O,2)<=0.995 AND (REF(L,2)<REF(L,3) OR (REF(H,3)-REF(L,3))/(REF(H,1)-REF(L,1))>=2) AND L<MIN(REF(C,1),REF(O,1))
OR TYP1 AND TJ1F AND HHV(H,10)/LLV(L,25)>=1.3 AND REF(C,5)<REF(H,5) AND REF(C,4)<REF(C,5) AND REF(C,3)<REF(C,4) AND REF(C,2)<REF(C,3) AND REF(C,1)<REF(C,2) AND L<REF(L,1) AND MA5/O<1.1;
DATOUJI:=TYP1 AND TJ3 AND O<REF(C,5) AND O<=REF(C,1) AND REF(H,10)/O>=1.17 AND HHV(H,10)/LLV(L,30)>1.4 AND (MA(V,10)/HHV(V,10)>0.5 AND V/HHV(V,10)>0.2 AND V/HHV(V,10)<0.4 OR REF(V,3)>REF(V,2) AND REF(V,2)>REF(V,1)) AND REF(C,1)/REF(C,2)<=1.02;
DATOUJI1:=TYP1 AND TJ3 AND O<REF(L,6) AND O<MIN(REF(C,5)AND REF(O,5),5) ;
DRAWTEXT(TOUJI OR TOUJI2 OR DATOUJI OR DATOUJI1,L*0.98,'←△'),COLORYELLOW;
DRAWTEXT(CROSS(MA(VOL,10),MA(VOL,20)) AND MA(VOL,5)>MA(VOL,10) AND L<MA(C,20) AND C>=MA(C,20),L*0.98,'←量托'),COLORYELLOW;
卖出:=CROSS(90,SMA(MAX(CLOSE-REF(CLOSE,1),0),6,1)/SMA(ABS(CLOSE-REF(CLOSE,1)),6,1)*100);
DRAWTEXT(卖出,H*1.05,'←短卖'),COLORGREEN;
C3F:=REF(C,1);
涨停F:=IF((C-C3F)*100/C3F>=(10-0.01*100/C3F),1,0);
STICKLINE(涨停F,OPEN,CLOSE,2,0),COLOR00FFFF;
跌停F:=IF((C3F-C)*100/C3F>=(10-0.01*100/C3F),1,0);
STICKLINE(跌停F,OPEN,CLOSE,2,0),COLORFF0000;
W1:=C=HHV(C,20);
W2:=BARSLAST(W1);
W3:=IF(W2>0,REF(C,W2),REF(C,W2));
W4:=CROSS(C,REF(W3,1));
突破盘整:=W4 AND COUNT(W4,5)=1;
DRAWICON(突破盘整,L-0.10,1);
解答如下:
AA1LG:=AMOUNT/VOL;
BB1LG:=L<AA1LG*0.9;
CC1LG:=(C-REF(C,1))/REF(C,1)*100>1.2;
DD1LG:=L<MA(C,6)*0.921;
EE1LG:=VOL<MA(V,5)*1.5;
FF1LG:BB1LG AND CC1LG AND DD1LG AND EE1LG;
编写要求:
www.gszx.com.cn公式 网解答:
网友求助:
M1:=5;
M2:=10;
M3:=30;
M4:=60;
M5:=80;
MA5:MA(CLOSE,M1),COLORFFFFFF;
MA10:MA(CLOSE,M2),COLORFF00FF;
MA30:MA(CLOSE,M3),COLOR00FFFF;
MA60:MA(CLOSE,M4),COLOR00FF00,LINETHICK2;
MA250:MA(CLOSE,M5),COLOR0000FF,LINETHICK2;
MA5Z:=MA(C,5);
MA10Z:=MA(C,10);
MA30Z:=MA(C,30);
MA60Z:=MA(CLOSE,60),LINETHICK2;
DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:=EMA(DIFF,9);
MACD:=2*(DIFF-DEA);
MACD1:=CROSS(DIFF,DEA) AND COUNT(MACD>0,1)=1;
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(RSV,9,1);
D:=SMA(K,9,1);
J:=3*K-2*D;
KDJ1:=CROSS(K,D) AND CROSS(J,D);
均线:=CROSS(MA(C,5),MA(C,10));
量线:=CROSS(MA(V,5),MA(V,10));
SCC:=MACD1 AND KDJ1 AND 均线 AND 量线;
SC1:=MACD1 AND KDJ1;
SC2:=均线 AND 量线;
SC3:=均线 AND MACD1;
SC4:=量线 AND KDJ1;
SC5:=均线 AND KDJ1;
SC6:=MACD1 AND 量线;
DRAWICON(SC1 OR SC2 OR SC3 OR SC4 OR SC5 OR SC6,L-0.20,9);{www.gszb.com两个以上指标同时金叉显示9号图标}
DRAWICON(SCC,L-0.20,14);{www.gszb.com四个指标同时金叉显示3号图标,便于区别};
C3:=REF(C,1);
涨停:=IF((C-C3)*100/C3>=(10-0.01*100/C3),1,0);
STICKLINE(涨停,OPEN,CLOSE,2.5,0),COLORYELLOW;
跌停:=IF((C3-C)*100/C3>=(10-0.01*100/C3),1,0);
STICKLINE(跌停,OPEN,CLOSE,2.5,0),COLORBLUE;
EMA13LG:=EMA(C,13),COLORWHITE;
EMA21LG:=EMA(C,21),COLORYELLOW;
EMA34LG:=EMA(C,34),COLORFF00FF;
EMA60LG:=MA(C,60),COLORFFCC66;
X1LG:=(C+L+H)/3;
X2LG:=EMA(X1LG,6);
X3LG:=EMA(X2LG,5);
GR1LG:=BARSLAST(BETWEEN("BIAS.BIAS2"(6,13,24),0,5));
GR2LG:=EMA13LG>EMA21LG AND EMA21LG>EMA34LG AND EMA13LG>REF(EMA13LG,1);
GR3LG:=COUNT("BIAS.BIAS2"(6,13,24)>10 AND H=HHV(H,GR1LG),GR1LG);
GR4LG:=H=HHV(H,GR1LG);
GR5LG:="MACD.MACD"(9,17,8)<REF("MACD.MACD"(9,17,8),1);
GR6LG:=GR2LG AND GR3LG AND GR4LG;
GR7LG:=GR2LG AND GR3LG AND GR4LG AND GR5LG;
GR8LG:=GR6LG AND GR7LG;
LCLG := REF(CLOSE,1);
RSI6:=SMA(MAX(CLOSE-LCLG,0),6,1)/SMA(ABS(CLOSE-LCLG),6,1)*100;
BIAS5:=(CLOSE-MA(CLOSE,13))/MA(CLOSE,13)*100;
换手:=100*V/CAPITAL;
BB13LG:=ATAN(EMA13LG-REF(EMA13LG,1))*3.1416*10;
EMA8LG:=EMA(C,8);
AA1LG:=AMOUNT/VOL;
BB1LG:=L<AA1LG*0.9;
CC1LG:=(C-REF(C,1))/REF(C,1)*100>1.2;
DD1LG:=L<MA(C,6)*0.921;
EE1LG:=VOL<MA(V,5)*1.5;
FF1LG:=BB1LG AND CC1LG AND DD1LG AND EE1LG;
DRAWTEXT(FF1LG,L*0.99,'←买点'),COLOR00FFFF;
STICKLINE(FF1LG,H,L,0.3,0),COLOR00FFFF;
STICKLINE(FF1LG,O,C,3,1),LINETHICK2,COLOR00FFFF;
A2LG:=(C-REF(C,1))/REF(C,1)*100<1.02;
A3LG:=H>MA(C,5)*1.12;
AALG:= A2LG AND A3LG;
DRAWTEXT(AALG,H*1.025,'←粉K卖!'),COLOR00FF00;
STICKLINE(AALG,H,L,3,0),COLORFF00FF;
E4:=(2*CLOSE+LOW+HIGH)/4;
平仓:=(EMA(E4,55)+MA(FORCAST(CLOSE,2),40))/2*1.66;
DRAWICON(CROSS(HIGH,平仓*0.99),HIGH+0.08,11);
DRAWICON(CROSS(HIGH,平仓*0.99),HIGH+0.02,14);
DRAWTEXT(CROSS(HIGH,平仓*0.99),HIGH+0.1,' ←平仓'),COLOR00FF00;
F1P:=(CLOSE-MA(CLOSE,21))/MA(CLOSE,21)*100;
F2P:=(CLOSE-LLV(LOW,43))/(HHV(HIGH,43)-LLV(LOW,43))*100;
F3P:=SMA(F2P,2,1);
顶:=100+(-ABS(F1P));
DRAWICON(CROSS(60,顶),HIGH+0.08,10);
DRAWICON(CROSS(60,顶),HIGH+0.02,15);
DRAWTEXT(CROSS(60,顶),HIGH+0.1,' ←顶'),COLOR00FF00;
VAR20:=PEAKBARS(3,15,1)<10;
VAR21:=IF(VAR20=1,2,0);
VAR22:=IF(VAR21=2,2,0);
VAR23:=IF(VAR22>REF(VAR22,1),35,0)LINETHICK2;
DRAWTEXT(VAR23=35,HIGH*1.015,'←必逃'),COLOR00FF00;
DRAWICON(VAR23=35,HIGH*1.015,6);
MA5F:=MA(CLOSE,5);
MA10F:=MA(CLOSE,10);
MA20F:=MA(CLOSE,20);
MA60F:=MA(CLOSE,60);
BB:=REF(INDEXC,1)<REF(INDEXC,2) AND REF(C,2)*0.95>=REF(C,1) AND REF(O,1)/REF(C,1)>=1.05
AND REF(C,1)<REF(O,1) AND C>O AND C/O>=1.05 AND C>REF(O,1)
AND REF(VOL,1)<REF(VOL,2);
STICKLINE(BB,O,C,4,0),COLORRED;
STICKLINE(BB,O,H,0,0),COLORRED;
STICKLINE(BB,L,C,0,0),COLORRED;
DRAWTEXT(BB,L*0.98,'←追!'),COLORYELLOW;
VAR1:=4*SMA((CLOSE-LLV(LOW,5))/(HHV(HIGH,5)-LLV(LOW,5))*100,5,1)-
3*SMA(SMA((CLOSE-LLV(LOW,5))/(HHV(HIGH,5)-LLV(LOW,5))*100,5,1),3.2,1);
VAR2:=8;
CC:=CROSS(VAR1,VAR2);
DRAWTEXT(CC,L*0.98,'←买!'),COLORYELLOW;
TYP:=(H+L+C)/3;
TYP1:=(TYP-MA(TYP,14))/(0.015*AVEDEV(TYP,14))<=20 AND REF(MA(C,21),1)<MA(C,21);
TJ1F:=O<MAX(REF(C,1),REF(O,1));
TJ2:=REF(C,1)>=MA(C,21) AND L/MA(C,21)>=1.015 AND MA(C,144)>MA(C,250) AND V<MA(V,10) AND MIN(REF(V,2),REF(V,1))>V;
TJ3:=REF(MA(C,250),90)<REF(MA(C,144),90) AND MA(C,144)>MA(C,250) AND O>MA(C,250);
TJ4:=MAX(REF(H,10)AND REF(H,9)AND REF(H,8)AND REF(H,7), REF(H,6));
TOUJI:=TYP1 AND TJ1F AND TJ2 AND REF(C,2)/REF(O,2)<1.06 AND C/O<=1.05 AND HHV(H,5)/LLV(L,30)>=1.65 AND REF(H,5)/REF(L,1)>=1.15 AND REF(C,1)/REF(O,1)<=0.995 AND (L<REF(L,2) OR (REF(H,2)-REF(L,2))/(H-L)>=2) AND O/REF(L,1)<=1.04
OR TYP1 AND TJ1F AND O/REF(L,1)<1.05 AND REF(L,1)/REF(O,4)<=0.85 AND REF(C,1)/REF(O,1)<=1.03 AND O<REF(C,1) AND HHV(H,5)/LLV(L,35)>1.35 AND V<MA(V,10);
TOUJI2:=TYP1 AND TJ1F AND TJ2 AND O/REF(L,1)<1.05 AND O/LLV(L,3)<1.1 AND REF(C,1)/REF(0,1)<=1.05 AND HHV(H,4)/LLV(L,16)>=1.35 AND REF(O,4)/REF(C,2)>=1.08 AND REF(C,2)/REF(O,2)<=0.995 AND (REF(L,2)<REF(L,3) OR (REF(H,3)-REF(L,3))/(REF(H,1)-REF(L,1))>=2) AND L<MIN(REF(C,1),REF(O,1))
OR TYP1 AND TJ1F AND HHV(H,10)/LLV(L,25)>=1.3 AND REF(C,5)<REF(H,5) AND REF(C,4)<REF(C,5) AND REF(C,3)<REF(C,4) AND REF(C,2)<REF(C,3) AND REF(C,1)<REF(C,2) AND L<REF(L,1) AND MA5/O<1.1;
DATOUJI:=TYP1 AND TJ3 AND O<REF(C,5) AND O<=REF(C,1) AND REF(H,10)/O>=1.17 AND HHV(H,10)/LLV(L,30)>1.4 AND (MA(V,10)/HHV(V,10)>0.5 AND V/HHV(V,10)>0.2 AND V/HHV(V,10)<0.4 OR REF(V,3)>REF(V,2) AND REF(V,2)>REF(V,1)) AND REF(C,1)/REF(C,2)<=1.02;
DATOUJI1:=TYP1 AND TJ3 AND O<REF(L,6) AND O<MIN(REF(C,5)AND REF(O,5),5) ;
DRAWTEXT(TOUJI OR TOUJI2 OR DATOUJI OR DATOUJI1,L*0.98,'←△'),COLORYELLOW;
DRAWTEXT(CROSS(MA(VOL,10),MA(VOL,20)) AND MA(VOL,5)>MA(VOL,10) AND L<MA(C,20) AND C>=MA(C,20),L*0.98,'←量托'),COLORYELLOW;
卖出:=CROSS(90,SMA(MAX(CLOSE-REF(CLOSE,1),0),6,1)/SMA(ABS(CLOSE-REF(CLOSE,1)),6,1)*100);
DRAWTEXT(卖出,H*1.05,'←短卖'),COLORGREEN;
C3F:=REF(C,1);
涨停F:=IF((C-C3F)*100/C3F>=(10-0.01*100/C3F),1,0);
STICKLINE(涨停F,OPEN,CLOSE,2,0),COLOR00FFFF;
跌停F:=IF((C3F-C)*100/C3F>=(10-0.01*100/C3F),1,0);
STICKLINE(跌停F,OPEN,CLOSE,2,0),COLORFF0000;
W1:=C=HHV(C,20);
W2:=BARSLAST(W1);
W3:=IF(W2>0,REF(C,W2),REF(C,W2));
W4:=CROSS(C,REF(W3,1));
突破盘整:=W4 AND COUNT(W4,5)=1;
DRAWICON(突破盘整,L-0.10,1);
BB1LG:=L<AA1LG*0.9;
CC1LG:=(C-REF(C,1))/REF(C,1)*100>1.2;
DD1LG:=L<MA(C,6)*0.921;
EE1LG:=VOL<MA(V,5)*1.5;
FF1LG:BB1LG AND CC1LG AND DD1LG AND EE1LG;