宝塔 K线【主图指标】

{宝塔 K线【主图指标】08 宝塔线+SAR指标}
 
    {使用方法:黄托底买进,绿压顶卖出。}

背景色:DRAWGBK(C>0, RGB(0,0,0),RGB(0,0,3'该数值可以调整'),0,0,0);{浅色背景};

平均成本线:COST(50)COLOR0099FF,DOTLINE,NODRAW;

MA10:=EMA(CLOSE,10),COLORYELLOW;

{压力与支撑}

压力均线画线:HHV(HIGH,20),COLORFFCC00,DOTLINE,NODRAW;
    支撑均线画线:LLV(LOW,20),COLORFFCC00,DOTLINE,NODRAW;
    压力均线20:=HHV(LOW,20),COLORFFCC00,DOTLINE;
    支撑均线20:=LLV(HIGH,20),COLORFFCC00,DOTLINE;
    标注001:DRAWICON(FILTERX(CROSS(C,压力均线20),10),H*1.02,2);
    标注002:DRAWICON(FILTERX(CROSS(C,支撑均线20),10),L*0.98,1);

MA5:MA(C,5),COLOR555555;
    选股预警:DRAWTEXT_FIX(CURRBARSCOUNT=1 AND LONGCROSS(C,MA5,3),0.82,0.08,0,'股价上穿5日均  ★★★')COLORMAGENTA;

X:=(3*C+L+O+H)/6;
    宝塔多空线:(20*X+19*REF(X,1)+18*REF(X,2)+17*REF(X,3)+16*REF(X,4)+15*REF(X,5)+14*REF(X,6)
    +13*REF(X,7)+12*REF(X,8)+11*REF(X,9)+10*REF(X,10)+9*REF(X,11)+8*REF(X,12)
    +7*REF(X,13)+6*REF(X,14)+5*REF(X,15)+4*REF(X,16)+3*REF(X,17)+2*REF(X,18)+
    REF(X,20))/210,COLORYELLOW,LINETHICK1;

宝塔多空线1:IF(宝塔多空线>REF(宝塔多空线,1)OR C>(宝塔多空线),宝塔多空线,DRAWNULL)COLORMAGENTA,LINETHICK1;
    宝塔多空线2:IF(宝塔多空线<REF(宝塔多空线,1)OR C<(宝塔多空线),宝塔多空线,DRAWNULL)COLORGREEN,LINETHICK1;

标识01:=STICKLINE(REF(宝塔多空线,1)<宝塔多空线,宝塔多空线,REF(宝塔多空线,1),3,1),COLORRED;
    标识02:=STICKLINE(REF(宝塔多空线,1)>宝塔多空线,宝塔多空线,REF(宝塔多空线,1),3,1),COLORCYAN;

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);
    标识03:STICKLINE(VAR1 OR VAR2 OR VAR3 OR VAR4 OR VAR5 OR VAR6 OR VAR7 OR
    VAR8 OR VAR9 OR VARA OR VARB OR VARC,CLOSE,REF(CLOSE,1),3,1),COLORRED;
    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);
    标识04:STICKLINE(VARD OR VARE OR VARF OR VAR10 OR VAR11 OR VAR12 OR VAR13 OR
    VAR14 OR VAR15 OR VAR16 OR VAR17 OR VAR18,CLOSE,REF(CLOSE,1),3,0),COLORFFCC66;
    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;
    标识05:STICKLINE(VAR19,REF(CLOSE,1),REF(CLOSE,2),3,1),COLORYELLOW;
    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;
    标识06:STICKLINE(VAR1A,REF(CLOSE,1),REF(CLOSE,2),3,2),COLOR00FF00{98FD};
    标识07:STICKLINE(VAR19,REF(CLOSE,1),REF(CLOSE,2),3,0),COLOR0099FF;
    标识08:=STICKLINE(VAR19,REF(CLOSE,1),REF(CLOSE,2),3,0),COLOR00C8FF;
    标识09:=STICKLINE(VAR19,REF(CLOSE,1),REF(CLOSE,2),3,0),COLOR10ECFF;
    标识10:=STICKLINE(VAR19,REF(CLOSE,1),REF(CLOSE,2),3,0),COLOR10FFFF;
    标识11:=STICKLINE(VAR19,REF(CLOSE,1),REF(CLOSE,2),3,0),COLOR10F0FF;
    标识12:=STICKLINE(VAR1A,REF(CLOSE,1),REF(CLOSE,2),3,0),COLORGREEN;
    标识13:=STICKLINE(VAR1A,REF(CLOSE,1),REF(CLOSE,2),3,0),COLOR93FFD1;
    标识14:=STICKLINE(VAR1A,REF(CLOSE,1),REF(CLOSE,2),3,0),COLOR93FF22;
    标识15:=STICKLINE(VAR1A,REF(CLOSE,1),REF(CLOSE,2),3,0),COLOR24FF22;
    标识16:=STICKLINE(VAR1A,REF(CLOSE,1),REF(CLOSE,2),3,0),COLOR090FF2;

