飞狐指标编写基础大全(一)
-
相关简介:飞狐指标编写基础大全(一) 一、基础部分 1 )今收盘对于 N 日内最低收盘价的涨幅( % ) (c-llv(c,n))/llv(c,n)*100; 2 )今收盘价对于 N 日最高收盘价的跌幅( % ) (HHV(C,N)-C)/HHV(C,N)*100; 3 )股价在过去 N 日内运行空间的相对位置 (C-LLV(L,N))/(HHV(H,N)-LLV(L,N))*100; 4 )股价上方 N1% 至 N2% 处的筹码( % ) aa:=winner(c+c*n2/100)*
-
文章来源:股海网作者:股海网发布时间:2016-02-24浏览次数:
飞狐指标编写基础大全(一)
一、基础部分
1)今收盘对于N日内最低收盘价的涨幅(%)(c-llv(c,n))/llv(c,n)*100;
2)今收盘价对于N日最高收盘价的跌幅(%)(HHV(C,N)-C)/HHV(C,N)*100;
3)股价在过去N日内运行空间的相对位置 (C-LLV(L,N))/(HHV(H,N)-LLV(L,N))*100;
4)股价上方N1%至N2%处的筹码(%)
aa:=winner(c+c*n2/100)*100;
bb:=winner(c+c*n1/100)*100;
aa-bb
5)股价下方N1%至N2%处的筹码(%)
(winner(c-c*n1/100)-winner(c-c*n2/100))*100;
6)收盘价N%处的套牢盘 100-(winner(c*N/100))*100;
7)收盘价N%处的获利盘 winner(c*N/100)*100;
8)下影线 (MIN(O,C)-L)/L*100;
9)上影线 (h-max(o,c))/max(o,c)*100;
10)本周期的涨跌幅 (c-ref(c,1))/ref(c,1)*100;
11)振幅 (h-l)/l*100;
12)均线金叉(M.N为均线周期) cross(ma(c,m),ma(c,n))
13)均线多头排列
a1:=ma(c,n1);
a2:=ma(c,n2);
a3:=ma(c,n3);
a4:=ma(c,n4);
count(a1>a2 and a2>a3 and a3>a4,3);
14) 均线空头排列
a1:=ma(c,n1);
a2:=ma(c,n2);
a3:=ma(c,n3);
a4:=ma(c,n4);
count(a1<a2 and a2<a3 and a3<a4,3);
15)N日均线向下
aa:=ma(c,n);
bb:=ref(aa,2);
aa<bb
16)向前N日至M日出现过均线死叉(P1<P2)
aa:=ma(c,p1);
bb:=ma(c,p2);
cc:=ref(cross(bb,aa),n);
count(cc,m);
17)今日成交量大于N日以来的均量 VOL>MA(VOL,N);
18)低位密集
A1:=COST(85);
A2:=COST(15);
A3:=A1-A2;
A4:=(A1+A2)/2;
A5:=A3/A4*100<10;
B1:=HHV(H,120);
B2:=LLV(L,120);
B3:=B1-B2;
B4:=(A4-B2)<B3/2;
A5 AND B4;
19)换手率 VOL/CAPITAL*100;
20)N日盈亏
V1:=VOL/SUM(VOL,N);
V2:=DMA(CLOSE,V1);
V3: (CLOSE-V2)/V2*100;
21)强势整理
{参数M、N分别代表周期和幅度 m:1 20 2 n:1 20 5}
a1:=abs(close-open)/open<0.015;
a2:=count(a1,m)=m;
a3:=ref(o,m)<ref(close,m) and
ref(close,m)/ref(close,m+1)>1+n/100;
a2 and a3
22)高开大阴
{参数m,n分别代表幅度 m:1 10 4 n:1 20 5}
OPEN>CLOSE AND OPEN/REF(C,1) >= 1+M/100 AND CLOSE/OPEN<=1-N/100
23)低开大阳线
{参数m,n分别代表幅度 m:1 10 4 n:1 20 7}
OPEN<CLOSE AND OPEN/REF(C,1) <= 1-M/100 AND CLOSE/OPEN>=1+N/100
二、信号提示
1、间隔点:
20,colorred,pointdot,linethick2;
80,colorred,pointdot,linethick2;
50,colorred,pointdot,linethick2;
2、间隔线
20,colorred,linethick2;
80,colorred,linethick2;
50,colorred,linethick2;
3、信号字
DRAWTEXT(RSI1<10,RSI1,'买'),Colorlime;
DRAWTEXT(RSI1>85,RSI1,'卖'),Colorlime;
4、笑哭脸
DRAWICON(VR24<25,VR24,1),ColorFF0000;
DRAWICON(VR24>350,VR24,2),ColorFF0000;
5、一线提示
cross("kdj.j"(9,3,3),"kdj.d"(9,3,3)) and "kdj.j"(9,3,3)<20,colorred
6、一柱顶天
IF(VAR4=50,50,0),stick,linethick2;
7、小人作怪
多头卒:Var3,LINETHICK2, COLORf00ff0;
空头卒:Var4,LINETHICK2, COLORYELLOW;
DRAWICON(Var9,Var9,1);
DRAWICON(Var10,Var10,2);
8、小人
买入:Var1 AND Var2,stick,linethick2,colorred;
卖出:CROSS(80,Var4),stick,linethick2,colorgreen;
drawicon(卖出,1.1,2);
drawicon(买入,1.1,1);
9、粗细面条
LINETHICK2
第3,4,6和7,还有8只要把RSI或VR或Var改成所在公式参数就可用;第5cross不能改,其它的可改;9你爱把线设多粗细都行。
三、颜色效果
1、方块:STICKLINE
AA:=VOL/((HIGH-LOW)*2-ABS(CLOSE-OPEN));
买盘:IF(CLOSE>OPEN,AA*(HIGH-LOW),IF(CLOSE<OPEN,AA*((HIGH-OPEN)+(CLOSE-LOW)),VOL/2));
卖盘:IF(CLOSE>OPEN,0-AA*((HIGH-CLOSE)+(OPEN-LOW)),IF(CLOSE<OPEN,0-AA*(HIGH-LOW),0-VOL/2));
qq:=买盘+卖盘;
STICKLINE(卖盘<0,0,VOL,5,1),COLORlime;
STICKLINE(买盘>0,0,买盘,5,0),COLORRED;
结果:ma(qq,5)*5,COLORRED,LINETHICK2;
VOL后面的5,1是方块大少。VOL是坐标,也就是方块所放的地方。
2 、3D效果
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,9,0 ),COLORaaaaaa;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,6,0 ),COLORbbbbbb;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,2.4,0 ),COLORcccccc;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,1.1,0 ),COLORdddddd;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,9,0 ),COLOr6666cc;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,6 ,0 ),COLOR7777dd;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,2.4 ,0 ),COLOR8888ee;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,1.1 ,0 ),COLOR9999ff;
STICKLINE(CLOSE>OPEN,OPEN,LOW,0.5,0 ),COLOR1199ff;
STICKLINE(CLOSE>OPEN,CLOSE,HIGH,0.5 ,0 ),COLOR1199ff;
STICKLINE(OPEN>=CLOSE,CLOSE,LOW,0.5 ,0 ),COLORcccccc;
STICKLINE(OPEN>=CLOSE,OPEN,HIGH,0.5 ,0 ),COLORcccccc;
3、颜色
大智慧只能用浅色调,一用深绿深蓝就看不见了。所以我调了几个浅色的,够大智慧用的。
COLOR+RED;WHITE;LIME;YELLOW;aabbcc;ffaabb;abcdef;999999;C 0C0C0.
4、变色
变色可分3种:
1、用DRAWTEXT:
ma10:ma(c,10),colorwhite;
llv(h,30),colorffcc66;
llv(l,30),coloryellow;
vhh:hhv(h,30),colorred;
vhl:hhv(l,30),color00ff00;
v1:=ma(HIGH,30)*1.15 ;
v2:=ma(HIGH,3)*1.03;
v3:=ma(LOW,3)*0.97;
v4:=ma(LOW,30)*0.85;
小通道上:=ma(v2,30);
小通道下:=ma(v3,30);
A2:=小通道上-REF(小通道上,1);
A3:=小通道下-REF(小通道下,1);
K:A2>0 and ref(A2<0,1),colorblue;
K1:A3>0 and ref(A3<0,1),colorff00ff;
K2:c<小通道下 and h<小通道下,color0099ff;
K3:c<小通道下 and A3>0,colorffcccc;
K4:h<小通道下 and A3>0,colorffbbff;
DRAWTEXT(A2>0 ,小通道上,'°'),colorred;
DRAWTEXT(A2<0 ,小通道上,'°'),color00ff00;
DRAWTEXT(A3>0 ,小通道下,'°'),colorred;
DRAWTEXT(A3<0 ,小通道下,'°'),color00ff00;
DRAWTEXT(A2=0 ,小通道上,'°'),COLORWHITE;
DRAWTEXT(A2=0 ,小通道下,'°'),COLORWHITE;
DRAWTEXT(A3=0 ,小通道上,'°'),COLORWHITE;
DRAWTEXT(A3=0 ,小通道下,'°'),COLORWHITE;
2、用STICKLINE
AA:=WINNER(C)*100;
KA:=winner(O)*100;
高:=winner(H)*100;
低:=winner(L)*100;
庄筹线:EMA(AA*0.7,3),linethick2;
散筹线:EMA((WINNER(C*1.08)-WINNER(C*0.92))*70,3),linethick2;
stickline(AA<KA,高,低,0,0),colorlime;
stickline(AA<KA,AA,KA,6,0),colorlime;
stickline(AA>=KA,高,低,0,0),colorred;
stickline(AA>=KA,AA,KA,6,0),colorred;
stickline(庄筹线>散筹线,庄筹线,散筹线,0,0),colorwhite;
3、用IF
主图公式1:
A1:=Ma(C,5);{5日移动平均线}
A2:=Ma(C,10);{10日移动平均线}
A3:=(A1+A2)/2;{5、10日移动平均线之和除2的平均线,也就是中心线}
IF (A1>A2,A1,A3),Colorred,linethick2;{5日线大于10日且5日线交叉A3线显示粗红线}
IF (A1>A2,A2,A3),Colorred,linethick2;{5日线大于10日且10日线交叉A3线显示粗红线}
IF (A1<=A2,A1,A3),Color00ff00,linethick2;{5日线小于等于10日且5日线交叉A3线显示粗绿线}
IF (A1<=A2,A2,A3),Color00ff00,linethick2;{5日线小于等于10日且10日线交叉A3线显示粗绿线}
A3,colorwhite,linethick2;{中心线显示粗白线}
这是以中心线为轴通过A1、A2这两条线与中心线的交叉来变换颜色的。
主图公式2:
MA1:=MA(CLOSE,5);{5日移动平均线}
MA2:=MA(CLOSE,10);{10日移动平均线}
MA3:=MA(CLOSE,20);{20日移动平均线}
MA4:=MA(CLOSE,30);{30日移动平均线}
MAA:=MA(CLOSE,60);{60日移动平均线}
MA5:IF(MA1<MA4,MA1,MA4),COLOR00ff00;{MA1线小于MA4且MA1线交叉MA4线显示绿色线}
IF(MA1<MA4,MA4,MA1),coloryellow;{MA1线小于MA4且MA4线交叉MA1线显示黄色线}
MA10:if(ma2<ma4,ma2,ma4),colorffcc66;{MA2线小于MA4且MA2线交叉MA4线显示青色线}
if(ma2<ma4,ma4,ma2),color0099ff;{MA2线小于MA4且MA4线交叉MA2线显示橘黄色线}
MA20:if(ma3<ma4,ma3,ma4),colorwhite;{MA3线小于MA4且MA3线交叉MA4线显示白色线}
if(ma3<ma4,ma4,ma3),colorblue;{MA3线小于MA4且MA4线交叉MA3线显示青色线}
MA30:if(ma4<maa,ma4,maa),colorff00ff,linethick2;{MA4线小于MAA且MA4线交叉MAA线显示粉色粗线}
if(ma4<maa,maa,ma4),colorred,linethick2;{MA4线小于MAA且MAA线交叉MA4线显示红色粗线}
MA60:if(ma4>maa,maa,maa),linethick2,colorblue;{MA4线大于MAA且MAA线交叉MAA线显示兰色粗线}
这是分别以MA4、MAA线为轴通过向上交叉和向下交叉来变换颜色的。
单条变色线
ma10:ma(c,10);
if(ma10>ref(ma10,1),ma10,0),Circledot,COLORRED,LINETHICK2;
if(ma10<ref(ma10,1),ma10,0),Circledot,COLOR00FF00,LINETHICK2;