当前位置:首页 > 通达信 > 正文

【通达信源码分享】精品指标 自动黄金分割(指标主图贴图)

2022-09-27未知 编 辑:掌上指标


公式源码:
 
 
 
{YK黄金分割线}
 
 {参数1: M1, 最小: 0, 最大: 1000, 缺省: 5
 
参数2: M2, 最小: 0, 最大: 1000, 缺省: 10
 
参数3: M3, 最小: 0, 最大: 1000, 缺省: 20
 
参数4: M4, 最小: 0, 最大: 1000, 缺省: 60
 
参数5: M, 最小: 1, 最大: 250, 缺省: 10
 
公式类型: 技术指标公式-均线型
 
画线方法: 主图叠加}
 
VAR1:=MA(CLOSE,M1);
 
VAR2:=MA(CLOSE,M2);
 
VAR3:=MA(CLOSE,M3);
 
VAR4:=MA(CLOSE,M4);
 
VAR5:=VOL/REF(VOL,1)>=1.9;
 
VAR6:=REF(CLOSE,2)>REF(OPEN,2) AND REF(CLOSE,1)<OPEN AND CLOSE>REF(HIGH,1) AND VAR5;
 
STICKLINE(VAR6,OPEN,CLOSE,1,0),COLORGREEN;
 
DRAWTEXT(VAR6,LOW,1),COLORYELLOW;
 
VAR7:=9;
 
VAR8:=1.5;
 
VAR9:=CLOSE;
 
VAR10:=OPEN;
 
VAR11:=VAR9>=REF(CLOSE,1)*(1+VAR7/100) AND VOL>REF(VOL,1)*VAR8;
 
DRAWTEXT(CURRBARSCOUNT<100 AND VAR11,LOW*0.98,2),COLORYELLOW;
 
VAR12:=REF(CLOSE,BARSLAST(VAR11));
 
VAR13:=REF(LOW,BARSLAST(VAR11));
 
VAR14:=CURRBARSCOUNT<100 AND BARSLAST(VAR11)<11 AND (LLV(LOW,BARSLAST(VAR11))>VAR13 OR LLV(LOW,BARSLAST(VAR11))=VAR13);
 
STICKLINE(VAR14,VAR13-VAR13*0.0005,VAR13,4,0),COLORGREEN;
 
STICKLINE(VAR14,VAR12,VAR12,4,0),COLORRED;
 
STICKLINE(VAR11,VAR10,VAR9,2,0),COLORYELLOW;
 
DRAWTEXT(BARSLAST(VAR11)=1 AND VAR14,VAR13*0.98,3),COLORGREEN;
 
DRAWTEXT(BARSLAST(VAR11)=3 AND VAR14,VAR13*0.98,5),COLORGREEN;
 
DRAWTEXT(BARSLAST(VAR11)=7 AND VAR14,VAR13*0.98,9),COLORGREEN;
 
DRAWTEXT(BARSLAST(VAR11)=9 AND VAR14,VAR13*0.98,11),COLORGREEN;
 
DRAWTEXT(BARSLAST(VAR11)=10 AND VAR14,VAR13*0.98,12),COLORGREEN;
 
VAR15:=REF(CLOSE,BARSLAST(CLOSE/REF(CLOSE,1)>1.095));
 
IF(REFX(VAR15,1)=VAR15 AND BARSLAST(CLOSE/REF(CLOSE,1)>1.095)<14,VAR15*0.955,DRAWNULL);
 
IF(REFX(VAR15,1)=VAR15 AND BARSLAST(CLOSE/REF(CLOSE,1)>1.095)<14,VAR15,DRAWNULL);
 
VAR16:=IF(REF(CLOSE,1)*1.1-CLOSE<0.01,1,0);
 
STICKLINE(VAR16,OPEN,CLOSE,2,0),COLORRED;
 
STICKLINE(VAR16,OPEN,CLOSE,2,0),COLORYELLOW;
 
STICKLINE(VAR16,HIGH,LOW,0,0),COLORYELLOW;
 
