通达信半仓操作主图源码

1/2法:
 如一只股票从30元开始上涨到60元,那么45元(即:(30+60)/2)就是股价的第一个强烈支撑点,如果45元支撑不住,意味着该股票走入弱势格局。第二道关卡则是37.5元,(即:(30+45)/2),一旦跌破则是熊的开始。个股如此,大盘也如此。一旦这只股票跌破第二道关卡,就要坚决出货。通过补仓摊低成本是不对的。反弹也可以通过此方法来判断。如60元的股票下跌到30元,则第一道反弹关卡是45元,若反弹超过45元还往上涨,就是强势反弹。第二道关口则是52.5元(即:(60+45)/2),如超过则进入牛市。虽然市场不是100%绝对,但长期来看1/2法非常有价值。
 当市场资金为多时,背景是偏红的,应该积极做为主。
{关键位预测}

买线:=EMA(C,2);
卖线:=EMA(SLOPE(C,13)*21+C,49);
预测:IF(买线<卖线,REFDATE(HHV(H,34),DATE)-(REFDATE(HHV(H,34),DATE)-REFDATE(LLV(L,34),DATE))*(1-0.236),REFDATE(LLV(L,34),DATE)+(REFDATE(HHV(H,34),DATE)-REFDATE(LLV(L,34),DATE))*(1-0.236)),COLORYELLOW,NODRAW;
HUGO:=IF(买线>卖线,REFDATE(LLV(L,34),DATE)+(REFDATE(HHV(H,34),DATE)-REFDATE(LLV(L,34),DATE))*(1-0.236),DRAWNULL),COLORRED;


{半仓操作判断}
D顶:REFDATE(HHV(H,34),DATE),COLORMAGENTA;
D底:REFDATE(LLV(L,34),DATE),COLORLIBLUE;

机构买入:=L2_AMO(0,2)/100000000.0,NODRAW;
机构卖出:=-L2_AMO(0,3)/100000000.0,NODRAW;
机构净买:=机构买入+机构卖出,NODRAW;
累计:=EMA(机构净买,50)*60,NODRAW;
均值:=EMA(累计,MIN(10,10)),NODRAW;
STICKLINE(累计>0,D顶,D底,6,0),COLOR1B0E8B;
STICKLINE(累计<0,D顶,D底,6,0),COLOR6B6B12;

{持股持币判断}
DRAWBAND(MA(DKX,M),RGB(10,100,10),DKX,RGB(180,10,10));
持股:IF(DKX>=MA(DKX,M),1,DRAWNULL),COLORRED,NODRAW;
持币:IF(DKX<MA(DKX,M),1,DRAWNULL),COLOR00FF00,NODRAW;


阻二:(D顶+(D顶+(D顶+D底)/2)/2)/2,COLOR00BB00,DOTLINE;
阻一:(D顶+(D顶+D底)/2)/2,COLOR00BB00,DOTLINE;
中线:(D顶+D底)/2,COLORDD99DD,DOTLINE;
撑一:(D底+中线)/2,COLOR00BB00,DOTLINE;
撑二:(D底+撑一)/2,COLOR33BB33,DOTLINE;

{立柱量判断}
均价1:=(3*C+H+L+O)/6;
VAR1AA:=(8*均价1+7*REF(均价1,1)+6*REF(均价1,2)+5*REF(均价1,3)+4*REF(均价1,4)+3*REF(均价1,5)+2*REF(均价1,6)+REF(均价1,8))/36;
VAR2A:=(LLV(VAR1AA,2)+LLV(VAR1AA,4)+LLV(VAR1AA,6))/3;
TJ1:=VOL=HHV(VOL,10) AND VOL>2*REF(VOL,1) AND C>VAR1AA;
立桩量:=FILTER(TJ1,5);
TJ2:=IF(BARSLAST(立桩量)=1 AND C>REF(H,1),1,IF(BARSLAST(立桩量)=2 AND C>REF(H,2),1,IF(BARSLAST(立桩量)=3 AND C>REF(H,3),1,0)));
突破:=TJ2=1;
TJ3:=IF(BARSLAST(立桩量)=1 AND C>REF(L,1),1,IF(BARSLAST(立桩量)=2 AND C>REF(L,2),1,IF(BARSLAST(立桩量)=3 AND C>REF(L,3),1,0)));
三天法则:=TJ3=1;
成立:=三天法则 AND 突破;
条件成立:=FILTER(成立,3),COLORF0099F,NODRAW;
STICKLINE(立桩量>=1,L,H,8,0),COLORF0099F;
STICKLINE(C,REF(H,BARSLAST(立桩量)),REF(H,BARSLAST(立桩量)),3,-1),COLORCYAN;
STICKLINE(C,REF(L,BARSLAST(立桩量)),REF(L,BARSLAST(立桩量)),3,-1),COLORYELLOW;
DRAWTEXT(条件成立,L*0.995,'成立'),COLORMAGENTA;

