金字塔公式 金字塔模型策略源码:
AH:=HIGH; AL:=LOW; AO:=OPEN; AC:=CLOSE;
<%
vh=ffl.vardata("AH")
vl=ffl.vardata("AL")
vo=ffl.vardata("AO")
vc=ffl.vardata("AC")
last=ubound(vh)
if last<101 then
b=last+1
else
b=0
for i=last-101 to last-51
vh(i)=vh(i+51)
vl(i)=vl(i+51)
vo(i)=vo(i+51)
vc(i)=vc(i+51)
next
a=(vh(last-51)+vl(last-51))/2
j=1
for i=last-49 to last
j=j+2
vh(i)=2*a-vl(i-j)
vl(i)=2*a-vh(i-j)
vo(i)=2*a-vc(i-j)
vc(i)=2*a-vo(i-j)
next
end if
ffl.vardata("AH")=vh
ffl.vardata("AL")=vl
ffl.vardata("AO")=vo
ffl.vardata("AC")=vc
ffl.varstartindex("AH")=b
ffl.varstartindex("AL")=b
ffl.varstartindex("AO")=b
ffl.varstartindex("AC")=b
%>
A:=BACKSET(ISLASTBAR,50);
STICKLINE(A AND AC>=AO,AO,AC,6,1),COLORMAGENTA,SHIFT50;
STICKLINE(A AND AC>=AO,AL,AO,0.1,1),COLORMAGENTA,SHIFT50;
STICKLINE(A AND AC>=AO,AC,AH,0.1,1),COLORMAGENTA,SHIFT50;
STICKLINE(A AND AC<AO,AO,AC,6,0),COLORGREEN,SHIFT50;
STICKLINE(A AND AC<AO,AL,AH,0.1,0),COLORGREEN,SHIFT50;
VERTLINE(ISLASTBAR),COLORYEALOW,POINTDOT;
源码解析:
AH赋值:最高价
AL赋值:最低价
AO赋值:开盘价
AC赋值:收盘价
A赋值:若是否最后一个周期则将最近50周期置为1
当满足条件AANDAC>=AO时,在AO和AC位置之间画柱状线,宽度为6,1不为0则画空心柱.,画洋红色,SHIFT50
当满足条件AANDAC>=AO时,在AL和AO位置之间画柱状线,宽度为0.1,1不为0则画空心柱.,画洋红色,SHIFT50
当满足条件AANDAC>=AO时,在AC和AH位置之间画柱状线,宽度为0.1,1不为0则画空心柱.,画洋红色,SHIFT50
当满足条件AANDAC<AO时,在AO和AC位置之间画柱状线,宽度为6,0不为0则画空心柱.,画绿色,SHIFT50
当满足条件AANDAC<AO时,在AL和AH位置之间画柱状线,宽度为0.1,0不为0则画空心柱.,画绿色,SHIFT50
VERTLINE(是否最后一个周期),COLORYEALOW,POINTDOT