VAR17:=DMA((CLOSE+OPEN)/2,VOL/EMA(VOL*5,5));
 
VAR18:=DMA((CLOSE+OPEN)/2,VOL/EMA(VOL*13,13));
 
VAR19:=DMA((CLOSE+OPEN)/2,VOL/EMA(VOL*34,34));
 
VAR20:=DMA((CLOSE+OPEN)/2,VOL*100/FINANCE(7));
 
VAR21:=INTPART(REF(VAR17,1)*100)/100;
 
VAR22:=INTPART(REF(VAR17,1)*0.96*100)/100;
 
VAR23:=INTPART(REF(VAR20,1)*130)/100;
 
VAR24:=BARSLAST(CLOSE>VAR21);
 
VAR25:=BARSLAST(CLOSE<MIN(VAR22,VAR23));
 
VAR26:=VAR25>VAR24;
 
VAR27:=VAR24>VAR25;
 
STICKLINE(VAR26>0,CLOSE,OPEN,3,1),COLOR4646FF;
 
STICKLINE(VAR26>0,HIGH,MAX(CLOSE,OPEN),0,0),COLOR4646FF;
 
STICKLINE(VAR26>0,LOW,MIN(CLOSE,OPEN),0,0),COLOR4646FF;
 
STICKLINE(VAR26>0 AND CLOSE<OPEN,CLOSE,OPEN,2,0),COLORCYAN;
 
STICKLINE(VAR27>0 AND CLOSE<OPEN,CLOSE,OPEN,3,0),COLORCYAN;
 
STICKLINE(VAR27>0,HIGH,MAX(CLOSE,OPEN),0,0),COLORCYAN;
 
STICKLINE(VAR27>0,LOW,MIN(CLOSE,OPEN),0,0),COLORCYAN;
 
STICKLINE(VAR27>0 AND CLOSE>=OPEN,CLOSE,OPEN,3,1),COLORCYAN;
 
VAR28:=VAR17;
 
VAR29:=VAR18;
 
VAR30:=VAR19;
 
VAR31:=VAR20;
 
DRAWICON(CROSS(VAR26,0.5),LOW*0.98,7);
 
DRAWICON(CROSS(VAR27,0.5),HIGH*1.02,8);
 
MA20:MA(CLOSE,20);
 
STICKLINE(CLOSE>REF(CLOSE,1)*1.095,CLOSE,OPEN,2,0),COLORYELLOW;
 
VAR32:=FILTER(CLOSE>=MA20,4) AND REF(CLOSE,3)>=REF(OPEN,3) AND REF(CLOSE,3)>REF(MA20,3);
 
VAR33:=FILTER(CLOSE<=MA20,4) AND REF(CLOSE,3)<REF(MA20,3);
 
VAR34:=BARSLAST(VAR32);
 
VAR35:=BARSLAST(VAR33);
 
VAR36:=REF(VAR34,1)>=VAR35 AND VAR34=0;
 
VAR37:=REF(VAR35,1)>=VAR34 AND VAR35=0;
 
VAR38:=BARSLAST(VAR36);
 
VAR39:=BARSLAST(VAR37);
 
VAR40:=REF(VAR38,VAR38+1)+VAR38+1;
 
VAR41:=REF(VAR39,VAR39+1)+VAR39+1;
 
VAR42:=REF(HHVBARS(HIGH,VAR38+1),VAR39+1)+VAR39+1;
 
VAR43:=REF(LLVBARS(LOW,VAR39+1),VAR38+1)+VAR38+1;
 
VAR44:=HHVBARS(HIGH,VAR43);
 
VAR45:=LLVBARS(LOW,VAR42);
 
VAR46:=HHV(HIGH,VAR43);
 
VAR47:=LLV(LOW,VAR42);
 
VAR48:=REF(VAR46,VAR39+1);
 
VAR49:=REF(VAR47,IF(VAR38<VAR39,VAR40+1,VAR38+1));
 