{主升浪判断}
A101:=EMA(CLOSE,5)>EMA(CLOSE,6) AND EMA(CLOSE,6)>EMA(CLOSE,7) AND EMA(CLOSE,7)>EMA(CLOSE,8) AND EMA(CLOSE,8)>EMA(CLOSE,9)
      AND EMA(CLOSE,9)>EMA(CLOSE,10) AND EMA(CLOSE,10)>EMA(CLOSE,11) AND EMA(CLOSE,11)>EMA(CLOSE,12)
      AND EMA(CLOSE,12)>EMA(CLOSE,13) {AND EMA(CLOSE,13)>EMA(CLOSE,14) AND EMA(CLOSE,14)>EMA(CLOSE,15)};
A102:=EMA(CLOSE,15){EMA(CLOSE,15)}>EMA(CLOSE,21) AND EMA(CLOSE,21)>EMA(CLOSE,34) AND EMA(CLOSE,34)>EMA(CLOSE,55) AND EMA(CLOSE,55)>EMA(CLOSE,89)
      AND EMA(CLOSE,89)>EMA(CLOSE,144) AND EMA(CLOSE,144)>EMA(CLOSE,233);
A1:= A101 AND A102;
短升:IF(A101,1,DRAWNULL),COLORFF00FF,NODRAW;
中升:IF(A1,1,DRAWNULL),COLORRED,NODRAW;
STICKLINE(A101,L,H,6,0),COLOR006666;
STICKLINE(A101 AND A102,L,H,4,0),COLOR660066;

{K线图}
DRAWKLINE(H,O,L,C);

{30日量能平台}
T1:=CONST(HHVBARS(V,30));
量30:IF(CURRBARSCOUNT<=30+7,CONST(IF(T1=0,C,REF(C,T1))),DRAWNULL),COLORYELLOW;

{均线}
MA5:MA(C,5),COLORFFFFFF,LINETHICK2;
MA13:=MA(C,13),COLORWHITE,LINETHICK1;
MA21:=MA(C,21),COLOREE00EE,LINETHICK2;
MA34:=MA(C,34),COLOR00DDDD,LINETHICK1;
MA55:=MA(C,55),COLOR00FFFF,LINETHICK2;
操盘:DKX,COLOR00FF00,LINETHICK3;
    IF(MA5>=REF(MA5,1),MA5,DRAWNULL),COLORFF00FF,LINETHICK2;
    IF(DKX>REF(DKX,1),DKX,DRAWNULL),COLORFF00FF,LINETHICK3;

