波段黄金分割公式-(源码)介绍
波段黄金分割公式-(源码)
{波段黄金分割公式----源码}
a1:=zig(3,N); {N自行设置:一般为2、3、5、8、13、21等等}
a2:=last(a1>ref(a1,1));
a3:=last(a1<ref(a1,1));
tt1:=peak(1,N,1);
bb1:=trough(2,N,1);
H1:=tt1-(tt1-bb1)*0.236;
H2:=tt1-(tt1-bb1)*0.382;
H3:=tt1-(tt1-bb1)*0.5;
H4:=tt1-(tt1-bb1)*0.618;
H5:=tt1-(tt1-bb1)*0.764;
H6:=tt1-(tt1-bb1)*1.0;
H7:=tt1-(tt1-bb1)*1.27;
H8:=tt1-(tt1-bb1)*1.618;
L1:=bb1+(tt1-bb1)*0.236;
L2:=bb1+(tt1-bb1)*0.382;
L3:=bb1+(tt1-bb1)*0.5;
L4:=bb1+(tt1-bb1)*0.618;
L5:=bb1+(tt1-bb1)*0.764;
L6:=bb1+(tt1-bb1)*1.0;
L7:=bb1+(tt1-bb1)*1.27;
L8:=bb1+(tt1-bb1)*1.618;
stickline(a3>0,tt1,tt1,8,0),linethick2,colorred;
stickline(a2>0,bb1,bb1,8,0),linethick2,colorred;
stickline(a3>0,H1,H1,8,0),linethick0,colorFF99CC;
stickline(a3>0,H2,H2,8,0),linethick0,colorFF99CC;
stickline(a3>0,H3,H3,8,0),linethick0,colorFF99CC;
stickline(a3>0,H4,H4,8,0),linethick0,colorFF99CC;
stickline(a3>0,H5,H5,8,0),linethick0,colorFF99CC;
stickline(a3>0,H6,H6,8,0),linethick0,colorFF99CC;
stickline(a3>0,H7,H7,8,0),linethick0,colorFF99CC;
stickline(a3>0,H8,H8,8,0),linethick0,colorFF99CC;
drawtext(a3=1,H1,'23.6%'),linethick0,colorFF99CC;
drawtext(a3=1,H2,'38.2%'),linethick0,colorFF99CC;
drawtext(a3=1,H3,'50%'),linethick0,colorFF99CC;
drawtext(a3=1,H4,'61.8%'),linethick0,colorFF99CC;
drawtext(a3=1,H5,'76.4%'),linethick0,colorFF99CC;
drawtext(a3=1,H6,'100%'),linethick0,colorFF99CC;
drawtext(a3=1,H7,'127%'),linethick0,colorFF99CC;
drawtext(a3=1,H8,'161.8%'),linethick0,colorFF99CC;
stickline(a2>0,L1,L1,8,0),linethick0,colorFF99CC;
stickline(a2>0,L2,L2,8,0),linethick0,colorFF99CC;
stickline(a2>0,L3,L3,8,0),linethick0,colorFF99CC;
stickline(a2>0,L4,L4,8,0),linethick0,colorFF99CC;
stickline(a2>0,L5,L5,8,0),linethick0,colorFF99CC;
stickline(a2>0,L6,L6,8,0),linethick0,colorFF99CC;
stickline(a2>0,L7,L7,8,0),linethick0,colorFF99CC;
stickline(a2>0,L8,L8,8,0),linethick0,colorFF99CC;
drawtext(a2=1,L1*1.015,'23.6%'),linethick0,colorFF99CC;
drawtext(a2=1,L2*1.015,'38.2%'),linethick0,colorFF99CC;
drawtext(a2=1,L3*1.015,'50%'),linethick0,colorFF99CC;
drawtext(a2=1,L4*1.015,'61.8%'),linethick0,colorFF99CC;
drawtext(a2=1,L5*1.015,'76.4%'),linethick0,colorFF99CC;
drawtext(a2=1,L6*1.015,'100%'),linethick0,colorFF99CC;
drawtext(a2=1,L7*1.015,'127%'),linethick0,colorFF99CC;
drawtext(a2=1,L8*1.015,'161.8%'),linethick0,colorFF99CC;
gd16216