三角主图
{背景颜色}
DRAWGBK(c,'hua1'),Color2B5516;
{引入}
{LZV2:"立桩主图.V2",linethick0;
STICKLINE(LZV2>=1,O,C,3.5,0),COLORYELLOW,layer0;
DRAWTEXT(LZV2>=1,H*1.025,'立桩'),linethick1,coloryellow;}
{显示买卖}
BUYPRICE:="SHOWINV@BUYPRICE"(1);
buydate:="SHOWINV@date"(1);
DRAWTEXT(BUYPRICE> 0,BUYPRICE,'买入'+NUMTOSTR(BUYPRICE)),COLORffffff,linethick2;
SALEPRICE:="SHOWINV@SALEPRICE"(1);
DRAWTEXT(SALEPRICE> 0,SALEPRICE,'卖出'+NUMTOSTR(SALEPRICE)),COLORGREEN,linethick2;
DRAWTEXTABS(15,10,'【买入价:'),COLORffffff,linethick3;
IF BUYPRICE> 0 THEN BEGIN
DRAWTEXTABS(15,10,' '+NUMTOSTR(BUYPRICE)+'元 '),COLORffffff,linethick4;
DRAWTEXTABS(15,10,' 买入日期:'+NUMTOSTR(month)+'月'+NUMTOSTR(day)+'日】'), COLORwhite,LINETHICK3;
end
五日涨跌:(C-REF(CLOSE,5))/C*100,ColorFF00FF,LINETHICK0;
十日涨跌:(C-REF(CLOSE,10))/C*100,LINETHICK0;
WWA:=BARSLAST(DISPSTATUS=1);
低涨:(C/LLV(LOW,WWA)-1)*100,COLOR0000FF,LINETHICK0,PRECIS2;
天:BARSLAST(L=LLV(LOW,WWA)),COLOR00FFFF,LINETHICK0,PRECIS0;
{以下设置个股信息}
DRAWTEXTABS(15,50,'■所属板块:'+BKNAME),COLORFFFFFF;
DD:=FINANCE2(35)/10000;SS:=FINANCE2(37)/10000;
DRAWTEXTABS(15,65,'■总股本:'+NUMTOSTRN(DD,2)+'亿' +' 流通A股:'+NUMTOSTRN(SS,2)+'亿'),COLOR00FFFF;
DRAWTEXTABS(15,80,'■五日涨跌: '+NUMTOSTRN(ref(五日涨跌,0),2)+'% 十日涨跌: '+NUMTOSTRN(ref(十日涨跌,0),2)+'% 低点至今上涨:'+NUMTOSTRN(低涨,2)+'% '+NUMTOSTRN(天,0)+'天'),COLORD3A9FF;
DRAWTEXTABS(15,95,'■目前可见K线:'+NUMTOSTRN(WWA+1,0)+'天'),COLORffffff;
DRAWTEXTABS(15,110,'■建议查阅K线:短线30天,中长线120天!'),COLORffffff;
DRAWTEXTABS(15,125,'■30天最高价:'+HHV(HIGH,30)+'元'),Colorffffff;
DRAWTEXTABS(15,140,'■30天最低价:'+LLV(LOW,30)+'元'),Colorffffff;
DRAWTEXTABS(15,155,'■来自一品茶缘老师的设计!'),COLORgreen;
{立桩量成立三天法则}
AAA:=(3*C+H+L+O)/6;
VAR41:=(8*AAA+7*REF(AAA,1)+6*REF(AAA,2)+5*REF(AAA,3)+4*REF(AAA,4)+3*REF(AAA,5)+2*REF(AAA,6)+REF(AAA,8))/36;
TJ1:=VOL=HHV(VOL,10) AND VOL>2*REF(VOL,1) AND CLOSE>VAR41;
立桩量:=FILTER(TJ1,5);
TJ2:=IF(BARSLAST(立桩量)=1 AND CLOSE>REF(HIGH,1),1,IF(BARSLAST(立桩量)=2 AND CLOSE>REF(HIGH,2),1,IF(BARSLAST(立桩量)=3 AND CLOSE>REF(HIGH,3),1,0)));
突破:=TJ2=1;
TJ3:=IF(BARSLAST(立桩量)=1 AND CLOSE>REF(LOW,1),1,IF(BARSLAST(立桩量)=2 AND CLOSE>REF(LOW,2),1,IF(BARSLAST(立桩量)=3 AND CLOSE>REF(LOW,3),1,0)));
三天法则:=TJ3=1;
成立:=三天法则 AND 突破;
条件成立:FILTER(成立,3),LINETHICK0;
STICKLINE(条件成立,O,C,3.5,0),COLORYELLOW,layer0;
DRAWTEXT(条件成立,H*1.025,'立桩量'),COLORYELLOW;
{45度异动}
xx1:=(C+L+H)/3;
bbb13:=atan(ema(xx1,13)-ref(ema(xx1,13),1))*3.1416*10;
ema8:=ema(c,8);
DRAWTEXT(filter(bbb13>1 and ema(xx1,13)>ref(ema(xx1,8),1),10),
ema8,'∠45上升'),colorffffff;
{上漲三角形:紅色三角形畫完出局; 下跌三角形:白色三角形畫完介入}
A1:=REF(HIGH,3)=HHV(HIGH,2*3+1); B1:=FILTER(A1,3); C1:=BACKSET(B1,3+1); D1:=FILTER(C1,3);{高点}
A2:=REF(LOW,3)=LLV(LOW,2*3+1); B2:=FILTER(A2,3); C2:=BACKSET(B2,3+1); D2:=FILTER(C2,3);{低点}
E1:=(REF(LLV(LOW,2*3),1)+REF(HHV(HIGH,2*3),1))/2; E2:=(HIGH+LOW)/2;{高低点出现在同一K线上时可作取舍}
H1:=(D1 AND NOT(D2 AND E1>=E2)) OR BARSTATUS=2 OR BARSCOUNT(CLOSE)=1;
H2:=D1 AND NOT(D2 AND E1>=E2);
L1:=D2 AND NOT(D1 AND E1=E2);
X1:=REF(BARSLAST(H1),1)+1; F1:=BACKSET(H1 AND COUNT(L1,X1)>0,LLVBARS(IF(L1,LOW,10000),X1));
G1:=F1>REF(F1,1); I1:=BACKSET(G1,2); LD:=I1>REF(I1,1);{过滤后低点}
L2:=LD OR BARSTATUS=2 OR BARSCOUNT(CLOSE)=1;
X2:=REF(BARSLAST(L2),1)+1; F2:=BACKSET(L2 AND COUNT(H2,X2)>0,HHVBARS(IF(H2,HIGH,0),X2));
G2:=F2>REF(F2,1); I2:=BACKSET(G2,2); HD:=I2>REF(I2,1);{过滤后高点}
J1:=BACKSET(BARSTATUS=2,MIN(BARSLAST(HD),BARSLAST(LD))+1); J2:=J1>REF(J1,1);
A3:=H; B3:=REF(H,REF(BARSLAST(HD),1)+1)>REF(H,REF(BARSLAST(HD),1)+2+REF(BARSLAST(HD),REF(BARSLAST(HD),1)+2));
D3:=A3 AND B3 AND HD; E3:=BACKSET(D3,REF(BARSLAST(HD),1)+2); HH:=E3>REF(E3,1);{找出全部长期高点}
A4:=L>REF(L,REF(BARSLAST(LD),1)+1);
B4:=REF(L,REF(BARSLAST(LD),1)+1); D4:=A4 AND B4 AND LD; E4:=BACKSET(D4,REF(BARSLAST(LD),1)+2); LL:=E4>REF(E4,1);{找出全部长期低点}
H3:=HH OR BARSTATUS=2 OR BARSCOUNT(C)=1; {后面进行过滤,方法同前。只是不用考虑高低点出现在同一K线}
X3:=REF(BARSLAST(H3),1)+1; F3:=BACKSET(H3 AND COUNT(LL,X3)>0,LLVBARS(IF(LL,L,POW(10,20)),X3));
G3:=F3>REF(F3,1); I3:=BACKSET(G3,2); LZ:=I3>REF(I3,1); {长期低点,也可供引用}
L4:=LZ OR BARSTATUS=2 OR BARSCOUNT(C)=1;
X4:=REF(BARSLAST(L4),1)+1; F4:=BACKSET(L4 AND COUNT(HH,X4)>0,HHVBARS(IF(HH,H,-POW(10,20)),X4));
G4:=F4>REF(F4,1); I4:=BACKSET(G4,2); HZ:=I4>REF(I4,1);{长期高点,也可供引用}
K1:=BACKSET(BARSTATUS=2,MIN(BARSLAST(HZ),BARSLAST(LZ))+1); K2:=K1>REF(K1,1);
UU:=BACKSET(BARSTATUS=2,BARSLAST(LD)+1);VV:=UU>REF(UU,1);
WW:=BACKSET(VV,REF(BARSLAST(LD),1)+2);
XX:=WW>REF(WW,1);
UU2:=BACKSET(BARSTATUS=2,BARSLAST(HD)+1);VV2:=UU2>REF(UU2,1);
WW2:=BACKSET(VV2,REF(BARSLAST(HD),1)+2);
XX2:=WW2>REF(WW2,1);
前一低:REF(L,BARSLAST(VV)),COLOR99FF66,POINTDOT,LINETHICK0;
前二低:REF(L,BARSLAST(XX)),COLORFF66FF,POINTDOT,LINETHICK0;
前一高:REF(H,BARSLAST(VV2)),COLOR99FF66,POINTDOT,LINETHICK0;
前二高:REF(H,BARSLAST(XX2)),COLORFF66FF,POINTDOT,LINETHICK0;
短高:=REF(H,BARSLAST(VV2));短低:=REF(L,BARSLAST(VV));
短比: (C-短低)/(短高-短低),LINETHICK0;
{以下语句为三角形部分}
底:REF(L,BARSLAST(VV)),COLORred,LINETHICK2;
頂:REF(H,BARSLAST(VV2)),COLORGreen,LINETHICK2;
{下跌三角形:白色三角形畫完介入}
StickLine(VV,頂,底,0,0),Colorffffff,linethick3;{}
DRAWLINE(VV2,H,VV,L,0),Colorffffff,linethick3;{斜}
DRAWLINE(VV2,H,VV,頂,0),Colorffffff,linethick3;{?}
{上漲三角形:紅色三角形畫完出局}
StickLine(VV2 ,頂,底,0,0),Colorred,linethick3;{}
DRAWLINE(VV,L,VV2,H,0),Colorred,linethick3;{斜}
DRAWLINE(VV,L,VV2,底,0),Colorred,linethick3;{?};
{上下轨}
平衡:EMA(C,20),CIRCLEDOT,COLORwhite,LINETHICK0;
上轨:平衡 + 2*STD(C,20),LINETHICK1,COLORFF00FF;
下轨:平衡 - 2*STD(C,20),LINETHICK1,COLORblue;
{STICKLINE((CLOSE >平衡),平衡,平衡,1,0),LINETHICK2,color0000ff;
STICKLINE((平衡 > CLOSE),平衡,平衡,1,0),LINETHICK2,colorff6600;}
STICKLINE(CLOSE>OPEN,OPEN,LOW,0.5,0 ),COLOR0000FF;
STICKLINE(CLOSE>OPEN,CLOSE,HIGH,0.5 ,0 ),COLOR0000FF;
STICKLINE(OPEN>=CLOSE,CLOSE,LOW,0.5 ,0 ),COLOR00FF00;
STICKLINE(OPEN>=CLOSE,OPEN,HIGH,0.5 ,0 ),COLOR00FF00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,7,0 ),COLORff7700;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,6,0 ),COLORff9900;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,5,0 ),COLORffbb00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,4,0 ),COLORffcc00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,3,0 ),COLORffdd00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,2,0 ),COLORffee00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,1,0 ),COLORffFF00;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,7,0) ,COLOR000055;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,6,0) ,COLOR000066;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,5,0) ,COLOR000077;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,4,0) ,COLOR000099;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,3,0) ,COLOR0000bb;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,2,0) ,COLOR |