{多空买卖判断}
VAR1:=((CLOSE > REF(CLOSE,1)) AND (CLOSE > REF(CLOSE,2)));
VAR2:=((REF(VAR1,1) AND (CLOSE <= REF(CLOSE,1))) AND (CLOSE >= REF(CLOSE,2)));
VAR3:=((REF(VAR2,1) AND (CLOSE >= REF(CLOSE,1))) AND (CLOSE <= REF(CLOSE,2)));
VAR4:=((REF(VAR3,1) AND (CLOSE <= REF(CLOSE,1))) AND (CLOSE >= REF(CLOSE,2)));
VAR5:=((REF(VAR4,1) AND (CLOSE >= REF(CLOSE,1))) AND (CLOSE <= REF(CLOSE,2)));
VAR6:=((REF(VAR5,1) AND (CLOSE <= REF(CLOSE,1))) AND (CLOSE >= REF(CLOSE,2)));
VAR7:=((REF(VAR6,1) AND (CLOSE >= REF(CLOSE,1))) AND (CLOSE <= REF(CLOSE,2)));
VAR8:=((REF(VAR7,1) AND (CLOSE <= REF(CLOSE,1))) AND (CLOSE >= REF(CLOSE,2)));
VAR9:=((REF(VAR8,1) AND (CLOSE >= REF(CLOSE,1))) AND (CLOSE <= REF(CLOSE,2)));
VARA:=((REF(VAR9,1) AND (CLOSE <= REF(CLOSE,1))) AND (CLOSE >= REF(CLOSE,2)));
VARB:=((REF(VARA,1) AND (CLOSE >= REF(CLOSE,1))) AND (CLOSE <= REF(CLOSE,2)));
VARC:=((REF(VARB,1) AND (CLOSE <= REF(CLOSE,1))) AND (CLOSE >= REF(CLOSE,2)));
多:=(((((((((((VAR1 OR VAR2) OR VAR3) OR VAR4) OR VAR5) OR VAR6) OR VAR7) OR VAR8) OR VAR9) OR VARA) OR VARB) OR VARC);
STICKLINE(多,L,H,0,0),COLOR0000FF;
STICKLINE(多 AND C>=O,C,O{REF(C,1)},3,1),COLOR0000FF;
STICKLINE(多 AND C<O,C,O{REF(C,1)},3,0),COLOR0000FF;

VARD:=((CLOSE < REF(CLOSE,1)) AND (CLOSE < REF(CLOSE,2)));
VARE:=((REF(VARD,1) AND (CLOSE >= REF(CLOSE,1))) AND (CLOSE <= REF(CLOSE,2)));
VARF:=((REF(VARE,1) AND (CLOSE <= REF(CLOSE,1))) AND (CLOSE >= REF(CLOSE,2)));
VAR10:=((REF(VARF,1) AND (CLOSE >= REF(CLOSE,1))) AND (CLOSE <= REF(CLOSE,2)));
VAR11:=((REF(VAR10,1) AND (CLOSE <= REF(CLOSE,1))) AND (CLOSE >= REF(CLOSE,2)));
VAR12:=((REF(VAR11,1) AND (CLOSE >= REF(CLOSE,1))) AND (CLOSE <= REF(CLOSE,2)));
VAR13:=((REF(VAR12,1) AND (CLOSE <= REF(CLOSE,1))) AND (CLOSE >= REF(CLOSE,2)));
VAR14:=((REF(VAR13,1) AND (CLOSE >= REF(CLOSE,1))) AND (CLOSE <= REF(CLOSE,2)));
VAR15:=((REF(VAR14,1) AND (CLOSE <= REF(CLOSE,1))) AND (CLOSE >= REF(CLOSE,2)));
VAR16:=((REF(VAR15,1) AND (CLOSE >= REF(CLOSE,1))) AND (CLOSE <= REF(CLOSE,2)));
VAR17:=((REF(VAR16,1) AND (CLOSE <= REF(CLOSE,1))) AND (CLOSE >= REF(CLOSE,2)));
VAR18:=((REF(VAR17,1) AND (CLOSE >= REF(CLOSE,1))) AND (CLOSE <= REF(CLOSE,2)));
空:=(((((((((((VARD OR VARE) OR VARF) OR VAR10) OR VAR11) OR VAR12) OR VAR13) OR VAR14) OR VAR15) OR VAR16) OR VAR17) OR VAR18);
STICKLINE(空,H,L,0 ,0 ),COLOR00FF00;
STICKLINE(空 AND C>=O,C,O{REF(C,1)},3,1),COLOR00FF00;
STICKLINE(空 AND C<O,C,O{REF(C,1)},3,0),COLOR00FF00;

