通达信比较新颖的箱体主图指标源码
HH:=HHV(H,30);
LL:=LLV(L,30);
上涨:=BARSSINCE(BACKSET(ISLASTBAR,BARSLAST(L==LL)+1)),NODRAW,COLOR0000FF;
下跌:=BARSSINCE(BACKSET(ISLASTBAR,BARSLAST(H==HH)+1)),NODRAW,COLOR00FF00;
空间%:=(C/REF(L,上涨)-1)*100,NODRAW,COLOR00FFFF;
最高%:=(HH/REF(L,上涨)-1)*100,NODRAW,COLORFF00FF;
空间%:=(C/REF(H,下跌)-1)*100,NODRAW,COLOR888899;
最低%:=(LL/REF(H,下跌)-1)*100,NODRAW,COLORFF0000;
判断:=下跌 OR 上涨 OR 上涨==0 OR 下跌==0;
天线:=IFF(判断,REFDATE(REF(H,下跌),DATE),DRAWNULL),POINTDOT,LINETHICK3,COLOR00FF00;
地线:=IFF(判断,REFDATE(REF(L,上涨),DATE),DRAWNULL),POINTDOT,LINETHICK3,COLOR0000FF;
中线:=IFF(判断,REFDATE((天线-地线)*0.5+地线,DATE),DRAWNULL),POINTDOT,LINETHICK3,COLORWHITE;
低吸:=IFF(判断,REFDATE((天线-地线)*0.191+地线,DATE),DRAWNULL),POINTDOT,LINETHICK3,COLOR0066FF;
关注:=IFF(判断,REFDATE((天线-地线)*0.382+地线,DATE),DRAWNULL),POINTDOT,LINETHICK3,COLOR00CCFF;
警示:=IFF(判断,REFDATE((天线-地线)*0.618+地线,DATE),DRAWNULL),POINTDOT,LINETHICK3,COLORCCFF00;
风险:=IFF(判断,REFDATE((天线-地线)*0.809+地线,DATE),DRAWNULL),POINTDOT,LINETHICK3,COLOR66FF00;
STICKLINE(1,地线,地线+(中线-地线)*(20/20),12,0),COLOR000000;
STICKLINE(1,地线,地线+(中线-地线)*(19/20),12,0),COLOR000008;
STICKLINE(1,地线,地线+(中线-地线)*(18/20),12,0),COLOR000010;
STICKLINE(1,地线,地线+(中线-地线)*(17/20),12,0),COLOR000018;
STICKLINE(1,地线,地线+(中线-地线)*(16/20),12,0),COLOR000020;
STICKLINE(1,地线,地线+(中线-地线)*(15/20),12,0),COLOR000028;
STICKLINE(1,地线,地线+(中线-地线)*(14/20),12,0),COLOR000030;
STICKLINE(1,地线,地线+(中线-地线)*(13/20),12,0),COLOR000038;
STICKLINE(1,地线,地线+(中线-地线)*(12/20),12,0),COLOR000040;
STICKLINE(1,地线,地线+(中线-地线)*(11/20),12,0),COLOR000048;
STICKLINE(1,地线,地线+(中线-地线)*(10/20),12,0),COLOR000050;
STICKLINE(1,地线,地线+(中线-地线)*(9/20),12,0),COLOR000058;
STICKLINE(1,地线,地线+(中线-地线)*(8/20),12,0),COLOR000060;
STICKLINE(1,地线,地线+(中线-地线)*(7/20),12,0),COLOR000068;
STICKLINE(1,地线,地线+(中线-地线)*(6/20),12,0),COLOR000070;
STICKLINE(1,地线,地线+(中线-地线)*(5/20),12,0),COLOR000078;
STICKLINE(1,地线,地线+(中线-地线)*(4/20),12,0),COLOR000080;
STICKLINE(1,地线,地线+(中线-地线)*(3/20),12,0),COLOR000088;
STICKLINE(1,地线,地线+(中线-地线)*(2/20),12,0),COLOR000090;
STICKLINE(1,地线,地线+(中线-地线)*(1/20),12,0),COLOR000098;
STICKLINE(1,天线,天线-(天线-中线)*(20/20),12,0),COLOR000000;
STICKLINE(1,天线,天线-(天线-中线)*(19/20),12,0),COLOR080800;
STICKLINE(1,天线,天线-(天线-中线)*(18/20),12,0),COLOR101000;
STICKLINE(1,天线,天线-(天线-中线)*(17/20),12,0),COLOR181800;
STICKLINE(1,天线,天线-(天线-中线)*(16/20),12,0),COLOR202000;
STICKLINE(1,天线,天线-(天线-中线)*(15/20),12,0),COLOR282800;
STICKLINE(1,天线,天线-(天线-中线)*(14/20),12,0),COLOR303000;
STICKLINE(1,天线,天线-(天线-中线)*(13/20),12,0),COLOR383800;
STICKLINE(1,天线,天线-(天线-中线)*(12/20),12,0),COLOR404000;
STICKLINE(1,天线,天线-(天线-中线)*(11/20),12,0),COLOR484800;
STICKLINE(1,天线,天线-(天线-中线)*(10/20),12,0),COLOR505000;
STICKLINE(1,天线,天线-(天线-中线)*(9/20),12,0),COLOR585800;
STICKLINE(1,天线,天线-(天线-中线)*(8/20),12,0),COLOR606000;
STICKLINE(1,天线,天线-(天线-中线)*(7/20),12,0),COLOR686800;
STICKLINE(1,天线,天线-(天线-中线)*(6/20),12,0),COLOR707000;
STICKLINE(1,天线,天线-(天线-中线)*(5/20),12,0),COLOR787800;
STICKLINE(1,天线,天线-(天线-中线)*(4/20),12,0),COLOR808000;
STICKLINE(1,天线,天线-(天线-中线)*(3/20),12,0),COLOR888800;
STICKLINE(1,天线,天线-(天线-中线)*(2/20),12,0),COLOR909000;
STICKLINE(1,天线,天线-(天线-中线)*(1/20),12,0),COLOR989800;
STICKLINE(判断,天线,天线*1.003,20,0),COLOR00C6FF;
STICKLINE(判断,地线,地线*0.997,20,0),COLOR00C6FF;
外框定位:=FILTER(BACKSET(ISLASTBAR,30),30);
STICKLINE(外框定位,天线,地线,2,0),COLOR00C6FF;
STICKLINE(BACKSET(外框定位,8),风险*1.001,风险*0.999,12,0),COLOR00C6FF;
STICKLINE(BACKSET(外框定位,8),低吸*1.001,低吸*0.999,12,0),COLOR00C6FF;
STICKLINE(BACKSET(外框定位,8),关注*1.001,关注*0.999,12,0),COLOR00C6FF;
STICKLINE(BACKSET(外框定位,8),警示*1.001,警示*0.999,12,0),COLOR00C6FF;
STICKLINE(BACKSET(外框定位,1),中线*1.001,中线*0.999,12,0),COLOR00C6FF;
STICKLINE(EXIST(外框定位,20),风险*1.001,风险*0.999,12,0),COLOR00C6FF;
STICKLINE(EXIST(外框定位,20),低吸*1.001,低吸*0.999,12,0),COLOR00C6FF;
STICKLINE(EXIST(外框定位,10),关注*1.001,关注*0.999,12,0),COLOR00C6FF;
STICKLINE(EXIST(外框定位,10),警示*1.001,警示*0.999,12,0),COLOR00C6FF;
STICKLINE(EXIST(外框定位,5),中线*1.001,中线*0.999,12,0),COLOR00C6FF;
STICKLINE(判断 AND CLOSE OPEN,HIGH,CLOSE,0,0),COLORRED;
STICKLINE(判断 AND CLOSE OPEN,LOW,OPEN,0,0),COLORRED;
STICKLINE(判断 AND CLOSE OPEN,CLOSE,OPEN,2,1),COLORRED;
STICKLINE(判断 AND CLOSE==OPEN,HIGH,LOW,0,0),COLORWHITE;
STICKLINE(判断 AND CLOSE==OPEN,CLOSE,OPEN,2,0),COLORWHITE;
STICKLINE(判断 AND CLOSE OPEN,HIGH,LOW,0,0),COLORGREEN;
STICKLINE(判断 AND CLOSE OPEN,CLOSE,OPEN,2,0),COLORGREEN;
操盘线:=EMA(EMA(EMA(CLOSE,2),2),2);
趋势线:(MA(操盘线,3)),COLORCYAN,LINETHICK3;
IF(趋势线 REF(趋势线,1),趋势线,DRAWNULL),COLORRED,LINETHICK3;
IF(趋势线 REF(趋势线,1),趋势线,DRAWNULL),COLORBLACK;
MID_DX:=(3*C+L+H)/5;
乾坤线:WMA(MID_DX,20),COLOR00C6FF;
STICKLINE(上涨==0,天线,天线-0.90*(天线-H),0,0),COLORRED;
STICKLINE(下跌==0,地线,地线+0.90*(L-地线),0,0),COLORGREEN;
STICKLINE(上涨==0,H,L,0,0),COLORRED;
STICKLINE(上涨==0,C,O,3,0),COLORRED;
STICKLINE(下跌==0,H,L,0,0),COLORCYAN;
STICKLINE(下跌==0,C,O,3,0),COLORCYAN;
TRAND:=IFF(REF(乾坤线,1) REF(乾坤线,2),1,0);
TRAND1:=REF(CLOSE,1) =REF(地线,1) AND REF(CLOSE,1) REF(低吸,1),NODRAW;
TRAND2:=REF(CLOSE,1) =REF(低吸,1) AND REF(CLOSE,1) REF(关注,1),NODRAW;
TRAND3:=REF(CLOSE,1) =REF(关注,1) AND REF(CLOSE,1) REF(中线,1),NODRAW;
TRAND4:=REF(CLOSE,1) =REF(中线,1) AND REF(CLOSE,1) REF(警示,1),NODRAW;
TRAND5:=REF(CLOSE,1) =REF(警示,1) AND REF(CLOSE,1) REF(风险,1),NODRAW;
TRAND6:=REF(CLOSE,1) =REF(风险,1) AND REF(CLOSE,1) REF(天线,1),NODRAW;
TEMP:=IFF(TRAND4 AND TRAND==0,中线,IFF(TRAND4 AND TRAND==1,警示,IFF(TRAND5 AND TRAND==0,警示,IFF(TRAND5 AND TRAND==1,风险,IFF(TRAND6 AND TRAND==0,风险,IFF(TRAND6 AND TRAND==1,天线,DRAWNULL))))));
今日目标:=IFF(TRAND1 AND TRAND==0,地线,IFF(TRAND1 AND TRAND==1,低吸,IFF(TRAND2 AND TRAND==0,低吸,IFF(TRAND2 AND TRAND==1,关注,IFF(TRAND3 AND TRAND==0,关注,IFF(TRAND3 AND TRAND==1,中线,TEMP)))))),NODRAW,COLOR1C6CC6;
顶:天线,NODRAW,COLOR00FF00;
险:风险,POINTDOT,COLOR66FF00;
预:警示,POINTDOT,COLORCCFF00;
中:中线,POINTDOT,COLORWHITE;
注:关注,POINTDOT,COLOR00CCFF;
低:低吸,POINTDOT,COLOR0066FF;
底:地线,NODRAW,COLOR0000FF;
DRAWTEXT_FIX(1,0,0.05,0,'【1.乾坤线:乾坤线向上,代表短期价格上升趋势;乾坤线向下,代表短期价格下跌趋势】'),COLORLIGRAY;
DRAWTEXT_FIX(1,0,0.1 ,0,'【2.红色立体K线所在位置为阶段最低点】'),COLORLIGRAY;
DRAWTEXT_FIX(1,0,0.15,0,'【3.蓝色立体K线所在位置为阶段最高点】'),COLORLIGRAY;
DRAWTEXT_FIX(1,0,0.20,0,'【4.风险区:适宜谨慎,随时高抛】'),COLORLIGRAY;
DRAWTEXT_FIX(1,0,0.25,0,'【5.警戒区:注意风险,逢高卖出】'),COLORLIGRAY;
DRAWTEXT_FIX(1,0,0.30,0,'【6.观察区:多空不明,建议观望;】'),COLORLIGRAY;
DRAWTEXT_FIX(1,0,0.35,0,'【7.关注区:风险降低,逢低吸纳】'),COLORLIGRAY;
DRAWTEXT_FIX(1,0,0.40,0,'【8.低吸区:价格洼地,随时抄底】'),COLORLIGRAY;
DRAWTEXT_FIX(1,0,0.45,0,'【9.乾坤线落在某一区域内时,该线所指向的最近一条参考线为短期目标位】'),COLORLIGRAY;
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,COLORFF00FF,LINETHICK2;
DD:=多空线 REF(多空线,1);
IF(DD,多空线,DRAWNULL),COLOR00FFFF,LINETHICK2;
DRAWTEXT_FIX(1,0.00,0,0,'所属地区:')COLOR00FFFF;
DRAWTEXT_FIX(1,0.07,0,0,DYBLOCK)COLOR00FFFF;
DRAWTEXT_FIX(1,0.55,0,0,HYBLOCK),COLORYELLOW;
DRAWTEXT_FIX(1,0.60,0,0,DYBLOCK),COLORYELLOW;
DRAWTEXT_FIX(1,0.65,0,0,GNBLOCK),COLORYELLOW;
DRAWTEXT_FIX(1,0.55,0.06,0,FGBLOCK),COLORRED;
DRAWTEXT_FIX(1,0.55,0.12,0,ZDBLOCK),COLORWHITE ;