DIR2:=Abs(CLOSE-REF(CLOSE,10));
VIR2:=SUM(ABS(CLOSE-REF(CLOSE,1)),10);
ER2:=DIR2/VIR2;
CS2:=ER2*(0.8-2/24)+2/24;
CQ2:=CS2*CS2;
AMA2:EMA(DMA(CLOSE,CQ2),2),COLORLIBLUE,LINETHICK2;
AMA3:IF(AMA2/REF(AMA2,1)>0.997,AMA2,DRAWNULL),COLORRED,LINETHICK2;
AMA4:IF(AMA2/REF(AMA2,1)>1.001,AMA2,DRAWNULL),COLORRED,LINETHICK2;
LC:=REF(CLOSE,1);
VAR28:=SMA(MAX(CLOSE-LC,0),5.5,1)/SMA(ABS(CLOSE-LC),6,1)*100;
VARA00:=((AMOUNT)/(vol))/(100);
VARAB00:=((3)*(HIGH)+LOW+OPEN+(2)*(CLOSE))/(7);
VARac00:=((SUM(AMOUNT,7))/(VARA00))/(100);
VARD0:=DMA(VARAB00,(VOL)/(VARAC00));
VARDE0:=((CLOSE-VARD0)/(VARD0))*(100);
VARDE0F:=((CLOSE-LLV(LOW,34))/(HHV(HIGH,34)-LLV(LOW,34)))*(100);
VARDE0JF:=MA(VARDE0,20)+STD(VARDE0,20);
bias18:=((CLOSE-MA(CLOSE,18))/(MA(CLOSE,18)))*(100);
AA:=SMA(VARDE0F,3,1);
SS:=(REF(BIAS18,1)>=5) AND crOSS(VARDE0JF,VARDE0) AND (AA>79);
DRAWTEXT(CROSS(84,rsi) AND CROSS(76,VAR28),H*1.01,'卖出'),LINETHICK4,COLORGREEN;
红轨道:=MA(MA(CLOSE,3),1),LINETHICK1,COLORYELLOW;
绿轨道:=MA(MA(CLOSE,3),3);
上升:=IF(红轨道>=绿轨道,绿轨道,DRAWNULL),COLORRED,LINETHICK2;
AA1:=3*SMA((C-LLV(L,9))/(HHV(H,9)-LLV(L,9))*100,3,1)-2*SMA(SMA((C-LLV(L,9))/(HHV(H,9)-LLV(L,9))*100,3,1),3,1);
加仓:=IF(CROSS(AA1,REF(AA1+0.01,1)) AND LLV(AA1,2)=LLV(AA1,8) AND BETWEEN(AA1,20,60),1,0);
波段底:=(3)*(SMA(((CLOSE - LLV(LOW,27))/(HHV(HIGH,27) - LLV(LOW,27)))*(100),5,1)) -
(2)*(SMA(SMA(((CLOSE - LLV(LOW,27))/(HHV(HIGH,27) - LLV(LOW,27)))*(100),5,1),3,1));
DRAWTEXT(CROSS(波段底,3),L*0.97,'底');
A:=(3*C+L+O+H)/6;
X:=(20*A+19*REF(A,1)+18*REF(A,2)+17*REF(A,3)+16*REF(A,4)+15*REF(A,5)+
14*REF(A,6)+13*REF(A,7)+12*REF(A,8)+11*REF(A,9)+10*REF(A,10)+9*REF(A,11)+8*REF(A,12)
+7*REF(A,13)+6*REF(A,14)+5*REF(A,15)+4*REF(A,16)+3*REF(A,17)+2*REF(A,18)+
REF(A,20))/210;
mtm:=C-REF(C,1);
DX:=100*EMA(EMA(MTM,6),6)/EMA(EMA(ABS(MTM),6),6);
CB:=EMA(X,13);
买:=IF(LLV(DX,2)=LLV(DX,7) AND COUNT(DX<0,2) AND CROSS(DX,MA(DX,2)),1,0);
DRAWTEXT(FILTER(买=1,5),LOW-0.03,'买入'),COLORRED;
盘整天数:=5;{盘整天数自己调,以5--7日为最佳}
下探幅度:=5;
上冲幅度:=25;
涨停:=(C-REF(C,1))/REF(C,1)>0.09;{涨幅大于9个点}
缩量:=HHV(VOL,盘整天数-2)<REF(VOL,盘整天数-1) AND SUM(VOL, 盘整天数)>2* SUM(VOL, 盘整天数-2);
七伤拳:=缩量 AND REF(涨停,盘整天数) AND COUNT(涨停,盘整天数+1)=1 AND (HHV(H,盘整天数)-REF(C,盘整天数))/REF(C,盘整天数)*100<上冲幅度 AND (LLV(L,盘整天数)-REF(C,盘整天数))/REF(C,盘整天数)*100>(下探幅度*-1);
DRAWTEXT(七伤拳,LOW*0.98,'*七伤拳'),COLORRED;
阳涨幅:=3.5;
阳倍量:=1.9;
单阳收:=C;
单阳开:=O;
单阳:=单阳收>=REF(C,1)*(1+阳涨幅/100)AND VOL>REF(VOL,1)*阳倍量;
DRAWTEXT(CURRBARSCOUNT<300 AND 单阳,L*0.98,'阳'),COLOR00FFFF;
高不破价:=REF(C,BArslAST(单阳));
低不破价:=REF(L,BARSLAST(单阳));
单阳不破:=CURRBARSCOUNT<300 AND BARSLAST(单阳)<11 AND (LLV(L,BARSLAST(单阳))>低不破价 OR LLV(L,BARSLAST(单阳))=低不破价);
STICKLINE(单阳不破,低不破价-低不破价*0.0005,低不破价,4,0),COLORGREEN;
STICKLINE(单阳不破,高不破价,高不破价,4,0),COLORRED;
STICKLINE(单阳,单阳开,单阳收,2,0),COLORYELLOW;
DRAWTEXT(BARSLAST(单阳)=1 AND 单阳不破,低不破价*0.98,'1'),COLORGREEN;
DRAWTEXT(BARSLAST(单阳)=2 AND 单阳不破,低不破价*0.98,'2'),COLORGREEN;
DRAWTEXT(BARSLAST(单阳)=3 AND 单阳不破,低不破价*0.98,'3'),COLORGREEN;
DRAWTEXT(BARSLAST(单阳)=4 AND 单阳不破,低不破价*0.98,'4'),COLORGREEN;
DRAWTEXT(BARSLAST(单阳)=5 AND 单阳不破,低不破价*0.98,'5'),COLORGREEN;
DRAWTEXT(BARSLAST(单阳)=6 AND 单阳不破,低不破价*0.98,'6'),COLORGREEN;
DRAWTEXT(BARSLAST(单阳)=7 AND 单阳不破,低不破价*0.98,'7'),COLORGREEN;
DRAWTEXT(BARSLAST(单阳)=8 AND 单阳不破,低不破价*0.98,'8'),COLORGREEN;
DRAWTEXT(BARSLAST(单阳)=9 AND 单阳不破,低不破价*0.98,'9'),COLORGREEN;
DRAWTEXT(BARSLAST(单阳)=10 AND 单阳不破,低不破价*0.98,'10'),COLORGREEN;
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);{两个以上指标同时金叉显示9号图标}
DRAWICON(SCC,L-0.20,3);{四个指标同时金叉显示3号图标,便于区别};
AAA:=MA((2*CLOSE+HIGH+LOW)/4,5);
通1:=AAA*102/100;
通2:=AAA*(200-102)/100;
CC:=ABS((2*CLOSE+HIGH+LOW)/4-MA(CLOSE,20))/MA(CLOSE,20);
DD:=DMA(CLOSE,CC);
上:(1+7/100)*DD,CIRCLEDOT,COLORBLUE;
下:(1-7/100)*DD,CIRCLEDOT,COLORBLUE;
中:(上+下)/2,CIRCLEDOT,COLORBLUE;
IF(上>=REF(上,1), 上,DRAWNULL),CIRCLEDOT,COLOR0099FF;
IF(中>=REF(中,1), 中,DRAWNULL),CIRCLEDOT,COLOR0099FF;
IF(下>=REF(下,1), 下,DRAWNULL),CIRCLEDOT,COLOR0099FF;
TT:=240/FROMOPEN;
比:=TT;
促进指数MFL:=(HIGH-LOW)*1000000/(VOL*比),COLORRED;
ZGD:=HHV(H,80)*0.99;
ZGD2:=CONST(ZGD);
YYA4:=MA(CLOSE,20);
YYA5:=(CLOSE > MA(CLOSE,5));
YYA6:=(MA(CLOSE,5) > MA(CLOSE,10));
YYA7:=(CLOSE > MA(CLOSE,10));
YYA8:=(MA(CLOSE,5) > MA(CLOSE,20));
YYA9:=(CLOSE > MA(CLOSE,20));
YYA10:=REF(YYA4,1);
YYA11:=(YYA4 > YYA10);
YYAVX:=(((((IF(YYA5,10,(0 - 10)) + IF(YYA6,10,(0 - 10))) + IF(YYA7,10,(0 - 10))) + IF(YYA8,10,(0 - 10))) + IF(YYA9,10,(0 - 10))) + IF(YYA11,10,(0 - 10)));
DSLX:=(CLOSE / INDEXC);
DSLX1:=MA(DSLX,5);
DSLX2:=MA(DSLX,10);
YYV1:=MA(VOL,5);
YYV2:=MA(VOL,10);
情况1:=CONST(IF(((CROSS(YYAVX,1) AND (YYV1 >= YYV2)) AND (DSLX >= DSLX1)),1,0));
情况2:=CONST(IF(((CROSS(YYAVX,1) AND (YYV1 < YYV2)) AND (DSLX >= DSLX1)),1,0));
情况3:=CONST(IF(((CROSS(YYAVX,1) AND (YYV1 > YYV2)) AND (DSLX < DSLX1)),1,0));
情况4:=CONST(IF(((CROSS(YYAVX,1) AND (YYV1 <= YYV2)) AND (DSLX < DSLX1)),1,0));
情况5:=CONST(IF(((CROSS(1,YYAVX) AND (YYV1 >= YYV2)) AND (DSLX >= DSLX1)),1,0));
情况6:=CONST(IF(((CROSS(1,YYAVX) AND (YYV1 < YYV2)) AND (DSLX >= DSLX1)),1,0));
情况7:=CONST(IF(((CROSS(1,YYAVX) AND (YYV1 >= YYV2)) AND (DSLX < DSLX1)),1,0));
情况8:=CONST(IF(((CROSS(1,YYAVX) AND (YYV1 < YYV2)) AND (DSLX < DSLX1)),1,0));
情况9:=CONST(IF(((((YYAVX >= 1) AND (REF(YYAVX,1) > 0)) AND (YYV1 >= YYV2)) AND (DSLX >= DSLX1)),1,0));
情况10:=CONST(IF(((((YYAVX >= 1) AND (REF(YYAVX,1) > 0)) AND (YYV1 < YYV2)) AND (DSLX >= DSLX1)),1,0));
情况11:=CONST(IF(((((YYAVX >= 1) AND (REF(YYAVX,1) > 0)) AND (YYV1 >= YYV2)) AND (DSLX < DSLX1)),1,0));
情况12:=CONST(IF(((((YYAVX >= 1) AND (REF(YYAVX,1) > 0)) AND (YYV1 < YYV2)) AND (DSLX < DSLX1)),1,0));
情况13:=CONST(IF(((((YYAVX < 1) AND (REF(YYAVX,1) < 0)) AND (YYV1 >= YYV2)) AND (DSLX >= DSLX1)),1,0));
情况14:=CONST(IF(((((YYAVX < 1) AND (REF(YYAVX,1) < 0)) AND (YYV1 < YYV2)) AND (DSLX >= DSLX1)),1,0));
情况15:=CONST(IF(((((YYAVX < 1) AND (REF(YYAVX,1) < 0)) AND (YYV1 >= YYV2)) AND (DSLX < DSLX1)),1,0));
情况16:=CONST(IF(((((YYAVX < 1) AND (REF(YYAVX,1) < 0)) AND (YYV1 < YYV2)) AND (DSLX < DSLX1)),1,0));
大盘1:=CONST(IF((CROSS(YYAVX,1) AND (YYV1 >= YYV2)),1,0));
大盘2:=CONST(IF((CROSS(YYAVX,1) AND (YYV1 < YYV2)),1,0));
大盘3:=CONST(IF((CROSS(1,YYAVX) AND (YYV1 >= YYV2)),1,0));
大盘4:=CONST(IF((CROSS(1,YYAVX) AND (YYV1 < YYV2)),1,0));
{ _通达信股票指标公式}
大盘5:=CONST(IF((((YYAVX >= 1) AND (REF(YYAVX,1) > 0)) AND (YYV1 >= YYV2)),1,0));
大盘6:=CONST(IF((((YYAVX >= 1) AND (REF(YYAVX,1) > 0)) AND (YYV1 < YYV2)),1,0));
大盘7:=CONST(IF((((YYAVX < 1) AND (REF(YYAVX,1) < 0)) AND (YYV1 >= YYV2)),1,0));
大盘8:=CONST(IF((((YYAVX < 1) AND (REF(YYAVX,1) < 0)) AND (YYV1 < YYV2)),1,0));
mfi:=(HIGH-LOW)*1000000/(VOL*比);
绿灯:=MFI>=REF(MFI,1)AND VOL*比>=REF(VOL,1);
M1:=CONST(绿灯);
衰退:=MFI<REF(MFI,1)AND VOL*比<REF(VOL,1);
M2:=CONST(衰退);
伪装:=MFI>=REF(MFI,1)AND VOL*比<REF(VOL,1);
M3:=CONST(伪装);
蛰伏:=MFI<REF(MFI,1)AND VOL*比>=REF(VOL,1);
M4:=CONST(蛰伏);
TS1:=IF(M1=1,0.03+0.03,0.03);
TS2:=IF(M2=1,TS1+0.03,TS1);
TS3:=IF(M3=1,TS2+0.03,TS2);
TS4:=IF(M4=1,TS3+0.03,TS3);
DRAWTEXT(情况1=1 AND (CLOSE < 200) AND CURRBARSCOUNT=70,ZGD2-(ZGD2*0.03),'量能理想,明显走强,中线参与,仓位在2/3左右'),COLORFF00FF;
DRAWTEXT(情况2=1 AND (CLOSE < 200) AND CURRBARSCOUNT=70,ZGD2-(ZGD2*0.03),'走势趋强量能不足,短线进场,仓位在1/2左右'),COLORFF00FF;
DRAWTEXT(情况3=1 AND (CLOSE < 200) AND CURRBARSCOUNT=70,ZGD2-(ZGD2*0.03),'量价良好,并没有明显走强,短线进场,仓位1/2左右。'),COLORFF00FF;
DRAWTEXT(情况4=1 AND (CLOSE < 200) AND CURRBARSCOUNT=70,ZGD2-(ZGD2*0.03),'形态尚可,量能不足,未完全走强,短线参与,仓位1/3左右。'),COLORFF00FF;
DRAWTEXT(情况5=1 AND (CLOSE < 200) AND CURRBARSCOUNT=70,ZGD2-(ZGD2*0.03),'形态变坏,走势尚可,重仓减大半,清仓者观望。'),COLORFF0000;
DRAWTEXT(情况6=1 AND (CLOSE < 200) AND CURRBARSCOUNT=70,ZGD2-(ZGD2*0.03),'随大盘一起下跌,明显缩量走势,考虑大盘风险,减持或清仓。'),COLORFF0000;
DRAWTEXT(情况7=1 AND (CLOSE < 200) AND CURRBARSCOUNT=70,ZGD2-(ZGD2*0.03),'该股放量下跌,走势明显偏弱,离场观望。'),COLORFF0000;
DRAWTEXT(情况8=1 AND (CLOSE < 200) AND CURRBARSCOUNT=70,ZGD2-(ZGD2*0.03),'该股缩量下跌,走势偏弱,离场观望。'),COLORFFFF00;
DRAWTEXT(情况9=1 AND (CLOSE < 200) AND CURRBARSCOUNT=70,ZGD2-(ZGD2*0.03),'该股形态良好,强势明显,量能充足,可以继续持有。'),COLOR00FFFF;
DRAWTEXT(情况10=1 AND (CLOSE < 200) AND CURRBARSCOUNT=70,ZGD2-(ZGD2*0.03),'该股上行趋势不变,强势依然,但量能开始转弱,注意风险'),COLOR00FFFF;
DRAWTEXT(情况11=1 AND (CLOSE < 200) AND CURRBARSCOUNT=70,ZGD2-(ZGD2*0.03),'该股仍然具备上涨潜力,但股性偏弱,可考虑减仓。'),COLORFFFFFF;
DRAWTEXT(情况12=1 AND (CLOSE < 200) AND CURRBARSCOUNT=70,ZGD2-(ZGD2*0.03),'该股走势趋弱,量能不足,减持大部分筹码'),COLORFFFF00;
DRAWTEXT(情况13=1 AND (CLOSE < 200) AND CURRBARSCOUNT=70,ZGD2-(ZGD2*0.03),'该股形态不佳,注意成交量的变化,但目前不适合参与。'),COLORFFFF00;
DRAWTEXT(情况14=1 AND (CLOSE < 200) AND CURRBARSCOUNT=70,ZGD2-(ZGD2*0.03),'该股趋势不明,股价偏弱,注意量能变化,目前不宜参与。'),COLORFFFF00;
DRAWTEXT(情况15=1 AND (CLOSE < 200) AND CURRBARSCOUNT=70,ZGD2-(ZGD2*0.03),'有走强迹象,但量能不足,趋势不明,不适合操作'),COLORFFFF00;
DRAWTEXT(情况16=1 AND (CLOSE < 200) AND CURRBARSCOUNT=70,ZGD2-(ZGD2*0.03),'该股走势太弱,没有参与价值。'),COLORFFFFFF;
DRAWTEXT(M1 AND CURRBARSCOUNT=70,ZGD2-(ZGD2*TS1),'[绿灯]实计交易量增加。MFI促进指数增加。'),COLORGREEN;
DRAWTEXT(M2 AND CURRBARSCOUNT=70,ZGD2-(ZGD2*TS2),'[衰退]实计交易量减少。MFI促进指数减少。'),COLORGREEN;
DRAWTEXT(M3 AND CURRBARSCOUNT=70,ZGD2-(ZGD2*TS3),'[伪装]实计交易量减少。MFI促进指数增加。'),COLORGREEN;
DRAWTEXT(M4 AND CURRBARSCOUNT=70,ZGD2-(ZGD2*TS4),'[蛰伏]实计交易量增加。MFI促进指数减少。'),COLORGREEN;