在高仿指南针原版 成本均线 cyc 的基础上,改编了 高仿指南针市场盈亏指标CYS13 公式。
本公式 , 以图形(曲线)显示 cys13,以数值显示 cys5 、cys13、cys34 、cys∞ 。
稍加改动也可同时显示 cys5 、cys13、cys34 、cys∞ 4条曲线。
﹛ 高仿指南针市场盈亏 飞狐 附图公式 ﹜
﹛ cys 市场盈亏公式 ﹜
mid := (o+c)/2;
hsl:=if(capital=0,v/sum(v,100),v/capital);
ljhs := hsl;
cyc1 := mid;
ljhs2:= hsl;
cyc2 := mid;
ljhs3:= hsl;
cyc3 := mid;
ljhsm:= hsl;
cycm := mid;
<%
vmid = ffl.vardata("mid")
vhsl = ffl.vardata("hsl")
vljhs = ffl.vardata("ljhs")
vljhs2 = ffl.vardata("ljhs2")
vljhs3 = ffl.vardata("ljhs3")
vljhsm = ffl.vardata("ljhsm")
vcyc1 = ffl.vardata("cyc1")
vcyc2 = ffl.vardata("cyc2")
vcyc3 = ffl.vardata("cyc3")
vcycm = ffl.vardata("cycm")
last=ubound(vmid)
for i=1 to last
vljhs(i) = vljhs(i -1) * (1 - vhsl(i)) * 4 / 5 + vhsl(i)
vcyc1(i) = (vmid(i) * vhsl(i) + vcyc1(i-1) * vljhs(i -1) * (1 - vhsl(i)) * 4 / 5) / vljhs(i)
vljhs2(i) = vljhs2(i -1) * (1 - vhsl(i)) * 12 / 13 + vhsl(i)
vcyc2(i) = (vmid(i) * vhsl(i) + vcyc2(i-1) * vljhs2(i -1) * (1 - vhsl(i)) * 12 / 13) / vljhs2(i)
vljhs3(i) = vljhs3(i -1) * (1 - vhsl(i)) * 33 / 34 + vhsl(i)
vcyc3(i) = (vmid(i) * vhsl(i) + vcyc3(i-1) * vljhs3(i -1) * (1 - vhsl(i)) * 33 / 34) / vljhs3(i)
vljhsm(i) = vljhsm(i -1) * (1 - vhsl(i)) + vhsl(i)
vcycm(i) = (vmid(i) * vhsl(i) + vcycm(i-1) * vljhsm(i -1) * (1 - vhsl(i))) / vljhsm(i)
next
ffl.vardata("ljhs") = vljhs
ffl.vardata("ljhs2") = vljhs2
ffl.vardata("ljhs3") = vljhs3
ffl.vardata("ljhsm") = vljhsm
ffl.vardata("cyc1") = vcyc1
ffl.vardata("cyc2") = vcyc2
ffl.vardata("cyc3") = vcyc3
ffl.vardata("cycm") = vcycm
%>
cyc5:cyc1,coloryellow;
cyc13:cyc2,COLORMAGENTA;
cyc34:cyc3,colorgreen;
cyc∞: cycm,COLORCYAN;
cys13:100*(CLOSE-cyc13)/cyc13;
cys5:100*(CLOSE-cyc5)/cyc5,LINETHICK0;
cys34:100*(CLOSE-cyc34)/cyc34,LINETHICK0;
cys∞: 100*(CLOSE- cyc∞)/ cyc∞,LINETHICK0;
5;
0;
-5;
-20;