{-----【小广主图】---首个采用数理化模型对传统MA均线进行精确优化的指标!-----}
{---------------------------分时主图+自动画线------------------------------}
画线取值:=INTPART(3*8/5);
AAA:=REF(H,画线取值)=HHV(H,2*画线取值+1);
QYY:=BacKSET(AAA,画线取值+1);
CCC:=FILTER(QYY,画线取值) AND H=HHV(H,画线取值+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,画线取值)=LLV(L,2*画线取值+1);
QY11:=BACKSET(AA11,画线取值+1);
CC11:=FILTER(QY11,画线取值) AND L=LLV(L,画线取值+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);
支撑:=DRAWLINE(CURRBARSCOUNT=DDCS22,L,CURRBARSCOUNT=DDCS11,L,1),COLOR00CCCC;
{-------------------------通达信新分时源码广哥深度优化版--------------------}
A:=CURRBARSCOUNT;
A1:=DAY!=REF(DAY,1);
A2:=BARSLAST(A1)+1;
A3:=MA(C,A2);
A4:=SUM(AMO,A2)/SUM(vol,A2)/100;
A5:=IF(CAPITAL>0,A4,A3);
均价线:=IF(A<=CONST(A2),A5,DRAWNULL);
分钟有效周期:=IF(PERIOD=2,15,IF(PERIOD=3,30,IF(PERIOD=4,60,IF(PERIOD=5,240,DRAWNULL))));
分时价:=TFILT(CLOSE,CURRBARSCOUNT,00,CURRBARSCOUNT,00);
分时判断:=IF(分时价=DRAWNULL,1,IF(分钟有效周期=DRAWNULL,DRAWNULL,1));
k线隐藏:STICKLINE(C>0 AND 分时判断=DRAWNULL,H,L,3,1),COLOR000000;
{--------------------------盘面资金----------------------------------------}
RC:=IF(分时价>0.01 AND 分时判断=DRAWNULL,DYNAINFO( 3),DRAWNULL);
S2:=SMA(C,2,1);
S6:=SMA(C,6,1);
DK:=2*(S2-S6);
买量:STICKLINE(DK>0 AND 分时判断=DRAWNULL,RC,RC+DK,0.01,0),COLOR000040;
卖量:STICKLINE(DK<0 AND 分时判断=DRAWNULL,RC,RC+DK,0.01,0),COLOR004000;
历史收盘价:=IF(分时价>0.01 AND 分钟有效周期=DRAWNULL AND A>=CONST(A2),C,DRAWNULL),COLOR8800FF;
前收盘价:=IF(历史收盘价>0.01,DYNAINFO(3),DRAWNULL),COLORRED,COLOR404080;
前收盘价画线:DRAWBAND(前收盘价,RGB(64,64,64),前收盘价,RGB(128,128,128));
历史价:=IF(分时判断=DRAWNULL AND A>=CONST(A2),C,DRAWNULL),COLOR8800FF;
昨收:IF(A<=CONST(A2) AND 分时判断=DRAWNULL,DYNAINFO(3),DRAWNULL),LINETHICK2,COLOR404080;
现价:=IF(A<=CONST(A2) AND 分时判断=DRAWNULL,CLOSE,DRAWNULL),COLORFFFFFF;
均价:=IF(A<=CONST(A2) AND 分时判断=DRAWNULL,A5,DRAWNULL),COLOR80FFFF;
{牛熊线原码----------Z.自然数时权均线,用于TDX等 无WMA(C,N)函数之股软------}
M:=C;
ZL91:=(90*M+89*REF(M,1)+88*REF(M,2)+87*REF(M,3)+86*REF(M,4)+85*REF(M,5)+84*REF(M,6)+83*REF(M,7)+82*REF(M,8)+81*REF(M,9)+80*REF(M,10)+79*REF(M,11)+
78*REF(M,12)+77*REF(M,13)+76*REF(M,14)+75*REF(M,15)+74*REF(M,16)+73*REF(M,17)+72*REF(M,18)+71*REF(M,19));
ZL92:=(70*REF(M,20)+69*REF(M,21)+68*REF(M,22)+67*REF(M,23)+66*REF(M,24)+65*REF(M,25)+64*REF(M,26)+63*REF(M,27)+62*REF(M,28)+61*REF(M,29)+60*REF(M,30)+
59*REF(M,31)+58*REF(M,32)+57*REF(M,33)+56*REF(M,34)+55*REF(M,35)+54*REF(M,36)+53*REF(M,37)+52*REF(M,38)+51*REF(M,39));
ZL93:=(50*REF(M,40)+49*REF(M,41)+48*REF(M,42)+47*REF(M,43)+46*REF(M,44)+45*REF(M,45)+44*REF(M,46)+43*REF(M,47)+42*REF(M,48)+41*REF(M,49)+40*REF(M,50)+
39*REF(M,51)+38*REF(M,52)+37*REF(M,53)+36*REF(M,54)+35*REF(M,55)+34*REF(M,56)+33*REF(M,57)+32*REF(M,58)+31*REF(M,59));
ZL94:=(30*REF(M,60)+29*REF(M,61)+28*REF(M,62)+27*REF(M,63)+26*REF(M,64)+25*REF(M,65)+
24*REF(M,66)+23*REF(M,67)+22*REF(M,68)+21*REF(M,69)+20*REF(M,70)+19*REF(M,71)+18*REF(M,72)+17*REF(M,73)+16*REF(M,74)+15*REF(M,75)+14*REF(M,76)+13*REF(M,77)+
12*REF(M,78)+11*REF(M,79));
ZL95:=10*REF(M,80)+9*REF(M,81)+8*REF(M,82)+7*REF(M,83)+6*REF(M,84)+5*REF(M,85)+4*REF(M,86)+3*REF(M,87)+2*REF(M,88)+REF(M,89);
③号线:=(ZL91+ZL92+ZL93+ZL94+ZL95)/4095;{WMA90A}
{------------------------Z.自然数时权均线之--牛熊线原码--------------------}
ZL13:=(120*M+119*REF(M,1)+118*REF(M,2)+117*REF(M,3)+116*REF(M,4)+115*REF(M,5)+114*REF(M,6)+113*REF(M,7)+112*REF(M,8)+111*REF(M,9)+110*REF(M,10)+109*REF(M,11)+
108*REF(M,12)+107*REF(M,13)+106*REF(M,14)+105*REF(M,15)+104*REF(M,16)+103*REF(M,17)+
102*REF(M,18)+101*REF(M,19));
ZL14:=(100*REF(M,20)+99*REF(M,21)+98*REF(M,22)+97*REF(M,23)+96*REF(M,24)+95*REF(M,25)+94*REF(M,26)+93*REF(M,27)+92*REF(M,28)+91*REF(M,29)+90*REF(M,30)+
89*REF(M,31)+88*REF(M,32)+87*REF(M,33)+86*REF(M,34)+85*REF(M,35)+84*REF(M,36)+83*REF(M,37)+82*REF(M,38)+81*REF(M,39));
ZL15:=(80*REF(M,40)+79*REF(M,41)+78*REF(M,42)+77*REF(M,43)+76*REF(M,44)+75*REF(M,45)+74*REF(M,46)+73*REF(M,47)+72*REF(M,48)+71*REF(M,49)+70*REF(M,50)+
69*REF(M,51)+68*REF(M,52)+67*REF(M,53)+66*REF(M,54)+65*REF(M,55)+64*REF(M,56)+63*REF(M,57)+62*REF(M,58)+61*REF(M,59));
ZL16:=(60*REF(M,60)+59*REF(M,61)+58*REF(M,62)+57*REF(M,63)+56*REF(M,64)+55*REF(M,65)+
54*REF(M,66)+53*REF(M,67)+52*REF(M,68)+51*REF(M,69)+50*REF(M,70)+49*REF(M,71)+48*REF(M,72)+47*REF(M,73)+46*REF(M,74)+45*REF(M,75)+44*REF(M,76)+43*REF(M,77)+
42*REF(M,78)+41*REF(M,79));
ZL17:=(40*REF(M,80)+39*REF(M,81)+38*REF(M,82)+37*REF(M,83)+36*REF(M,84)+35*REF(M,85)+34*REF(M,86)+33*REF(M,87)+32*REF(M,88)+31*REF(M,89)+30*REF(M,90)+
29*REF(M,91)+28*REF(M,92)+27*REF(M,93)+26*REF(M,94)+25*REF(M,95)+24*REF(M,96)+23*REF(M,97)+22*REF(M,98)+21*REF(M,99));
ZL18:=(20*REF(M,100)+19*REF(M,101)+18*REF(M,102)+17*REF(M,103)+16*REF(M,104)+15*REF(M,105)+14*REF(M,106)+13*REF(M,107)+12*REF(M,108)+11*REF(M,109)+10*REF(M,110)+
9*REF(M,111)+8*REF(M,112)+7*REF(M,113)+6*REF(M,114)+5*REF(M,115)+4*REF(M,116)+3*REF(M,117)+2*REF(M,118)+REF(M,119));
牛熊线:=(ZL13+ZL14+ZL15+ZL16+ZL17+ZL18)/7260,COLOR808040,COLORFF8080;{WMA120A}
{---------------K线的简单微积分技术与黄金分割均线整合优化------------------}
ED1:=(-2*REF(C,2)+REF(C,1)+2*C);{5点平滑二导右半支};
JF1:=SMA(SMA(ED1,3,1),3,1);
⑤日◆分时现价:IF(分时判断=1,SMA(JF1,3,2),现价),COLORFFFFFF;
⑩日◆分时均价:IF(分时判断=1,SMA(JF1,8,2),均价),COLOR00FFFF;
月线修正A:=IF(SMA(JF1,21,2)>MA(C,20) OR MA(C,20)=DRAWNULL,SMA(JF1,21,2),MA(C,20));
月线修正B:=IF(月线修正A>=SMA(JF1,34,2),月线修正A,SMA(JF1,34,2)),COLOR990099;
月◆昨分时价:IF(分时判断=1,月线修正B,历史价),COLOR990099;
{----------------------------短期均线多空趋势彩带--------------------------}
5日均线:=IF(分时价=DRAWNULL,SMA(JF1,3,2),IF(分钟有效周期=DRAWNULL,DRAWNULL,SMA(JF1,3,2))),COLORFFFFFF;
10日均线:=IF(分时价=DRAWNULL,SMA(JF1,8,2),IF(分钟有效周期=DRAWNULL,DRAWNULL,SMA(JF1,8,2))),COLOR00FFFF;
均线多空趋势:DRAWBAND(5日均线,RGB(128,128,51),10日均线,RGB(51,153,102));
{--------------------------60日,半年,年线优化修正------------------------}
60日线起点:=BARSSINCE(crOSS(牛熊线,MA(C,60)));
传统60日线:=IF(60日线起点>=1,MA(C,60),牛熊线),COLOR00FF00;
60日线修正:=IF(SMA(JF1,55,2)>③号线,③号线,SMA(JF1,55,2)),COLORFF8080;
60日:IF(60日线修正<传统60日线 OR 传统60日线=DRAWNULL,60日线修正,传统60日线),COLOR008000;
半年:IF(牛熊线>SMA(JF1,144,2),SMA(JF1,144,2),牛熊线),COLORC08080;
年:SMA(JF1,233,2),COLORCC0000;
{--------理想论坛‘131488’会员提供的通达信■新宝塔线■-----原码-----------}
最高价:=HIGH; 最低价:=LOW; 收盘价:=CLOSE; 开盘价:=OPEN;
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)
AND 分时判断=1;
{-股票公式网站 }
VARD:=CLOSE<REF(CLOSE,1) AND CLOSE<REF(CLOSE,2);
三平顶翻绿:=(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 AND 分时判断=1;
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)
AND 分时判断=1;
三平底翻金:=(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 AND 分时判断=1;
持股区上色:=(三平底翻金 OR 收盘价<开盘价);
观望区上色:=(三平顶翻绿 OR 收盘价<开盘价);
{----------由‘往事如风-小广’原创的--常规K线与宝塔线整合优化--------------}
红色实体1:STICKLINE(红色持股区 AND 持股区上色,CLOSE,REF(CLOSE,1),3,0),COLOR330077;
兰色实体1:STICKLINE(兰色观望区,CLOSE,REF(CLOSE,1),3,0),COLORAA5500;
金色实体1:STICKLINE(三平底翻金,REF(CLOSE,1),REF(CLOSE,2),3,0),COLOR2288CC;
绿色实体1:STICKLINE(三平顶翻绿,REF(CLOSE,1),REF(CLOSE,2),3,0),COLOR007300;
阴线实体:STICKLINE(收盘价<开盘价 AND 分时判断=1,收盘价,开盘价,3,0 ),COLORCYAN;
阳线实体:STICKLINE(收盘价>开盘价 AND 分时判断=1,收盘价,开盘价,3.0,0 ),COLOR3232FF;
{----------------------------------收阳兰色区域----------------------------}
本日收阴1:STICKLINE(收盘价<开盘价 AND 分时判断=1,收盘价,开盘价,2.0,0),COLORDD3C00;
本日收阴2:STICKLINE(收盘价<开盘价 AND 分时判断=1,收盘价,开盘价,1.25,0),COLOREE4000;
本日收阴3:STICKLINE(收盘价<开盘价 AND 分时判断=1,收盘价,开盘价,0.40,0),COLORFF4C00;
{----------------------------------收阳红色区域----------------------------}
本日收阳2:STICKLINE(收盘价>开盘价 AND 分时判断=1,CLOSE,O,2.0,0),COLOR440088;
本日收阳3:STICKLINE(收盘价>开盘价 AND 分时判断=1,CLOSE,O,1.25,0),COLOR550099;
本日收阳4:STICKLINE(收盘价>开盘价 AND 分时判断=1,CLOSE,O,0.40,0),COLOR6600AA;
{-----------------------红色区域,真阳宝塔,持股待涨-------------------------}
红色中心2:STICKLINE(红色持股区 AND 持股区上色,CLOSE,REF(CLOSE,1),2.0,0),COLOR440088;
红色中心3:STICKLINE(红色持股区 AND 持股区上色,CLOSE,REF(CLOSE,1),1.25,0),COLOR550099;
红色中心4:STICKLINE(红色持股区 AND 持股区上色,CLOSE,REF(CLOSE,1),0.4,0),COLOR6600AA;
{-----------------------兰色区域,真阴宝塔,空仓观望-------------------------}
兰色中心2:STICKLINE(兰色观望区,CLOSE,REF(CLOSE,1),2.0,0),COLORAA6600;
兰色中心3:STICKLINE(兰色观望区,CLOSE,REF(CLOSE,1),1.25,0),COLORBB7700;
兰色中心4:STICKLINE(兰色观望区,CLOSE,REF(CLOSE,1),0.40,0),COLORCC8800;
{-----------------------三平底翻金,阴转阳宝塔,买进-------------------------}
金色中心2:STICKLINE(三平底翻金,REF(CLOSE,1),REF(CLOSE,2),2.0,0),COLOR3599DD;
金色中心3:STICKLINE(三平底翻金,REF(CLOSE,1),REF(CLOSE,2),1.25,0),COLOR45AAEE;
金色中心4:STICKLINE(三平底翻金,REF(CLOSE,1),REF(CLOSE,2),0.40,0),COLOR55BBFF;
{-----------------------三平顶翻绿-阳转阴宝塔,卖出-------------------------}
绿色中心2:STICKLINE(三平顶翻绿,REF(CLOSE,1),REF(CLOSE,2),2.0,0),COLOR008600;
绿色中心3:STICKLINE(三平顶翻绿,REF(CLOSE,1),REF(CLOSE,2),0.7,0),COLOR009900;
{-----------------5日,10日,月线,60日线,半年线,年线重画----------------}
阻力:=DRAWLINE(CURRBARSCOUNT=GDCS22,H,CURRBARSCOUNT=GDCS11,H,1),COLOR808040;
支撑重画:=DRAWBAND(昨收,RGB(102,0,204),昨收,RGB(204,204,0));
年线:=DRAWBAND(年,RGB(0,0,204),年,RGB(0,0,204));
半年线:DRAWBAND(半年,RGB(128,128,192),半年,RGB(128,128,192));
60日线:DRAWBAND(60日,RGB(0,128,0),60日,RGB(0,128,0));
月线:DRAWBAND(月◆昨分时价,RGB(153,0,153),月◆昨分时价,RGB(153,0,153));
10日线:DRAWBAND(⑩日◆分时均价,RGB(255,255,0),⑩日◆分时均价,RGB(255,255,0));
5日线:DRAWBAND(⑤日◆分时现价,RGB(255,255,255),⑤日◆分时现价,RGB(255,255,255));
{-------------------K线收平,K线实体,开盘与收盘线,重画线--------------------}
收平实体:STICKLINE(收盘价=开盘价 AND 分时判断=1,开盘价,开盘价,2,0),COLORWHITE;{白色}
收平影线:STICKLINE(收盘价=开盘价 AND 分时判断=1,最低价,最高价,0,0),COLORWHITE;{白色}
收阳开盘:STICKLINE(收盘价>开盘价 AND 分时判断=1,开盘价,开盘价,2.0,0 ),COLOR3232FF;{橙红色}
收阳收盘:STICKLINE(收盘价>开盘价 AND 分时判断=1,收盘价,收盘价,2.0,0 ),COLOR3232FF;{橙红色}
收阴开盘:STICKLINE(收盘价<开盘价 AND 分时判断=1,开盘价,开盘价,2,0 ),COLORCYAN;{亮兰色}
收阴收盘:STICKLINE(收盘价<开盘价 AND 分时判断=1,收盘价,收盘价,2,0 ),COLORCYAN;{亮兰色};
{-----------------------------上下影线重画---------------------------------}
阳线上影:STICKLINE(收盘价>开盘价 AND 分时判断=1,收盘价,最高价,0,0 ),COLOR3232FF;{橙红色}
阳线下影:STICKLINE(收盘价>开盘价 AND 分时判断=1,开盘价,最低价,0,0 ),COLOR3232FF;{橙红色}
阴线上影:STICKLINE(收盘价<开盘价 AND 分时判断=1,开盘价,最高价,0,0 ),COLORCYAN;{亮兰色}
阴线下影:STICKLINE(收盘价<开盘价 AND 分时判断=1,收盘价,最低价,0,0 ),COLORCYAN;{亮兰色};