马上注册,享用更多功能,让你轻松玩转本论坛。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
371.问:
请帮忙修改将“大盘k线做成副图”的公式!多谢了!!!
Vara:=INDEXO;
Varb:=INDEXC;
Varc:=INDEXH;
Vard:=INDEXL;
STICKLINE(Varb=Vara,Varc,Vard,0.9,1),colorred;
STICKLINE(Varb=Vara,Vara,Varb,7,1),colorred;
STICKLINE(Varb>Vara,Vara,Varb,7,0),colorred;
STICKLINE(Varb<Vara,Vara,Varb,7,0),colorgreen;
STICKLINE(Varb>Vara,Varb,Varc,0.9,1),colorred;
STICKLINE(Varb>Vara,Vara,Vard,0.9,1),colorred;
STICKLINE(Vara>Varb,Varb,Vard,0.9,1),colorgreen;
上面的是原来的公式(分析家的),但是它是上海的股票对应上海的指数,深圳的
股票对 应深圳的指数,我想改成只对应上海的指数(深圳的股票也是对应上海的指
数)
答(wmjm):
Var1:="1A0001$CLOSE";
Var2:="1A0001$OPEN";
Var3:="1A0001$HIGH";
Var4:="1A0001$LOW";
STICKLINE(Var1>Var2,Var1,Var2,7,1),color0000ff;
STICKLINE(Var1>Var2 OR Var1=Var2,Var3,MAX(Var1,Var2),0,1), color0000ff;
STICKLINE(Var1>Var2 OR Var1=Var2,MIN(Var1,Var2),Var4,0,1), color0000ff;
STICKLINE(Var1<Var2,Var1,Var2,7,0), , color00ff00;
STICKLINE(Var1<Var2,Var3,MAX(Var1,Var2),0,1), color00ff00;
STICKLINE(Var1<Var2,MIN(Var1,Var2),Var4,0,1), color00ff00;
STICKLINE(Var1=Var2,Var1,Var2,7,0), colorffffff;
开盘: Var2, POINTDOT;
收盘: Var1, POINTDOT;
最高: Var3, POINTDOT;
最低: Var4, POINTDOT;
十三: EMA(Var1,13);
三十四: MA((Var3+Var4)/2,34);
半年线: MA((Var3+Var4)/2,125), POINTDOT;
如果你要完全按照你的公式,只需将前四行改动一下就行了.
372.问:
编个生命线EMA(CLOSE,60)+EMA(CLOSE,90))/2,LINETHICK2,COLORCC33FF;
编成选股公式 '收盘价'格刚突破生命线或者回落到生命线上 .
答(vkioli2):
生命線:=(EMA(CLOSE,60)+EMA(CLOSE,90))/2;
cross(c,生命線) or (range(c,生命線-0.0001,生命線*1.01) and ref(c,1)>ref(生命
線,1));
373.问:
求Z波段高低点价格
A1:=REF(HIGH,3)=HHV(HIGH,2*3+1);
B1:=FILTER(A1,3);
C1:=BACKSET(B1,3+1);
D1:=FILTER(C1,3);{高点}
A2:=REF(LOW,3)=LLV(LOW,2*3+1);
B2:=FILTER(A2,3);
C2:=BACKSET(B2,3+1);
D2:=FILTER(C2,3);{低点}
E1:=(REF(LLV(LOW,2*3),1)+REF(HHV(HIGH,2*3),1))/2; E2:=(HIGH+LOW)/2;{高低点出现
在同一K线上时可作取舍}
H1:=(D1 AND NOT(D2 AND E1>=E2)) OR BARSTATUS=2 OR BARSCOUNT(CLOSE)=1;
H2:=D1 AND NOT(D2 AND E1>=E2);
L1:=D2 AND NOT(D1 AND E1=E2);
X1:=REF(BARSLAST(H1),1)+1; F1:=BACKSET(H1 AND COUNT(L1,X1)>0,LLVBARS(IF
(L1,LOW,10000),X1));
G1:=F1>REF(F1,1); I1:=BACKSET(G1,2); LD:=I1>REF(I1,1);{过滤后低点}
L2:=LD OR BARSTATUS=2 OR BARSCOUNT(CLOSE)=1;
X2:=REF(BARSLAST(L2),1)+1; F2:=BACKSET(L2 AND COUNT(H2,X2)>0,HHVBARS(IF
(H2,HIGH,0),X2));
G2:=F2>REF(F2,1); I2:=BACKSET(G2,2); HD:=I2>REF(I2,1);{过滤后高点}
DRAWLINE(LD,L,HD,H,0),COLORWHITE,LINETHICK1,POINTDOT;
DRAWLINE(HD,H,LD,L,0),COLORWHITE,LINETHICK1,POINTDOT;
J1:=BACKSET(BARSTATUS=2,MIN(BARSLAST(HD),BARSLAST(LD))+1); J2:=J1>REF(J1,1);
DRAWLINE(J2,IF(HD,H,L),BARSTATUS=2,IF(BARSLAST(HD)>BARSLAST
(LD),H,L),0),COLORWHITE,LINETHICK1,POINTDOT;
A3:=H; B3:=REF(H,REF(BARSLAST(HD),1)+1)>REF(H,REF(BARSLAST(HD),1)+2+REF
(BARSLAST(HD),REF(BARSLAST(HD),1)+2));
D3:=A3 AND B3 AND HD;
E3:=BACKSET(D3,REF(BARSLAST(HD),1)+2);
HH:=E3>REF(E3,1);{找出全部长期高点}
A4:=L>REF(L,REF(BARSLAST(LD),1)+1);
B4:=REF(L,REF(BARSLAST(LD),1)+1); D4:=A4 AND B4 AND LD; E4:=BACKSET(D4,REF
(BARSLAST(LD),1)+2);
LL:=E4>REF(E4,1);{找出全部长期低点}
DRAWICON(HH,H,5),ALIGN1;
DRAWICON(LL,L,4),ALIGN1;
H3:=HH OR BARSTATUS=2 OR BARSCOUNT(C)=1; {后面进行过滤,方法同前。只是不用
考虑 高低点出现在同一K线}
X3:=REF(BARSLAST(H3),1)+1; F3:=BACKSET(H3 AND COUNT(LL,X3)>0,LLVBARS(IF
(LL,L,POW(10,20)),X3));
G3:=F3>REF(F3,1);
I3:=BACKSET(G3,2);
LZ:=I3>REF(I3,1); {长期低点,也可供引用}
L4:=LZ OR BARSTATUS=2 OR BARSCOUNT(C)=1;
X4:=REF(BARSLAST(L4),1)+1; F4:=BACKSET(L4 AND COUNT(HH,X4)>0,HHVBARS(IF(HH,H,-
POW(10,20)),X4));
G4:=F4>REF(F4,1);
I4:=BACKSET(G4,2);
HZ:=I4>REF(I4,1);{长期高点,也可供引用}
DRAWLINE(HZ,H,LZ,L,0),COLORGREEN,LINETHICK1;
DRAWLINE(LZ,L,HZ,H,0),COLORGREEN,LINETHICK1;{长期连线}
K1:=BACKSET(BARSTATUS=2,MIN(BARSLAST(HZ),BARSLAST(LZ))+1); K2:=K1>REF(K1,1);
DRAWLINE(K2,IF(HZ,H,L),BARSTATUS=2,C,0),COLORGREEN,LINETHICK1; {最后的长期连线
,连在收盘价上}
UU:=BACKSET(BARSTATUS=2,BARSLAST(LD)+1);
VV:=UU>REF(UU,1);
WW:=BACKSET(VV,REF(BARSLAST(LD),1)+2);
XX:=WW>REF(WW,1);
DRAWLINE(XX,L,VV,L,1),COLORMAGENTA,LINETHICK1;
UU2:=BACKSET(BARSTATUS=2,BARSLAST(HD)+1);
VV2:=UU2>REF(UU2,1);
WW2:=BACKSET(VV2,REF(BARSLAST(HD),1)+2);
XX2:=WW2>REF(WW2,1);
DRAWLINE(XX2,H,VV2,H,1),COLORMAGENTA,LINETHICK1;
前一低:REF(L,BARSLAST(VV)),COLOR99FF66,POINTDOT,LINETHICK3;
前二低:REF(L,BARSLAST(XX)),COLORFF66FF,POINTDOT,LINETHICK3;
前一高:REF(H,BARSLAST(VV2)),COLOR99FF66,POINTDOT,LINETHICK3;
前二高:REF(H,BARSLAST(XX2)),COLORFF66FF,POINTDOT,LINETHICK3;
短高:=REF(H,BARSLAST(VV2));
短低:=REF(L,BARSLAST(VV));
短比: (C-短低)/(短高-短低),LINETHICK0;
常数:=REF(INDEXC,BARSLAST(VV))/REF(C,BARSLAST(VV));
叠1:INDEXC/常数,COLORGRAY,LINETHICK0;
PARTLINE(叠1,1),COLORGRAY;
常数2:=REF(INDEXC,BARSLAST(XX))/REF(C,BARSLAST(XX));
叠2:INDEXC/常数2,COLORGRAY,LINETHICK0;
PARTLINE(叠2,1),COLORGRAY;
s:=NUMTOSTR(DAYS1970-DATETOD1970(REF( DATE,BARSLAST(LD) ) ),0 );
s1:=NUMTOSTR(DAYS1970-DATETOD1970(REF( DATE,BARSLAST(HD) ) ),0 );
s2:=NUMTOSTR(H,2 );
s3:=NUMTOSTR(L,2 );
DRAWTEXT(HD,1.02*H,s),COLORCYAN;
DRAWTEXT(LD,0.98*L,s1),COLORCYAN;
DRAWTEXT(HD,H*(1+0.002),s2),COLORRED,ALIGN0;
DRAWTEXT(LD,L*(1.001-0.002),s3),COLORRED,ALIGN0;
上面的有显示波段高低点,但是价格不对,看看怎样改一下能够显示出当时的价格
求Z波段高低点价格,应该是用未来数据的,不过想求三天前的才好,只是想看到
历史的 高低点用于看波段,要是太复杂就算了,
答(恒悦):
A1:=REF(HIGH,3)=HHV(HIGH,2*3+1);
B1:=FILTER(A1,3);
C1:=BACKSET(B1,3+1);
D1:=FILTER(C1,3);{高点}
A2:=REF(LOW,3)=LLV(LOW,2*3+1);
B2:=FILTER(A2,3);
C2:=BACKSET(B2,3+1);
D2:=FILTER(C2,3);{低点}
E1:=(REF(LLV(LOW,2*3),1)+REF(HHV(HIGH,2*3),1))/2; E2:=(HIGH+LOW)/2;{高低点出现
在同一 K线上时可作取舍}
H1:=(D1 AND NOT(D2 AND E1>=E2)) OR BARSTATUS=2 OR BARSCOUNT(CLOSE)=1;
H2:=D1 AND NOT(D2 AND E1>=E2);
L1:=D2 AND NOT(D1 AND E1=E2);
X1:=REF(BARSLAST(H1),1)+1; F1:=BACKSET(H1 AND COUNT(L1,X1)>0,LLVBARS(IF
(L1,LOW,10000),X1));
G1:=F1>REF(F1,1); I1:=BACKSET(G1,2); LD:=I1>REF(I1,1);{过滤后低点}
L2:=LD OR BARSTATUS=2 OR BARSCOUNT(CLOSE)=1;
X2:=REF(BARSLAST(L2),1)+1; F2:=BACKSET(L2 AND COUNT(H2,X2)>0,HHVBARS(IF
(H2,HIGH,0),X2));
G2:=F2>REF(F2,1); I2:=BACKSET(G2,2); HD:=I2>REF(I2,1);{过滤后高点}
DRAWLINE(LD,L,HD,H,0),COLORWHITE,LINETHICK1,POINTDOT;
DRAWLINE(HD,H,LD,L,0),COLORWHITE,LINETHICK1,POINTDOT;
J1:=BACKSET(BARSTATUS=2,MIN(BARSLAST(HD),BARSLAST(LD))+1); J2:=J1>REF(J1,1);
DRAWLINE(J2,IF(HD,H,L),BARSTATUS=2,IF(BARSLAST(HD)>BARSLAST
(LD),H,L),0),COLORWHITE,LINETHICK1,POINTDOT;
A3:=H; B3:=REF(H,REF(BARSLAST(HD),1)+1)>REF(H,REF(BARSLAST(HD),1)+2+REF
(BARSLAST(HD),REF(BARSLAST(HD),1)+2));
D3:=A3 AND B3 AND HD;
E3:=BACKSET(D3,REF(BARSLAST(HD),1)+2);
HH:=E3>REF(E3,1);{找出全部长期高点}
A4:=L>REF(L,REF(BARSLAST(LD),1)+1);
B4:=REF(L,REF(BARSLAST(LD),1)+1); D4:=A4 AND B4 AND LD; E4:=BACKSET(D4,REF
(BARSLAST(LD),1)+2);
LL:=E4>REF(E4,1);{找出全部长期低点}
DRAWICON(HH,H,5),ALIGN1;
DRAWICON(LL,L,4),ALIGN1;
H3:=HH OR BARSTATUS=2 OR BARSCOUNT(C)=1; {后面进行过滤,方法同前。只是不用
考虑 高低点出现在同一K线}
x3:=REF(BARSLAST(H3),1)+1; F3:=BACKSET(H3 AND COUNT(LL,X3)>0,LLVBARS(IF
(LL,L,POW(10,20)),X3));
G3:=F3>REF(F3,1);
I3:=BACKSET(G3,2);
LZ:=I3>REF(I3,1); {长期低点,也可供引用}
L4:=LZ OR BARSTATUS=2 OR BARSCOUNT(C)=1;
X4:=REF(BARSLAST(L4),1)+1; F4:=BACKSET(L4 AND COUNT(HH,X4)>0,HHVBARS(IF(HH,H,-
POW(10,20)),X4));
G4:=F4>REF(F4,1);
I4:=BACKSET(G4,2);
HZ:=I4>REF(I4,1);{长期高点,也可供引用}
DRAWLINE(HZ,H,LZ,L,0),COLORGREEN,LINETHICK1;
DRAWLINE(LZ,L,HZ,H,0),COLORGREEN,LINETHICK1;{长期连线}
K1:=BACKSET(BARSTATUS=2,MIN(BARSLAST(HZ),BARSLAST(LZ))+1); K2:=K1>REF(K1,1);
DRAWLINE(K2,IF(HZ,H,L),BARSTATUS=2,C,0),COLORGREEN,LINETHICK1; {最后的长期连线
,连在收盘价上}
UU:=BACKSET(BARSTATUS=2,BARSLAST(LD)+1);
VV:=UU>REF(UU,1);
WW:=BACKSET(VV,REF(BARSLAST(LD),1)+2);
XX:=WW>REF(WW,1);
DRAWLINE(XX,L,VV,L,1),COLORMAGENTA,LINETHICK1;
UU2:=BACKSET(BARSTATUS=2,BARSLAST(HD)+1);
VV2:=UU2>REF(UU2,1);
WW2:=BACKSET(VV2,REF(BARSLAST(HD),1)+2);
XX2:=WW2>REF(WW2,1);
DRAWLINE(XX2,H,VV2,H,1),COLORMAGENTA,LINETHICK1;
前一低:REF(L,BARSLAST(VV)),COLOR99FF66,POINTDOT,LINETHICK3;
前二低:REF(L,BARSLAST(XX)),COLORFF66FF,POINTDOT,LINETHICK3;
前一高:REF(H,BARSLAST(VV2)),COLOR99FF66,POINTDOT,LINETHICK3;
前二高:REF(H,BARSLAST(XX2)),COLORFF66FF,POINTDOT,LINETHICK3;
短高:=REF(H,BARSLAST(VV2));
短低:=REF(L,BARSLAST(VV));
短比: (C-短低)/(短高-短低),LINETHICK0;
常数:=REF(INDEXC,BARSLAST(VV))/REF(C,BARSLAST(VV));
叠1:INDEXC/常数,COLORGRAY,LINETHICK0;
PARTLINE(叠1,1),COLORGRAY;
常数2:=REF(INDEXC,BARSLAST(XX))/REF(C,BARSLAST(XX));
叠2:INDEXC/常数2,COLORGRAY,LINETHICK0;
PARTLINE(叠2,1),COLORGRAY;
s:=NUMTOSTR(DAYS1970-DATETOD1970(REF( DATE,BARSLAST(LD) ) ),0 );
s1:=NUMTOSTR(DAYS1970-DATETOD1970(REF( DATE,BARSLAST(HD) ) ),0 );
DRAWTEXT(HD,1.02*H,s),COLORCYAN;
DRAWTEXT(LD,0.98*L,s1),COLORCYAN;
DRAWNUMBER(HD,H*1.1,h,2),colorgreen;
DRAWNUMBER(HD,l*0.9,l,2),colorred
375.问:
求KD金叉5天后才连续指示直至死叉的写法?
答(一鸣):
K:="KDJ.K#DAY";
D:="KDJ.D#DAY";
all(k>d,5);
|