以下是工具公式
老虎啸,财神到,股票嗖嗖向上跳。
今天把我的这个【工具公式】完善,供新手学习。
祝同学们身体健康发大财!
⑴ 各种立体彩色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)+’ 元’),Culor00ff00;
DRAWTEXTABS(12,40,BKNAME),COLOR00FFFF;
RH:=H-L;
R:=DYNAINFO(13)*100;
DRAWTEXTREL(95,25,’ 当天振幅:’+NUMTOSTRN(R,2)+’% [‘+NUMTOSTRN(RH,2)+’元 ]’),Culor00FF00;
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;{黄色}
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,(O+C)/2,1,0),COLORFFDD00;
{立体柱子:金色}
ZDF:=(CLOSE-REF(CLOSE,1))/REF(CLOSE,1)*100;
STICKLINE(ZDF>9.8,OPEN,CLOSE,8,0),color004444;
STICKLINE(ZDF>9.8,OPEN,CLOSE,7,0),color005555;
STICKLINE(ZDF>9.8,OPEN,CLOSE,6,0),color006666;
STICKLINE(ZDF>9.8,OPEN,CLOSE,5,0),color007777;
STICKLINE(ZDF>9.8,OPEN,CLOSE,4,0),color009999;
STICKLINE(ZDF>9.8,OPEN,CLOSE,3,0),color00BBBB;
STICKLINE(ZDF>9.8,OPEN,CLOSE,2,0),color00DDDD;
STICKLINE(ZDF>9.8,OPEN,CLOSE,1,0),color00FFFF;
{公式引用示范}
OO:=ma(O,22);j:=”kdj.j#DAY”;
CC:=ma(c,22);hs:=vul/CAPITAL*100;
jj:=(H+L+C)/3;qj0:=vul/IF(H=L,4,H-L);
qj1:=IF(CAPITAL=0,qj0*(jj-MIN(C,O)),qj0*(MIN(O,C)-L));
qj2:=IF(CAPITAL=0,qj0*(MIN(O,C)-L),qj0*(jj-MIN(C,O)));
qj3:=qj0*(H-MAX(O,C));qj4:=qj0*(MAX(C,O)-jj);
qj5:=qj1+qj2;qj6:=qj3+qj4;DD:=(qj5-qj6)/(qj5+qj6)*100;
DDX:=((qj1+qj2)-(qj3+qj4))/sum(vul,10)*100;DDZ:=DD*17;
DDY:=((qj2+qj4)-(qj1+qj3))/sum(vul,10)*100;
弄点钱:(cross(j,0)and ((ddx>0 and ddy>0) or DDZ>400)),LINETHICK0{不在图中显示此线};
bbd:=EMA(“千钧引用.总0#WEEK”,2)/sum(IF(CAPITAL=0,ref(INDEXA,1),ref(vul,1)),5)*100;
STICKLINE(bbd>0,CC,OO,8,0),COLORFF00FF;
STICKLINE(bbd<0,CC,OO,8,0),COLOR00FF00;
DRAWTEXT(弄点钱,L*0.98,’弄点钱玩玩’),COLOR00FFFF;
*********************************************
{引用公式名称:千钧引用}
zz:=(ref(hhv(h,3),1)+ref(llv(l,3),1))/2;
a:=if(c>zz,vul,0);
b:=if(c<zz,vul,0);
a1:=if(c>zz,INDEXA,0);
b1:=if(c<zz,INDEXA,0);
总0:IF(FINANCE2(35)=0,(a1-b1),(a-b));
**********************************************
下面放入:指标用法注释中:
特殊符号: ‘←★’ ‘【】’ ‘《》’
※ ↑ ↓ → ← ↖ ↗ ↙ ↘ ◆ ◇ ▲▼ ▽ △ ■ □ ● ★ ☆ ● ○ ◎ ⊙ ¤ ㊣★☆╰☆╮◆◇◢ ◣ ◤ ◥
⒈ ⒉ ⒊ ⒋ ⒌ ⒍ ⒎ ⒏ ⒐ ⒑ ⒒ ⒓ ⒔ ⒕ ⒖ ⒗ ⒘ ⒙ ⒚ ⒛
⑴ ⑵ ⑶ ⑷ ⑸ ⑹ ⑺ ⑻ ⑼ ⑽ ⑾ ⑿ ⒀ ⒁ ⒂ ⒃ ⒄ ⒅ ⒆ ⒇
Ⅰ Ⅱ Ⅲ Ⅳ Ⅴ Ⅵ Ⅶ Ⅷ Ⅸ Ⅹ
常用函数
ALIGNx:对齐方式,x=0表示左对齐,1表示中对齐,2表示右对齐,缺省左对齐。
COLOR3D:表示绘制3D阴阳柱,
COLORSTICK:表示绘制涨跌阴阳柱线
DOTLINE;制成虚线。
LAYERx:可以为0-7,数字越小表示越靠上层,将会遮盖其下层的图形,缺省为第4层。
LINETHICKx;绘制指标线宽度,x可以为0-7,0则表示不显示。
PRECISx,数值精确到小数点后多少位,x可以为0-6。
POINTDOT;将该输出绘制成点线。
根据需要自己添减。
【工具公式】源码 公式—公式引入—全部引入
本公式主要功能:
评论(0)