指标编写问答14 学习的宝藏
71.问:哪位能设法让换手平均成本线在分析家主图内既能显现个股又能使用于大盘?
a1:=SUMBARS(v,CAPITAL);
CMA:sum(AMOUNT,a1)/sum(v,a1)/100,PRECIS2,Color567A89;{100%换手平均成本线};
答(ahfyxl):
A1:=SUMBARS(VOL,CAPITAL);
CMA:IF(CAPITAL>0,SUM(AMOUNT,A1)/SUM(VOL,A1)/100,EMA(CLOSE,120)),PRECIS2;
(注)用于大盘有两个问题:
1、大盘的 CAPITAL=0,当然也可以人为定义给它赋值;
2、大盘指数并非价格,与市场均价相差很大。解决指标在大盘主图下的显示问题可以用指数的 均线取代。
72.问:
请教!
建指标A a:ma(c,5);
建指标B aa:"A.a#week";
如果我不想用week函数而取得跟B一样的效果,该怎么做
答(馨芸):
要求无未来的周线值,可参考
一, {引用公式代码,公式名:RSI1}
INPUT:N1(6),N2(12),N3(24);
LC := REF(CLOSE,1);
RSI1:SMA(MAX(CLOSE-LC,0),N1,1)/SMA(ABS(CLOSE-LC),N1,1)*100;
RSI2:SMA(MAX(CLOSE-LC,0),N2,1)/SMA(ABS(CLOSE-LC),N2,1)*100;
RSI3:SMA(MAX(CLOSE-LC,0),N3,1)/SMA(ABS(CLOSE-LC),N3,1)*100;
xr1:SMA(MAX(CLOSE-LC,0),N1,1),LINETHICK0;xr11:SMA(ABS(CLOSE-LC),N1,1),LINETHICK0;
xr2:SMA(MAX(CLOSE-LC,0),N2,1),LINETHICK0;xr22:SMA(ABS(CLOSE-LC),N2,1),LINETHICK0;
xr3:SMA(MAX(CLOSE-LC,0),N3,1),LINETHICK0;xr33:SMA(ABS(CLOSE-LC),N3,1),LINETHICK0;
..........
{使用公式代码}
INPUT:N1(6),N2(12),N3(24);
wtj:=datediff(ref(date,1),date)<>weekday-ref(weekday,1);
qz1:=BARSLAST(wtj)+1;lc1:=ref(c,qz1);maxc1:=max(c-lc1,0);absc1:=abs(c-lc1);
zxr1:="rsi1.xr1#week";zxr11:="rsi1.xr11#week";zxr2:="rsi1.xr2#week";
zxr22:="rsi1.xr22#week";zxr3:="rsi1.xr3#week";zxr33:="rsi1.xr33#week";
rsi1:((maxc1+(n1-1)*ref(zxr1,qz1))/n1)/((absc1+(n1-1)*ref(zxr11,qz1))/n1)*100;
rsi2:((maxc1+(n2-1)*ref(zxr2,qz1))/n2)/((absc1+(n2-1)*ref(zxr22,qz1))/n2)*100;
rsi3:((maxc1+(n3-1)*ref(zxr3,qz1))/n3)/((absc1+(n3-1)*ref(zxr33,qz1))/n3)*100;
二,不引用未来数据,数据逐日变化的周KDJ指标
{引用公式代码,公式名:KDJ1}
INPUT:N(9,1,100),M1(3,2,100),M2(3,2,100);
RSV:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;
K:SMA(RSV,M1,1);
D:SMA(K,M2,1);
J:3*K-2*D;
mHN1:HHV(HIGH,N-1);
LN1:LLV(LOW,N-1);
..............
{使用公式代码}
INPUT:N(9,1,100),M1(3,2,100),M2(3,2,100);
XQ:=BARSLAST(weekday-ref(weekday,1)<>DATEDIFF(ref(date,1),date))+1;
ZHN1:="KDJ1.HN1#WEEK";ZLN1:="KDJ1.LN1#WEEK";
ZK:="KDJ1.K#WEEK";ZD:="KDJ1.D#WEEK";ZJ:="KDJ1.J#WEEK";
RSV:=(CLOSE-MIN(ref(ZLN1,xq),LLV(LOW,XQ)))/(MAX(ref(ZHN1,xq),HHV(HIGH,XQ))-MIN
(ref(ZLN1,xq),LLV(LOW,XQ)))*100;
K2:(RSV+(M1-1)*REF(ZK,XQ))/M1;
D2:(K2+(M2-1)*REF(ZD,XQ))/M2;
J2:3*K2-2*D2;
写法2:
input:n(9,1,100),m1(3,2,40),m2(3,2,40);
wtj1:=datediff(ref(date,1),date)<>weekday-ref(weekday,1);
hn:=sumbars(wtj1,n);XQ:=BARSLAST(wtj1)+1;
x:=sum(wtj1,0)<9;
ZK:="KDJ.K#WEEK";ZD:="KDJ.D#WEEK";
ln1:=if(x,llv(l,0),llv(l,hn));
hn1:=if(x,hhv(h,0),hhv(h,hn));
RSV:=(c-ln1)/(hn1-ln1)*100;
K2:(RSV+(M1-1)*REF(ZK,XQ))/M1;
D2:(K2+(M2-1)*REF(ZD,XQ))/M2;
J2:3*K2-2*D2;
答(骑兵00):
分析家,飞狐通用改成这样。
XQ:=BARSLAST(weekday-ref(weekday,1)<>DATETOD1970(DATE)-ref(DATETOD1970(DAT E),1))+1;
73.问:
帮我编写一个市净率公式,公式很简单,但我不知道谁和谁比啦
答(多多):
参考市净率=最新收盘价/ 上年末每股净资产
c/FINANCE(34);
74.问:
能否遍一个分析家的资金K线
答(馨芸):
无法知道资金K线思路,但三丰老师的OL类似,我加上红黑K棒的红黑量,另是以KD决定的红黑量,请 参考(飞狐)
KS:=(C-MA(C,13))/MA(C,13)*(-100);
RKS:=REF(KS,1);
MLS:=RKS/KS>=1.23 AND RKS>=8 AND C/REF(C,1)>=1.02;
閉視:STICKLINE(KS>=8,H,L,0,1),colorwhite,linethick2;
毀粟:STICKLINE(MLS=1,H,L,0,1),colormagenta,linethick2;
STICKLINE(C>=O,C,O,8,0) COLORred;
STICKLINE(C<=O,C,O,8,0) COLORgreen;
STICKLINE(KS>=8,O,C,8,1),colorwhite,linethick2;
STICKLINE(MLS=1,O,C,8,1),colormagenta,linethick2;
EMA(C,10)colorcyan;
EMA(KS/10+EMA(C,10),3)colorff8888,linethick2;
RSV:=(CLOSE-LLV(LOW,7))/(HHV(HIGH,7)-LLV(LOW,7))*100;
短K:=SMA(RSV,3,1),LINETHICK0 ,COLORWHITE;
短D:=SMA(短K,3,1),LINETHICK1 ,COLORYELLOW;
BB:=HHV(VOL,SYSPARAM(3)-SYSPARAM(2));
HH:=SYSPARAM(4);
LL:=SYSPARAM(5);
TT:=IF(HH-LL<4,0.5,1);
STICKLINE(c>=o,vol/BB*4.8*TT+LL,LL,4,1)color9090EE;
STICKLINE(c<o,vol/BB*4.8*TT+LL,LL,4,1)COLORblue;
// STICKLINE(短K>=短D,vol/BB*3.8*TT+LL,LL,4,1)color9090EE;
// STICKLINE(短K<短D,vol/BB*3.8*TT+LL,LL,4,1)COLORgreen;
ma(vol/BB*4.8*TT+LL,3);
ma(vol/BB*4.8*TT+LL,13);
...............
KS:=(C-MA(C,13))/MA(C,13)*(-100);
RKS:=REF(KS,1);
MLS:=RKS/KS>=1.23 AND RKS>=8 AND C/REF(C,1)>=1.02;
閉視:STICKLINE(KS>=8,H,L,0,1),colorwhite,linethick2;
毀粟:STICKLINE(MLS=1,H,L,0,1),colormagenta,linethick2;
STICKLINE(C>=O,C,O,8,0) COLORred;
STICKLINE(C<=O,C,O,8,0) COLORgreen;
STICKLINE(KS>=8,O,C,8,1),colorwhite,linethick2;
STICKLINE(MLS=1,O,C,8,1),colormagenta,linethick2;
EMA(C,10)colorcyan;
EMA(KS/10+EMA(C,10),3)colorff8888,linethick2;
RSV:=(CLOSE-LLV(LOW,7))/(HHV(HIGH,7)-LLV(LOW,7))*100;
短K:=SMA(RSV,3,1),LINETHICK0 ,COLORWHITE;
短D:=SMA(短K,3,1),LINETHICK1 ,COLORYELLOW;
BB:=HHV(VOL,SYSPARAM(3)-SYSPARAM(2));
HH:=SYSPARAM(4);
LL:=SYSPARAM(5);
TT:=IF(HH-LL<4,0.5,1);
// STICKLINE(c>=o,vol/BB*4.8*TT+LL,LL,4,1)color9090EE;
// STICKLINE(c<o,vol/BB*4.8*TT+LL,LL,4,1)COLORblue;
STICKLINE(短K>=短D,vol/BB*3.8*TT+LL,LL,4,1)color9090EE;
STICKLINE(短K<短D,vol/BB*3.8*TT+LL,LL,4,1)COLORgreen;
ma(vol/BB*4.8*TT+LL,3);
ma(vol/BB*4.8*TT+LL,13);
说明:量的部分有SYSPARAM(4),SYSPARAM(5)两个函数无法改为分析家
75.问:
求助改个DZH
Var1:=(HHV(HIGH,36)-CLOSE)/(HHV(HIGH,36)-LLV(LOW,36))*100;
机构做空能量线: SMA(Var1,3,1),colorgreen;
Var2:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
机构做多能量线: SMA(Var2,5,1)-8,colorred;
SETLINEWIDTH(20,1,1),COLORWHITE;
SETLINEWIDTH(80,1,1),COLORWHITE;
Y0:EMA(100*(CLOSE-LLV(LOW,34))/(HHV(HIGH,34)-LLV(LOW,34)),3)/4,STICKONLY,COLORRED;
Y1:if(Y0>23.16,Y0,0),CIRCLEDOT;
Y2:SETLINEWIDTH(10,1,1);
Y3:SETLINEWIDTH(21,1,1);
答(大庆老杨):
原公式有问题。SETLINEWIDTH 这一句软件识别不了。删除后可用,但与原公式有多大差别就不得而知了。
Var1:=(HHV(HIGH,36)-CLOSE)/(HHV(HIGH,36)-LLV(LOW,36))*100;
机构做空能量线: SMA(Var1,3,1),colorgreen;
Var2:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
机构做多能量线: SMA(Var2,5,1)-8,colorred;
Y0:EMA(100*(CLOSE-LLV(LOW,34))/(HHV(HIGH,34)-LLV(LOW,34)),3)/4,COLORRED;
Y1:if(Y0>23.16,Y0,0),CIRCLEDOT;
页:
[1]