{主图为变色k线}
MA1:MA(C,5);
MA2:MA(C,10);
MA3:MA(C,20);
DRAWKLINE(H,O,L,C);
MID_DX:=(3*C+L+H)/5;
乾坤线:=WMA(MID_DX,20);
乾:=IF(C>REF(乾坤线,1),乾坤线,DRAWNULL);
坤:=IF(C[
{买卖线}]
STICKLINE(ISLASTBAR AND C>乾坤线,乾坤线,乾坤线,60,0),COLOR0000FF;
STICKLINE(ISLASTBAR AND C<乾坤线,乾坤线,乾坤线,60,0),COLOR00FF00;
{变色K线}
STICKLINE(C>乾 AND O>=C,C,O,-1,0),COLORRED;
STICKLINE(C>乾 AND O>=C,L,H,0,0),COLORRED;
STICKLINE(C<=乾 AND O<=C,O,C,-1,1),COLORCYAN;
STICKLINE(C<=乾 AND O<=C,O,L,0,1),COLORCYAN;
STICKLINE(C==乾 AND O<=C,C,H,0,1),COLORCYAN;
{---------------账户提示框---------------}
DRAwrECTREL(IF(TOTALBARSCOUNT>60,0,455),280,IF(TOTALBARSCOUNT>60,330,736),590,RGB(18,71,55));
DRAWRECTREL(IF(TOTALBARSCOUNT>60,276,736),280,IF(TOTALBARSCOUNT>60,330,790),590,RGB(24,105,72));
DRAWRECTREL(IF(TOTALBARSCOUNT>60,0,455),590,IF(TOTALBARSCOUNT>60,200,660),690,RGB(24,105,72));
DRAWRECTREL(IF(TOTALBARSCOUNT>60,200,660),590,IF(TOTALBARSCOUNT>60,330,790),690,RGB(24,105,72));
{账户统计}
股一成本:=20.993; 股一数量:=600; 股一现价:="600903$C";股1:='600903';
股二成本:=11.872; 股二数量:= 200; 股二现价:="600740$C";股2:='600740';
股三成本:=24.753; 股三数量:=500 ; 股三现价:="000786$C";股3:='000786';
股四成本:=5.822 ; 股四数量:=1000; 股四现价:="000725$C";股4:='000725';
股五成本:= 6.114; 股五数量:=1000; 股五现价:="601899$C";股5:='601899';
DRAWTEXT_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.005,0.46),0.34,0,'贵州燃气'),COLORCYAN;
DRAWTEXT_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.005,0.46),0.39,0,'山西焦化'),COLORYELLOW;
DRAWTEXT_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.005,0.46),0.44,0,'北新建材'),COLORCYAN;
DRAWTEXT_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.005,0.46),0.49,0,'京东方A'),COLORYELLOW;
DRAWTEXT_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.005,0.46),0.54,0,'紫金矿业'),COLORCYAN;
{--------------以上股票代码和名称应与自己持股作修改--------------}
DRAWTEXT_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.015,0.47),0.29,0,'股名'),COLORYELLOW;
DRAWTEXT_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.063,0.518),0.29,0,'持仓'),COLORYELLOW;
DRAWTEXT_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.105,0.56),0.29,0,'成本'),COLORYELLOW;
DRAWTEXT_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.151,0.606),0.29,0,'涨跌'),COLORYELLOW;
DRAWTEXT_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.195,0.65),0.29,0,'涨幅'),COLORYELLOW;
DRAWTEXT_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.241,0.696),0.29,0,'盈亏'),COLORYELLOW;
DRAWTEXT_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.284,0.742),0.39,0,'总盈比'),COLORYELLOW;
DRAWTEXT_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.284,0.742),0.49,0,'现总值'),COLORYELLOW;
{========持股价桌面显示========}
持股价:=IF(CODELIKE(股1),股一成本,IF(CODELIKE(股2),股二成本,IF(CODELIKE(股3),股三成本,
IF(CODELIKE(股4),股四成本,IF(CODELIKE(股5),股五成本,DRAWNULL))))),NODRAW;
买股量:=IF(CODELIKE(股1),股一数量,IF(CODELIKE(股2),股二数量,IF(CODELIKE(股3),股三数量,
IF(CODELIKE(股4),股四数量,IF(CODELIKE(股5),股五数量,DRAWNULL))))),NODRAW;
STICKLINE(CONST(持股价)>1 AND CURRBARSCOUNT<14,CONST(持股价),CONST(持股价),2,0),LINETHICK2,COLORYELLOW;
STICKLINE(CURRBARSCOUNT>13 AND CURRBARSCOUNT<28 AND CONST(持股价)>1 ,持股价+持股价*0.013,
持股价-持股价*0.01,4,0),COLOR39049D ;
DRAWTEXT(CONST(持股价)>1 AND CURRBARSCOUNT=27,CONST(持股价),STRCAT(STRCAT(STRCAT
(CON2STR(持股价,2),'元,持'),CON2STR(买股量,0)),' 股')),COLORWHITE;
{-------------------------主图黄金分割部分有未来函数-------------------------}
HH:=HHV(H,120);
LL:=LLV(L,120);
上涨:=BARSSINCE(BacKSET(ISLASTBAR,BArslAST(L==LL)+1));
下跌:=BARSSINCE(BACKSET(ISLASTBAR,BARSLAST(H==HH)+1));
判断:=下跌 OR 上涨 OR 上涨==0 OR 下跌==0;
天线:=IFF(判断,REFDATE(REF(H,下跌),DATE),DRAWNULL);
地线:=IFF(判断,REFDATE(REF(L,上涨),DATE),DRAWNULL);
风险:=IFF(判断,REFDATE((天线-地线)*0.809+地线,DATE),DRAWNULL);
警示:=IFF(判断,REFDATE((天线-地线)*0.618+地线,DATE),DRAWNULL);
中线:=IFF(判断,REFDATE((天线-地线)*0.5+地线,DATE),DRAWNULL);
关注:=IFF(判断,REFDATE((天线-地线)*0.382+地线,DATE),DRAWNULL);
低吸:=IFF(判断,REFDATE((天线-地线)*0.191+地线,DATE),DRAWNULL);
STICKLINE(判断,天线,天线,1,0),COLORFF0000;
STICKLINE(判断,地线,地线,1,0),COLOR00FF00;
定位:=FILTER(BACKSET(ISLASTBAR,30),30);
STICKLINE(定位,天线,地线,0,-1),COLORAAB8F7;
STICKLINE(BACKSET(定位,1),风险*1.001,风险,12,0),COLORF04D23;
STICKLINE(BACKSET(定位,1),警示*1.001,警示,12,0),COLORF98E87;
STICKLINE(BACKSET(定位,1),关注*1.001,关注,12,0),COLOR6855EE;
STICKLINE(BACKSET(定位,1),低吸*1.001,低吸,12,0),COLOR0000FF;
DRAWTEXT(BACKSET(定位,1),天线-(天线-风险)/2,'风险'),COLORF04D23;
DRAWTEXT(BACKSET(定位,1),风险-(风险-警示)/2,'警示'),COLORF98E87;
DRAWTEXT(BACKSET(定位,1),中线,' ↑↓'),COLORWHITE;
DRAWTEXT(BACKSET(定位,1),低吸+(关注-低吸)/2,'关注'),COLOR647CF0;
DRAWTEXT(BACKSET(定位,1),地线+(低吸-地线)/2,'低吸'),COLOR1333C8;
{---------------------以下账户统计部分---------------------}
股一盈亏:=INTPART((股一现价-股一成本)*股一数量);
股二盈亏:=INTPART((股二现价-股二成本)*股二数量);
股三盈亏:=INTPART((股三现价-股三成本)*股三数量);
股四盈亏:=INTPART((股四现价-股四成本)*股四数量);
股五盈亏:=INTPART((股五现价-股五成本)*股五数量);
股一涨幅:=(股一现价-股一成本)/股一成本*100;
股二涨幅:=(股二现价-股二成本)/股二成本*100;
股三涨幅:=(股三现价-股三成本)/股三成本*100;
股四涨幅:=(股四现价-股四成本)/股四成本*100;
股五涨幅:=(股五现价-股五成本)/股五成本*100;
股一涨跌:=CONST(股一现价-股一成本);
股二涨跌:=CONST(股二现价-股二成本);
股三涨跌:=CONST(股三现价-股三成本);
股四涨跌:=CONST(股四现价-股四成本);
股五涨跌:=CONST(股五现价-股五成本);
DRAWNUMBER_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.06,0.515),0.34,0,股一数量),COLORCYAN;
DRAWNUMBER_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.06,0.515),0.39,0,股二数量),COLORYELLOW;
DRAWNUMBER_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.06,0.515),0.44,0,股三数量),COLORCYAN;
DRAWNUMBER_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.06,0.515),0.49,0,股四数量),COLORYELLOW;
DRAWNUMBER_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.06,0.515),0.54,0,股五数量),COLORCYAN;
DRAWNUMBER_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.097,0.553),0.34,0,股一成本),COLORCYAN;
DRAWNUMBER_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.097,0.553),0.39,0,股二成本),COLORYELLOW;
DRAWNUMBER_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.097,0.553),0.44,0,股三成本),COLORCYAN;
DRAWNUMBER_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.097,0.553),0.49,0,股四成本),COLORYELLOW;
DRAWNUMBER_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.097,0.553),0.54,0,股五成本),COLORCYAN;
DRAWNUMBER_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.146,0.601),0.34,0,股一涨跌),COLORCYAN;
DRAWNUMBER_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.146,0.601),0.39,0,股二涨跌),COLORYELLOW;
DRAWNUMBER_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.146,0.601),0.44,0,股三涨跌),COLORCYAN;
DRAWNUMBER_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.146,0.601),0.49,0,股四涨跌),COLORYELLOW;
DRAWNUMBER_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.146,0.601),0.54,0,股五涨跌),COLORCYAN;
DRAWNUMBER_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.188,0.643),0.34,0,CONST(股一涨幅)),COLORCYAN;
DRAWNUMBER_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.188,0.643),0.39,0,CONST(股二涨幅)),COLORYELLOW;
DRAWNUMBER_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.188,0.643),0.44,0,CONST(股三涨幅)),COLORCYAN;
DRAWNUMBER_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.188,0.643),0.49,0,CONST(股四涨幅)),COLORYELLOW;
DRAWNUMBER_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.188,0.643),0.54,0,CONST(股五涨幅)),COLORCYAN;
DRAWNUMBER_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.237,0.693),0.34,0,CONST(股一盈亏)),COLORCYAN;
DRAWNUMBER_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.237,0.693),0.39,0,CONST(股二盈亏)),COLORYELLOW;
DRAWNUMBER_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.237,0.693),0.44,0,CONST(股三盈亏)),COLORCYAN;
DRAWNUMBER_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.237,0.693),0.49,0,CONST(股四盈亏)),COLORYELLOW;
DRAWNUMBER_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.237,0.693),0.54,0,CONST(股五盈亏)),COLORCYAN;
总盈:=CONST(股一盈亏)+CONST(股二盈亏)+CONST(股三盈亏)+CONST(股四盈亏)+CONST(股五盈亏);
DRAWTEXT_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.284,0.742),0.29,0,'总盈值'),COLORYELLOW;
DRAWNUMBER_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.284,0.742),0.34,0,CONST(总盈)),COLORCYAN;
总成本:=CONST((股一成本*股一数量)+(股二成本*股二数量)+(股三成本*股三数量)+
(股四成本*股四数量)+(股五成本*股五数量));
总盈比:=总盈/总成本*100;
DRAWNUMBER_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.284,0.742),0.44,0,CONST(总盈比)),COLORCYAN;
股一现值:=股一数量*股一现价;
股二现值:=股二数量*股二现价;
股三现值:=股三数量*股三现价;
股四现值:=股四数量*股四现价;
股五现值:=股五数量*股五现价;
总市值:=股一现值+股二现值+股三现值+股四现值+股五现值;
DRAWNUMBER_FIX(C!=0,IF(TOTALBARSCOUNT>60,0.284,0.742),0.54,0,CONST(总市值)),COLORCYAN;
{----------------dmi趋势转向及操作提示部分------------------}
MTR:=EMA(MAX(MAX(HIGH-LOW,Abs(HIGH-REF(CLOSE,1))),ABS(REF(CLOSE,1)-LOW)),13);
HD:=HIGH-REF(HIGH,1);
LD:=REF(LOW,1)-LOW;
DMP:=EXPMEMA(IF(HD>0&&HD>LD,HD,0),13);
DMM:=EXPMEMA(IF(LD>0&&LD>HD,LD,0),13);
pdi:=DMP*100/MTR;
mdi:=DMM*100/MTR;
牛:=PDI-22;
熊:=MDI-22;
多:=EXPMEMA((PDI-MDI)/(MDI+PDI)*100,3);
空:=EXPMEMA(多,5);
熊市:=熊>牛;
牛市:=牛>熊;
涨:=多>空;
跌:=空>多;
牛上:=PDI>DMI AND 多>=30;
牛下:=PDI=30;
牛盘整:=牛>熊 AND 多>16 AND 多<30;
熊盘整:=牛<熊 AND 多>16 AND 多<30;
熊空:=牛<熊 AND 多<空;
持股:=牛市 AND 涨 AND 多<60;
多顶:=牛市 AND 涨 AND 多>60;
慎:=熊市 AND 涨;
空持:=熊市 AND 跌;
多持:=牛市 AND 跌;
买:=crOSS(多,空);
卖:=CROSS(空,多);
DRAWTEXT_FIX(ISLASTBAR,IF(TOTALBARSCOUNT>60,0.23,0.691),0.6,0,'短 线 提 示'),COLORYELLOW;
DRAWTEXT_FIX(买 AND ISLASTBAR,IF(TOTALBARSCOUNT>60,0.29,0.756),0.64,0,'买入'),COLORMAGENTA;
DRAWTEXT_FIX(卖 AND ISLASTBAR,IF(TOTALBARSCOUNT>60,0.29,0.756),0.64,0,'卖出'),COLORCYAN;
DRAWTEXT_FIX(持股 AND ISLASTBAR,IF(TOTALBARSCOUNT>60,0.215,0.756),0.64,0,'持股'),COLORMAGENTA;
DRAWTEXT_FIX(多顶 AND ISLASTBAR,IF(TOTALBARSCOUNT>60,0.213,0.67),0.64,0,'注 意 顶 部'),COLORMAGENTA;
DRAWTEXT_FIX(慎 AND ISLASTBAR,IF(TOTALBARSCOUNT>60,0.213,0.67),0.64,0,'谨 慎 持 股'),COLORMAGENTA;
DRAWTEXT_FIX(多持 AND ISLASTBAR,IF(TOTALBARSCOUNT>60,0.213,0.67),0.64,0,'避 险 持 币'),COLORCYAN;
DRAWTEXT_FIX(空持 AND ISLASTBAR,IF(TOTALBARSCOUNT>60,0.213,0.67),0.64,0,'走 熊 持 币'),COLORCYAN;
DRAWTEXT_FIX(ISLASTBAR,IF(TOTALBARSCOUNT>60,0.04,0.497),0.6,0,'牛 熊 及 趋 势'),COLORYELLOW;
DRAWTEXT_FIX(牛上 AND ISLASTBAR,IF(TOTALBARSCOUNT>60,0.048,0.507),0.64,0,'牛 市 趋 势 向 上'),COLORMAGENTA;
DRAWTEXT_FIX(牛下 AND ISLASTBAR,IF(TOTALBARSCOUNT>60,0.048,0.507),0.64,0,'牛 市 趋 势 向 下'),COLORCYAN;
DRAWTEXT_FIX(牛盘整 AND ISLASTBAR,IF(TOTALBARSCOUNT>60,0.068,0.525),0.64,0,'略 牛 盘 整'),COLORMAGENTA;
DRAWTEXT_FIX(熊盘整 AND ISLASTBAR,IF(TOTALBARSCOUNT>60,0.068,0.525),0.64,0,'略 熊 盘 整'),COLORCYAN;
DRAWTEXT_FIX(熊空 AND ISLASTBAR,IF(TOTALBARSCOUNT>60,0.068,0.525),0.64,0,'熊 市 休 息'),COLORCYAN;