{庄家成本}

A00:=SUMBARS(V,CAPITAL*1); 
    A01:=SUM(COST(10),A00)/A00; {在A周期里获利10%的平均价}
    A02:=SUM(COST(20),A00)/A00; {在A周期里获利20%的平均价}
    A03:=SUM(COST(30),A00)/A00; {在A周期里获利30%的平均价}
    A04:=SUM(COST(40),A00)/A00; {在A周期里获利40%的平均价}
    A05:=SUM(COST(50),A00)/A00; {在A周期里获利50%的平均价}
    庄家成本:(5*A01+4*A02+3*A03+2*A04+A05)/15,DOTLINE,COLORCYAN,NODRAW;
    庄得利:C>=(庄家成本)COLORRED,NODRAW;
    庄差钱:C<(庄家成本)COLORGREEN,NODRAW;

持仓:=IF(CLOSE>=SAR(4,2,20),SAR(4,2,20),DRAWNULL),COLORRED;
    空仓:=IF(CLOSE<=SAR(4,2,20),SAR(4,2,20),DRAWNULL),COLORGREEN;
    BS:=STICKLINE(C/REF(C,1)>1.095,O,C,1.5,0),COLORYELLOW;
    SAR持仓标识:DRAWTEXT(CLOSE>=SAR(4,2,20),SAR(4,2,20)-0.3,'●')COLOR0099FF;
    SAR空仓标识:DRAWTEXT(CLOSE<=SAR(4,2,20),SAR(4,2,20)+0.3,'●')COLORFF0033;

{个股类别}

BK1:=STRCAT(STRSPACE(DYBLOCK),HYBLOCK);
    BK2:=STRCAT(STRSPACE(BK1),GNBLOCK);
    BK3:=STRCAT(STRSPACE(BK2),FGBLOCK);
    BK4:=STRCAT(STRSPACE(BK3),ZHBLOCK);
    个股类别:DRAWTEXT_FIX(1,0.01,1,0,BK4),COLORRED;

短期震荡值:100*(C-LLV(L,5))/(HHV(C,5)-LLV(L,5))NODRAW,COLORCYAN;
    中期震荡值:100*(C-LLV(L,10))/(HHV(C,10)-LLV(L,10))NODRAW,COLOR0099FF;
    中长期震荡值:100*(C-LLV(L,20))/(HHV(C,20)-LLV(L,20))NODRAW,COLORMAGENTA;
    长期震荡值:100*(C-LLV(L,30))/(HHV(C,30)-LLV(L,30))NODRAW,COLORRED,LINETHICK2;
    短线预警:DRAWTEXT_FIX(CURRBARSCOUNT=1 AND 短期震荡值=(100)AND 中期震荡值=(100)AND 中长期震荡值=(100)AND 长期震荡值=(100),0.90,0.01,0,'小心短线见顶   ★★★')COLOR0099FF;
    短线提醒:DRAWTEXT_FIX(CURRBARSCOUNT=1 AND 短期震荡值<=(6)AND 中期震荡值<=(6)AND 中长期震荡值<=(6)AND 长期震荡值<=(6),0.90,0.98,0,'短线已然超跌   ★★★')COLORGREEN;
   
    {年 月 日 星期}

D1:=YEAR AND MONTH AND DAY;
    AA1:=STRCAT(CON2STR(YEAR,0),'年');
    AA2:=STRCAT(CON2STR(MONTH,0),'月');
    AA3:=STRCAT(CON2STR(DAY,0),'日');
    AA4:=STRCAT('  星期',IF(WEEKDAY=1,'一',IF(WEEKDAY=2,'二',IF(WEEKDAY=3,'三',IF(WEEKDAY=4,'四',IF(WEEKDAY=5,'五',IF(WEEKDAY=6,'六','日')))))));
    AA:=STRCAT(STRCAT(STRCAT(AA1,AA2),STRCAT(AA3,AA4)),'');
    位置标注:DRAWTEXT_FIX(D1,0.89,0.03,0,AA),COLORGREEN; {在冒号 : 后面加上一个等于 = 符号,年月日及星期就不再显示了。}

{用法注释}

D00:=1;
    AA00:=DRAWGBK('     ★★★   “三平底” 黄托底 买进。','.','.','.','.','.');
    AA00图标:DRAWTEXT_FIX(D00=1,0.01,0.03,0,AA00),COLOR0099FF;
    D01:=1;
    AA01:=DRAWGBK('     ★★★   “三平顶” 绿压顶 卖出。','.','.','.','.','.');
    AA01图标:DRAWTEXT_FIX(D01=1,0.01,0.09,0,AA01),COLORGREEN;

(0)

相关推荐