指标编写问答116学习的宝藏
586.问:这个公式应该怎么写[分析家]
KDJ指标的日、周、月同时出现低位金叉?
答(一鸣):
{KDJ指标的日、周、月同时出现低位金叉 }
input:n1(20),n2(30);
K1:="KDJ.K#DAY";
D1:="KDJ.D#DAY";
K2:="KDJ.K#WEEK";
D2:="KDJ.D#WEEK";
K3:="KDJ.K#MONTH";
D3:="KDJ.D#MONTH";
ck:=ref(k1,1)<=n1 and k2<=n2 and k3<=n2;
ck and cross(k1,k2+0.0009) and k2>d2 and k3>d3;
{真正同时金叉应该这样写:(但选出股票的机率低)
ckw:=ref(cross(k2,d2+0.0009),barslast(k2<>ref(k2,1)));
ckm:=ref(cross(k3,d3+0.0009),barslast(k3<>ref(k3,1)));
ck and cross(k1,k2+0.0009) and ckw and ckm;}
587.问:
均线从粘连开始发散这个公式怎么写?
答(一鸣):
总觉得成功率不高,参考看看
{二十条均线的粘合度以三个点以内,然后向上发散}
ema10:=ema(c,10); ema20:=ema(c,20);ema30 :=ema(c,30); ema40 :=ema(c,40); ema50:=ema(c,50);
ema60:=ema(c,60);ema70:=ema(c,70);ema80:=ema(c,80);ema90:=ema(c,90);ema100:=ema(c,100);
ema110:=ema(c,110);ema120:=ema(c,120);ema130:=ema(c,130);ema140:=ema(c,140);ema150:=ema(c,150);
ema160:=ema(c,160);ema170:=ema(c,170);ema180:=ema(c,180); ema190:=ema(c,190);ema200:=ema(c,200);
k1:=max(ema10,max(ema20,max( ema30 ,max(ema40 ,max(ema50 ,max(ema60 ,max(ema70 ,
max(ema80,max(ema90 ,max(ema100,max(ema110,max( ema120 ,max(ema130,max( ema140 ,
max(ema150 ,max(ema160,max( ema170 ,max(ema180 ,max(ema190, ema200)))))))))))))))))));
k2:=min(ema10,min(ema20,min( ema30 ,min(ema40 ,min(ema50 ,min(ema60 ,min(ema70 ,
min(ema80,min(ema90 ,min(ema100,min(ema110,min( ema120 ,min(ema130,min( ema140 ,
min(ema150 ,min(ema160,min( ema170 ,min(ema180 ,min(ema190, ema200)))))))))))))))))));
k3:=ema10>ema20 andema20>ema30 andema30> ema40 andema40> ema50 andema50> ema60
andema60>ema70 andema70> ema80andema80>ema90 andema90> ema100 andema100>ema110
andema110> ema120andema120>ema130andema130>ema140 andema140> ema150 and
ema150> ema160andema160>ema170andema170>ema180andema180>ema190andema190>ema200 ;
k4:=ema10>ref(ema10,1) and ema20>ref(ema20,1) andema30>ref(ema30,1) andema40>ref(ema40,1) and
ema50>ref(ema50,1) andema60>ref(ema60,1) andema70>ref(ema70,1) andema80>ref(ema80,1) and
ema90>ref(ema90,1) andema100>ref(ema100,1) and ema110>ref(ema110,1) andema120>ref(ema120,1) and
ema130>ref(ema130,1) andema140>ref(ema140,1) andema150>ref(ema150,1) andema160>ref(ema160,1) and
ema170>ref(ema170,1) andema180>ref(ema180,1) andema190>ref(ema190,1) andema200>ref(ema200,1);
k5:=barslast(k1/k2<=1.03)<=10;
cross(k3,0.5) and k4 and k5;
答(一鸣):
干脆再做一个均线数量可调整,爱用几条线,就用几条线,
在公式中转来转去,真的有点晕了
{二十条均线的粘合度在三个点以内,然后向上发散,
均线数量可调,要用几条就用几条}
input:n(20,2,20);//n条均线
e1:=ema(c,10); e2:=ema(c,20);e3:=ema(c,30); e4:=ema(c,40); e5:=ema(c,50);
e6:=ema(c,60);e7:=ema(c,70);e8:=ema(c,80);e9:=ema(c,90);e10:=ema(c,100);
e11:=ema(c,110);e12:=ema(c,120);e13:=ema(c,130);e14:=ema(c,140);e15:=ema(c,150);
e16:=ema(c,160);e17:=ema(c,170);e18:=ema(c,180); e19:=ema(c,190);e20:=ema(c,200);
k1:=max(e1,max(e2,max( e3*(n>=3) ,max(e4 *(n>=4),max(e5*(n>=5) ,max(e6*(n>=6) ,
max(e7*(n>=7) ,max(e8*(n>=8),max(e9*(n>=9) ,max(e10*(n>=10),max(e11*(n>=11),
max( e12*(n>=12) ,max(e13*(n>=13),max( e14*(n>=14) ,max(e15*(n>=15) ,max(e16*(n>=16),
max( e17*(n>=17) ,max(e18*(n>=18) ,max(e19*(n>=19), e20*(n>=20))))))))))))))))))));
k2:=min(e1,min(e2,min( e3+(n<3)*10000 ,min(e4+(n<4)*10000 ,min(e5+(n<5)*10000 ,
min(e6+(n<6)*10000 ,min(e7+(n<7)*10000 ,min(e8+(n<8)*10000,min(e9+(n<9)*10000 ,
min(e10+(n<10)*10000,min(e11+(n<11)*10000,min( e12+(n<12)*10000 ,min(e13+(n<13)*10000,
min( e14+(n<14)*10000 ,min(e15 +(n<15)*10000,min(e16+(n<16)*10000,min( e17 +(n<17)*10000,
min(e18+(n<18)*10000 ,min(e19+(n<19)*10000, e20+(n<20)*10000)))))))))))))))))));
k3:=e1>e2 and if(n>=3,e2>e3,c>0) and if(n>=4,e3> e4,c>0) and if(n>=5,e4> e5,c>0) and if(n>=6,e5> e6,c>0) and
if(n>=7,e6>e7,c>0) and if(n>=8,e7> e8,c>0) and if(n>=9,e8>e9,c>0) and if(n>=10,e9> e10,c>0) and if(n>=11,e10>e11,c>0) and
if(n>=12,e11> e12,c>0) and if(n>=13,e12>e13,c>0) and if(n>=14,e13>e14,c>0) and if(n>=15,e14> e15,c>0) and if(n>=16,e15> e16,c>0)
and if(n>=17,e16>e17,c>0) and if(n>=18,e17>e18,c>0) and if(n>=19,e18>e19,c>0) and if(n>=20,e19>e20,c>0) ;
k4:=e1>ref(e1,1) and e2>ref(e2,1) and if(n>=3,e3>ref(e3,1),c>0) and if(n>=4,e4>ref(e4,1),c>0) and if(n>=5,e5>ref(e5,1),c>0) and
if(n>=6,e6>ref(e6,1),c>0) and if(n>=7,e7>ref(e7,1),c>0) and if(n>=8,e8>ref(e8,1),c>0) and if(n>=9, e9>ref(e9,1),c>0) and
if(n>=10,e10>ref(e10,1),c>0) and if(n>=11,e11>ref(e11,1),c>0) and if(n>=12,e12>ref(e12,1),c>0) and if(n>=13,e13>ref(e13,1),c>0) and
if(n>=14,e14>ref(e14,1),c>0) and if(n>=15, e15>ref(e15,1),c>0) and if(n>=16,e16>ref(e16,1),c>0) and if(n>=17,e17>ref(e17,1),c>0) and
if(n>=18,e18>ref(e18,1),c>0) and if(n>=19,e19>ref(e19,1),c>0) and if(n>=20,e20>ref(e20,1),c>0) ;
k5:=barslast(k1/k2<=1.03)<=10;
cross(k3,0.5) and k4 and k5;
588.问:
请问分析家的“PARTLINE(x2,x2>x3,rgb(255,0,0),x2<x3,rgb(0,0,255));”如何转换成飞 狐的语句
答(知无不言):
PARTLINE(x2>x3,x2);
PARTLINE(x2<x3,x2);
答( zjxu58 ):
PARTLINE(x2>x3,x2),COLORRED;
PARTLINE(x2<x3,x2),COLORBLUE;
加上了颜色代码;
589.问:
帮忙把下面的"长线牛股(分析家)"公式改编成飞狐公式?
MA1:EMA(CLOSE,21),color00ff00;
MA2:EMA(CLOSE,120),colorred ;
顶:MA(CLOSE,30) + 2*STD(CLOSE,60), COLORYELLOW,pointdot, linethick2 ;
底:MA(CLOSE,30) - 2*STD(CLOSE,60) ,COLORYELLOW ,pointdot, linethick2;
STICKLINE(MA1>MA2,MA1,MA2,1,0),colorFF66FF ;
STICKLINE(MA2>MA1,MA1,MA2,1,0),color00FF00 ;
转向:ZIG(3,10), colorFF3300 ;
MA3:MA(CLOSE,2),colorred,LINETHICK2;
答(041013);
飞狐可以引用
590.问:
做一个上涨了一段,上穿过250天均线后,又回探250天均线的指标!
答(一鸣):
{上涨了一段,上穿过250天均线后,又回探250天均线}
m1:=ma(c,250);
k1:=barslast(cross(c,ma(c,250)));
c/m1<1.005 and ref(all(c>m1,k1),1) and hhv(h/m1,k1+1)>=1.01;
页:
[1]