今天把我的这个【工具公式】完善,供新手学习
本公式主要功能:
⑴ 各种立体彩色K线的绘制方法。
⑵ 变色线的绘制方法。
⑶ 彩带的绘制方法。
⑷ 引用公式的运用。
⑸ 上下箭头的标注方法。
⑹ 财务数据的引用。
⑺ 文字提示说明。
⑻ 输出修饰函数的说明。
⑼ 还有更多功能等您去发掘。
授人以鱼不如授人以渔,
弄清了此公式您就是一个指标老手了。
{公式名称:【工具公式】-【主图】}
INPUT: P1(5,0,100),P2(10,0,100),P3(20,0,100),P4(30,0,600),P5(120,0,600);
{input:p1(60),p2(5),p3(10);只限最大为100}
DRAWGBKLAST(v>1,STRIP(RGB(00,0,0),RGB(90,90,90),0));
{DRAWGBKLAST(DATE>900101,STRIP(RGB(5,125,5),RGB(5,25,5),0));绿色渐变背景}
DRAWTEXTABS(12,25,'总股本:'+NUMTOSTRn(FINANCE2(35),0)+'万股' +' 流通A股:'+NUMTOSTRn(FINANCE2(37),0)+'万股'+' 市盈率:'+NUMTOSTRn(DYNAINFO(39),2)+' 倍'+' 每股收益:'+NUMTOSTRn(FINANCE2(3),3)+' 元'),Color00ff00;
DRAWTEXTABS(12,40,BKNAME),COLOR00FFFF;
RH:=H-L;
R:=DYNAINFO(13)*100;
DRAWTEXTREL(95,25,' 当天振幅:'+NUMTOSTRN(R,2)+'% ['+NUMTOSTRN(RH,2)+'元 ]'),Color00FF00;
x1:=(C+L+H)/3;
bb13:=atan(ema(x1,13)-ref(ema(x1,13),1))*3.1416*10;
ema8:=ema(c,8);
DRAWTEXT(filter(bb13>1 and ema(x1,13)>ref(ema(x1,8),1),10),
ema8,'∠45上升'),colorwhite;
{均线色}
MA1:MA(CLOSE,P1),COLORFFFFFF;{白色}
MA2:MA(CLOSE,P2),COLOR00FFFF;{黄s}
MA3:MA(CLOSE,P3),COLORFF00FF;{洋红色}
MA4:MA(CLOSE,P4),COLOR00FF00;{绿色}
MA5:MA(CLOSE,P5),COLORFFFF00;{淡蓝色}
安全线: EMA(CLOSE,55),CIRCLEDOT{小园圈画线},COLOR0000FF;
{画变色线}
PARTLINE(MA5,MA5<C),LINETHICK3{输出线宽控制符},COLOR0000FF;
PARTLINE(MA5,MA5>C),LINETHICK3{输出线宽控制符},COLOR00FF00;
PARTLINE(安全线,安全线<C),CIRCLEDOT{小园圈画线},COLOR0000FF;
PARTLINE(安全线,安全线>C),CIRCLEDOT{小园圈画线},COLOR00FF00;
{画变色彩带}
FILLRGN(MA3,MA1,MA3<MA1,RGB(250,0,0),MA3>MA1,RGB(0,100,200));
{画箭头符号}
LC:=REF(CLOSE,1);
RSI:=((SMA(MAX((CLOSE - LC),0),3,1) / SMA(ABS((CLOSE - LC)),3,1)) * 100);
RSV:=(C-LLV(L,9))/(HHV(H,9)-LLV(L,9))*100;
K:=SMA(RSV,3,1);D:=SMA(K,3,1);J:=3*K-2*D;BD:=LLV(J,2)=LLV(J,8);
抄底选股:(CROSS(J,REF(J+0.01,1)) AND BD AND J<20),LINETHICK0{不在图中显示此线};
DRAWICON(CROSS(J,REF(J+0.01,1)) AND BD AND J<20,L*0.98,7),LAYER0{箭头符号居上层},ALIGN1;{箭头符号居中}
DRAWICON(CROSS(88,RSI),H*1.02,8),LAYER0{箭头符号居上层},ALIGN1;{箭头符号居中}
DRAWTEXTREL(6,25,'⊙蓝抛,银灰跌,绿买,粉变,红持⊙'),COLORFF11FF,LINETHICK3;
{看色买卖}
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,8,0 ),COLORFF6600;
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,8,0) ,COLOR000033;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,6,0) ,COLOR000066;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,4,0) ,COLOR000099;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,3,0) ,COLOR0000BB;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,1,0) ,COLOR0000DD;
VAR9Q:=C= HHV(C,4)AND (REF(C,1)>=REF(C,2) OR REF(C,1)>=REF (C,3)) OR REF(C,1)=HHV(C,4) AND CLOSE>=REF(C,2) OR REF(C,2) =HHV(C,4) AND REF(C,3)=LLV(C,4) AND C>=REF(C,1) OR REF(C,3) =HHV(C,4) AND C>=REF(C,1) AND C>=REF(C,2);
红持:var9Q,color0000ff,LINETHICK0;
{立体柱子:红色}
STICKLINE(VAR9Q,C,(O+C)/2,8,0),COLOR000044;
STICKLINE(VAR9Q,C,(O+C)/2,7,0),COLOR000055;
STICKLINE(VAR9Q,C,(O+C)/2,6,0),COLOR000066;
STICKLINE(VAR9Q,C,(O+C)/2,5,0),COLOR000077;
STICKLINE(VAR9Q,C,(O+C)/2,4,0),COLOR000099;
STICKLINE(VAR9Q,C,(O+C)/2,3,0),COLOR0000BB;
STICKLINE(VAR9Q,C,(O+C)/2,2,0),COLOR0000DD;
STICKLINE(VAR9Q,C,(O+C)/2,1,0),COLOR0000FF;
VARAQ:=C=HHV(C,4) AND REF(C,1)=LLV(C,4);
粉变:varaQ,colorff99ff,LINETHICK0;
STICKLINE(VARAQ,C,(O+C)/2,8,0),COLORFF11FF;
STICKLINE(VARAQ,C,(O+C)/2,7,0),COLORFF22FF;
STICKLINE(VARAQ,C,(O+C)/2,6,0),COLORFF33FF;
STICKLINE(VARAQ,C,(O+C)/2,5,0),COLORFF55FF;
STICKLINE(VARAQ,C,(O+C)/2,4,0),COLORFF77FF;
STICKLINE(VARAQ,C,(O+C)/2,3,0),COLORFF99FF;
STICKLINE(VARAQ,C,(O+C)/2,2,0),COLORFFBBFF;
STICKLINE(VARAQ,C,(O+C)/2,1,0),COLORFFDDFF;
VARBQ:=C=LLV(C,4) AND (REF(C,1)<REF(C,2) OR REF(C,1)<REF(C,3)) OR REF(C,1)=LLV(C,4) AND C<REF(C,2) OR REF(C,2)=LLV(C,4) AND REF(C,1)<>HHV(C,4) AND C<REF(C,1) OR REF(C,3)=LLV(C,4) AND C<REF(C,1) AND C<REF(C,2);
银灰跌:varbQ,color888888,LINETHICK0;
{立体柱子:银色}
STICKLINE(VARBQ,C,(O+C)/2,8,0),COLOR333333;
STICKLINE(VARBQ,C,(O+C)/2,7,0),COLOR444444;
STICKLINE(VARBQ,C,(O+C)/2,6,0),COLOR555555;
STICKLINE(VARBQ,C,(O+C)/2,5,0),COLOR777777;
STICKLINE(VARBQ,C,(O+C)/2,4,0),COLOR999999;
STICKLINE(VARBQ,C,(O+C)/2,3,0),COLORBBBBBB;
STICKLINE(VARBQ,C,(O+C)/2,2,0),COLORDDDDDD;
STICKLINE(VARBQ,C,(O+C)/2,1,0),COLORFFFFFF;
VARCQ:=REF(C,1)=LLV(C,4) AND C>=REF(C,2) OR REF(C,2)=LLV(C,4) AND REF(C,1)<=REF(C,3) AND REF(C,2)<REF(C,4) AND C>=REF(C,1);
绿买:varcQ,color00ff00,LINETHICK0;
{立体柱子:绿色}
STICKLINE(VARCQ,O,(O+C)/2,8,0),COLOR004400;
STICKLINE(VARCQ,O,(O+C)/2,6,0),COLOR005500;
STICKLINE(VARCQ,O,(O+C)/2,5,0),COLOR007700;
STICKLINE(VARCQ,O,(O+C)/2,4,0),COLOR009900;
STICKLINE(VARCQ,O,(O+C)/2,3,0),COLOR00BB00;
STICKLINE(VARCQ,O,(O+C)/2,2,0),COLOR00DD00;
STICKLINE(VARCQ,O,(O+C)/2,1,0),COLOR00FF00;
VARDQ:=REF(C,1)=HHV(C,4) AND C<REF(C,2) OR (REF(C,2)=HHV(C,4) AND REF(C,1)>REF(C,3) OR REF(C,3)=HHV(C,4) AND REF(C,1)>REF (C,2)) AND REF(C,2)>=REF(C,4) AND C<REF(C,1);
蓝抛:vardQ,colorff9900,LINETHICK0;
{立体柱子:深蓝色}
STICKLINE(VARDQ,O,(O+C)/2,8,0),COLORFF1100;
STICKLINE(VARDQ,O,(O+C)/2,7,0),COLORFF2200;
STICKLINE(VARDQ,O,(O+C)/2,6,0),COLORFF3300;
STICKLINE(VARDQ,O,(O+C)/2,5,0),COLORFF5500;
STICKLINE(VARDQ,O,(O+C)/2,4,0),COLORFF7700;
STICKLINE(VARDQ,O,(O+C)/2,3,0),COLORFF9900;
STICKLINE(VARDQ,O,(O+C)/2,2,0),COLORFFBB00;
STICKLINE(VARDQ,O,( |