通達信小廣MA均線精確優化指標公式
- 指標類別: 通達信指標公式
- 授權方式: 免費版
- 指標評級: ★★★★★
- 指標分類: 趨勢
- 畫線方法: 主圖
- 日期:2020-11-12 來源:互聯網
通達信小廣MA均線精確優化指標公式:包含 未來函數:BARSNEXT DYNAINFO
畫線取值:=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;{亮蘭色};
通達信小廣MA均線精確優化指標公式實例圖解:
通達信小廣MA均線精確優化指標公式