VAR19:=(REF((((((((((((VARD OR VARE) OR VARF) OR VAR10) OR VAR11) OR VAR12) OR VAR13) OR VAR14) OR VAR15) OR VAR16) OR VAR17) OR VAR18),1) AND VAR1);
VAR1A:=(REF((((((((((((VAR1 OR VAR2) OR VAR3) OR VAR4) OR VAR5) OR VAR6) OR VAR7) OR VAR8) OR VAR9) OR VARA) OR VARB) OR VARC),1) AND VARD);
STICKLINE(VAR19,REF(CLOSE,1),REF(CLOSE,2),3,0 ),COLORDDDDDD;
STICKLINE(VAR1A,REF(CLOSE,1),REF(CLOSE,2),3,0),COLORFF8800; 
DRAWICON(VAR19,L*0.995,1);
DRAWICON(VAR1A,H*1.005,2);

STICKLINE(CURRBARSCOUNT=1,预测,预测,100,-1),COLOR00FFFF;
STICKLINE(CURRBARSCOUNT=1,HUGO,HUGO,100,-1),COLORFF00FF;
DRAWTEXT(ISLASTBAR,预测,'     【预测关键位】'),COLORFFFFFF,LINETHICK1;

DRAWTEXT((A101=1 AND REF(A101,1)=0),O,'短主升'),COLOR00FFFF;
DRAWTEXT((A1=1 AND REF(A1,1)=0),O*0.985,'中长升'),COLOR00FFFF;

IF(CURRBARSCOUNT=T1+1,量30,DRAWNULL),CIRCLEDOT,COLORDD00FF,LINETHICK3;
DRAWTEXT(ISLASTBAR,量30,'  30量能平台');

{DRAWTEXT(ISLASTBAR,D顶,'   D顶'),COLORMAGENTA;
DRAWTEXT(ISLASTBAR,D底,'   D底'),COLORLIBLUE;}
DRAWTEXT(ISLASTBAR,中线,'   中线'),COLORDD99DD;
DRAWTEXT(ISLASTBAR,阻一,'   阻一'),COLOR00BB00;
DRAWTEXT(ISLASTBAR,阻二,'   阻二'),COLOR00BB00;
DRAWTEXT(ISLASTBAR,撑一,'   撑一'),COLOR00BB00;
DRAWTEXT(ISLASTBAR,撑二,'   撑二'),COLOR33BB33;

{DRAWTEXT_FIX(1,0.12,0.95,0,'【短线】  红白柱买入,蓝绿柱卖出。' ),COLORFFDD00;};
T6:=IF(FINDSTR(EXTERNSTR(0,1),','),STRCAT('千股千评:',EXTERNSTR(0,1)),'');
NNN:=IF(TOTALBARSCOUNT>=120,120,TOTALBARSCOUNT);
{本输出适用于锁定K线数为120,N可改为你习惯的K线数,见下图}
HH0:=HHV(H,NNN);
LL0:=LLV(L,NNN);
MM0:=CONST((HH0+LL0)*0.5);
S01:=CONST(IF(REF(C,NNN-15)>MM0,1.00,-0.08));
S02:=CONST(IF(REF(C,NNN-15)>MM0,-1,1));
S6:=IF(FINDSTR(EXTERNSTR(0,1),','),S01+(0.08*S02),S01);
DRAWTEXT_FIX(1,0,S6,0,T6)COLOR0000FF;




来函数检测结果如下:
该公式没有未来函数

解密、定制、编写股票指标请联系QQ或微信同号:88652583
相关股票指标公式

联系我们  |  股票指标网  |  指标网   |  指标公式  |   加入收藏   |  设为主页

@2005-2023 粤ICP备2023063687号-2 股票指标网别名指标网仅为互联网文章,所有股票指标公式及文章仅供学习研究,并不构成投资建议,请勿以此为依据进行股票交易,由此引起的投资亏损与本站无关。股票指标网均来源互联网收集整理,如不慎侵犯了你的权益,请联系我们告知,我们将做删除处理
QQ:88652583 微信 88652583
sitemap站点地图