VAR50:=VAR48-(VAR48-VAR49)*0.382;
 
VAR51:=VAR48-(VAR48-VAR49)*0.5;
 
VAR52:=VAR48-(VAR48-VAR49)*0.618;
 
VAR53:=VAR49+(VAR48-VAR49)*1.618;
 
VAR54:=VAR49+(VAR48-VAR49)*2.618;
 
VAR55:=VAR49+(VAR48-VAR49)*3.618;
 
VAR56:=VAR49+(VAR48-VAR49)*4.618;
 
VAR57:=VAR48-(VAR48-VAR49)*1.618;
 
VAR58:=VAR48-(VAR48-VAR49)*2.618;
 
VAR59:=VAR48-(VAR48-VAR49)*3.618;
 
VAR60:=VAR48-(VAR48-VAR49)*4.618;
 
顶点:REFDATE(VAR48,DATE),DOTLINE,COLORWHITE;
 
H61.8%:REFDATE(VAR50,DATE),DOTLINE,COLORMAGENTA;
 
H38.2%:REFDATE(VAR52,DATE),DOTLINE,COLORMAGENTA;
 
H1.618:REFDATE(VAR53,DATE),DOTLINE,COLORMAGENTA;
 
H2.618:REFDATE(VAR54,DATE),DOTLINE,COLORMAGENTA;
 
H3.618:REFDATE(VAR55,DATE),DOTLINE,COLORMAGENTA;
 
H4.618:REFDATE(VAR56,DATE),DOTLINE,COLORMAGENTA;
 
低点:REFDATE(VAR49,DATE),DOTLINE,COLORWHITE;
 
DRAWTEXT(ISLASTBAR,顶点,13),COLORWHITE;
 
DRAWTEXT(ISLASTBAR,H38.2%,14),COLORMAGENTA;
 
DRAWTEXT(ISLASTBAR,H61.8%,16),COLORMAGENTA;
 
DRAWTEXT(ISLASTBAR,H1.618,17),COLORMAGENTA;
 
DRAWTEXT(ISLASTBAR,H2.618,18),COLORMAGENTA;
 
DRAWTEXT(ISLASTBAR,H3.618,19),COLORMAGENTA;
 
DRAWTEXT(ISLASTBAR,H4.618,20),COLORMAGENTA;
 
DRAWTEXT(ISLASTBAR,低点,21),COLORWHITE;
 
VAR61:=BARSLASTCOUNT(CLOSE<MA20);
 
VAR62:=BACKSET((VAR61>3)*VAR61,VAR61);
 
VAR63:=BARSLASTCOUNT(CLOSE>MA20);
 
VAR64:=BACKSET((VAR63>3)*VAR63,VAR63);
 
VAR65:=BARSLASTCOUNT(NOT(VAR62 OR VAR64));
 
VAR66:=BARSLASTCOUNT(REF(VAR62>0,VAR65));
 
VAR67:=BARSLASTCOUNT(REF(VAR64>0,VAR65));
 
VAR68:=FILTERX(LLV(LOW,VAR66)=LOW,VAR66);
 
VAR69:=FILTERX(HHV(HIGH,VAR67)=HIGH,VAR67);
 
DRAWLINE(VAR68,LOW,VAR69,HIGH,0),DOTLINE,COLORYELLOW;
 
DRAWLINE(VAR69,HIGH,VAR68,LOW,0),DOTLINE,COLORYELLOW;
 
VAR70:=CLOSE=HHV(CLOSE,60);
 
VAR71:=BARSLAST(VAR70);
 
VAR72:=IF(VAR71>0,REF(CLOSE,VAR71),REF(CLOSE,VAR71));
 
VAR73:=CROSS(CLOSE,REF(VAR72,1));
 
VAR74:=VAR73 AND COUNT(VAR73,5)=1;
 
STICKLINE(VAR74,OPEN,CLOSE,3,0),COLORRED;
大家都爱看
查看更多热点新闻
点击进入掌上指标资源网-下载各类指标