价量时空副图公式源码
今天从朋友那里看到一个价量趋势副图不错,特供大家分享。
K线个数(30 240 60) J1(-50 120 -49)
{--价量乃为指标之母,亦即先有股价、成交量,始有指标的产生,成反向推算KDJ价--}
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(RSV,3,1);
D:=SMA(K,3,1);
J:=3*K-2*D,COLORFF00FF,NODRAW;
K1:=1/3*RSV+REF(K,1)/3*2;
D1:=1/3*K+REF(D,1)/3*2;
JJ:=3*K1-2*D1;
J11:=J;
J昨:=REF(JJ,1);
JX:=IF(J1=-50,J11,IF(J1=-49,J昨,J1));
J拐头价验证:=((9/7*JX-2*REF(K1,1)+12/7*REF(D1,1))/100)*(HHV(HIGH,9)-LLV(LOW,9))+LLV(LOW,9);
J底部上穿此价买:=IF(J拐头价验证<REF(J拐头价验证,1),J拐头价验证,DRAWNULL),COLOR80FFFF,NODRAW;
J从顶下穿此价卖:=IF(J拐头价验证>REF(J拐头价验证,1),J拐头价验证,DRAWNULL),COLORFFFF00,NODRAW;
J100%价:=CONST(((9/7*100-2*REF(K1,1)+12/7*REF(D1,1))/100)*(HHV(HIGH,9)-LLV(LOW,9))+LLV(LOW,9));
J80%价:=CONST(((9/7*80-2*REF(K1,1)+12/7*REF(D1,1))/100)*(HHV(HIGH,9)-LLV(LOW,9))+LLV(LOW,9));
J50%价:=CONST(((9/7*50-2*REF(K1,1)+12/7*REF(D1,1))/100)*(HHV(HIGH,9)-LLV(LOW,9))+LLV(LOW,9));
J20%价:=CONST(((9/7*20-2*REF(K1,1)+12/7*REF(D1,1))/100)*(HHV(HIGH,9)-LLV(LOW,9))+LLV(LOW,9));
J0%价:=CONST(((9/7*0-2*REF(K1,1)+12/7*REF(D1,1))/100)*(HHV(HIGH,9)-LLV(LOW,9))+LLV(LOW,9));
STICKLINE(1,J0%价,J0%价,80,-1),COLOR606060;
今日拐头价:CONST(J拐头价验证),COLOR80FFFF;
J%:J,COLORFF00FF,NODRAW;
对应股价:((9/7*J-2*REF(K1,1)+12/7*REF(D1,1))/100)*(HHV(HIGH,9)-LLV(LOW,9))+LLV(LOW,9),COLORFF0080,NODRAW;
RSVD:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*(J100%价-J0%价)+J0%价;
KK:=SMA(RSVD,3,1),COLORCC9999;
DD:=SMA(KK,3,1),COLOR0080FF;
股价反推J值:=3*KK-2*DD,COLORFF0080;
{-【主力动向】,即原【SUPL】往事如风-QQ:105365158 经海量数据分析及精准校验--}
TMP:=LARGEINTRDVOL-LARGEOUTTRDVOL;
DDY动因:=IF(TRADENUM>0,(TRADEOUTNUM-TRADEINNUM)*100/TRADENUM,0);
L2有效显示数据:=IF(DDY动因>0 OR DDY动因<0 OR TMP>0 OR TMP<0,DDY动因,DRAWNULL),NODRAW;
涨跌动因%:IF(L2有效显示数据=DRAWNULL,DRAWNULL,(TRADEOUTNUM-TRADEINNUM)*100/TRADENUM),COLOR0080FF,NODRAW;
买卖力度%:IF(L2有效显示数据=DRAWNULL,DRAWNULL,(LARGEINTRDVOL-LARGEOUTTRDVOL)*100/VOL),COLOR0000FF,NODRAW;
动因柱:=IF(L2有效显示数据=DRAWNULL,DRAWNULL,(TRADEOUTNUM-TRADEINNUM)*(J100%价-J0%价)/TRADENUM),COLOR00CCFF,NODRAW;
力度柱:=IF(L2有效显示数据=DRAWNULL,DRAWNULL,(LARGEINTRDVOL-LARGEOUTTRDVOL)*(J100%价-J0%价)/VOL),COLOR0000FF,NODRAW;
RSVM:=(CLOSE-LLV(LOW,5))/(HHV(HIGH,5)-LLV(LOW,5))*(J100%价-J0%价)+J0%价;
%K:=MA(RSVM,3);
%D:=MA(%K,3),COLORAA00DD;
GG:=DRAWBAND(%K,RGB(102,32,51),%D,RGB(0,64,16));
{VAR2:=REF(LOW,1);
VAR3:=SMA(ABS(LOW-VAR2),3,1)/SMA(MAX(LOW-VAR2,0),3,1)*100;
VAR4:=EMA(VAR3*10,3);
VAR5:=LLV(LOW,13);
VAR6:=HHV(VAR4,13);
VAR7:=IF( BARSSINCE(C)>34,1,0);
VAR8:=EMA(IF(LOW<=VAR5,(VAR4+VAR6*2)/2,0),3)/618*VAR7;
VAR9:=IF(VAR8>100,100,VAR8);}
{吸筹:VAR9,LINETHICK0,COLOREE00EE;}
{STICKLINE(VAR9>-120,J0%价,VAR9,3,1);
STICKLINE(VAR9>1 AND "KDJ.J">REF("KDJ.J",1) AND REF("KDJ.J",1)<REF("KDJ.J",2),J0%价,VAR9,3,0),COLORRED;
STICKLINE(VAR9>0.1 AND VAR9<1 AND "KDJ.J">REF("KDJ.J",1) AND REF("KDJ.J",1)<REF("KDJ.J",2),J0%价,VAR9,3,0),COLOR00FFFF;}
STICKLINE(1,J100%价,J100%价,80,-1),COLOR606060;
STICKLINE(1,J80%价,J80%价,80,-1),COLOR606060;
STICKLINE(1,J50%价,J50%价,80,-1),COLOR606060;
STICKLINE(1,J20%价,J20%价,80,-1),COLOR606060;
{涨跌动因柱}
STICKLINE(动因柱>0 AND V>0,J50%价,动因柱+J50%价,2.3,0),COLOR005A66;
STICKLINE(动因柱>0 AND V>0,J50%价,动因柱+J50%价,1.7,0),COLOR006A88;
STICKLINE(动因柱>0 AND V>0,J50%价,动因柱+J50%价,1.0,0),COLOR007AAA;
STICKLINE(动因柱>0 AND V>0,J50%价,动因柱+J50%价,0.33,0),COLOR008ACC;
STICKLINE(动因柱<0 AND V>0,J50%价,动因柱+J50%价,2.3,0),COLOR003300;
STICKLINE(动因柱<0 AND V>0,J50%价,动因柱+J50%价,1.7,0),COLOR004400;
STICKLINE(动因柱<0 AND V>0,J50%价,动因柱+J50%价,1.0,0),COLOR005500;
STICKLINE(动因柱<0 AND V>0,J50%价,动因柱+J50%价,0.33,0),COLOR006000;
DRAWTEXT(CURRBARSCOUNT=K线个数,J100%价,'↖100%'),COLORA0A0A0;
DRAWTEXT(CURRBARSCOUNT=K线个数,J80%价,' ↖80%'),COLORA0A0A0;
DRAWTEXT(CURRBARSCOUNT=K线个数,J50%价,' ↖50%'),COLORA0A0A0;
DRAWTEXT(CURRBARSCOUNT=K线个数,J20%价,' ↖20%'),COLORA0A0A0;
DRAWTEXT(CURRBARSCOUNT=K线个数,J0%价,' ↖0%'),COLORA0A0A0;
{--价量乃为指标之母,亦即先有股价、成交量,始有指标的产生,成反向推算KDJ价--}
DRAWBAND(股价反推J值,RGB(204,0,255),股价反推J值,RGB(255,255,255));
DRAWBAND(KK,RGB(153,153,204),KK,RGB(255,255,255));
DRAWBAND(DD,RGB(128,128,0),DD,RGB(255,255,255));
{通达信主力雷达公式}
B1:=REF(C,1);B2:=REF(C,2);
SS:=IF(C>REF(C,1) AND REF(C,1)>=REF(C,2),1,IF(C<REF(C,1) AND REF(C,1)<=REF(C,2),-1,IF(C>REF(C,2) AND REF(C,2)>REF(C,1),2,IF(C<REF(C,2) AND REF(C,2)<REF(C,1),-2,0))));
SM:=IF(REF(SS,1)!=0,REF(SS,1),IF(REF(SS,2)!=0,REF(SS,2),IF(REF(SS,3)!=0,REF(SS,3),IF(REF(SS,5)!=0,REF(SS,5),IF(REF(SS,6)!=0,REF(SS,6),IF(REF(SS,7)!=0,REF(SS,7),0))))));
金底:=(SS=1 OR SS=2) AND SM<0;
绿顶:=(SS=-1 OR SS=-2) AND SM>0;
AA:=CLOSE>REF(CLOSE,1) AND REF(CLOSE,1)>REF(CLOSE,2) AND REF(CLOSE,1)<REF(CLOSE,3) AND IF(REF(CLOSE,3)<REF(CLOSE,4),1,IF(REF(CLOSE,4)<REF(CLOSE,5),REF(CLOSE,1)<REF(CLOSE,4) OR (REF(CLOSE,2)<REF(CLOSE,4) AND REF(CLOSE,3)>=REF(CLOSE,5)),IF(REF(CLOSE,5)<REF(CLOSE,6),1,REF(CLOSE,6)<REF(CLOSE,7))));
BB:=CLOSE<REF(CLOSE,1) AND REF(CLOSE,1)<REF(CLOSE,2) AND REF(CLOSE,1)>REF(CLOSE,3) AND IF(REF(CLOSE,3)>REF(CLOSE,4),1,IF(REF(CLOSE,4)>REF(CLOSE,5),REF(CLOSE,1)>REF(CLOSE,4) OR (REF(CLOSE,2)>REF(CLOSE,4) AND REF(CLOSE,3)<=REF(CLOSE,5)),IF(REF(CLOSE,5)>REF(CLOSE,6),1,REF(CLOSE,6)>REF(CLOSE,7))));
三平底:=AA AND CLOSE>REF(OPEN,2);
三平顶:=BB AND CLOSE<REF(CLOSE,2);
C_D1:=(3*C+2*O+L+H)/7;
WMA5:=(5*C_D1+4*REF(C_D1 ,1 )+3*REF(C_D1 ,2 )+2*REF(C_D1 ,3 )+REF(C_D1 ,4 ))/15 COLORYELLOW;
C_D2:=REVERSE(C_D1)+2*WMA5 COLORGREEN;
WMA5金叉:=CROSS(WMA5,C_D2*0.997);
WMA5死叉:=CROSS(C_D2,WMA5*0.997);
LC:=REF(CLOSE,1);
RSI1:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100;
主力:=EMA((CLOSE-MA(CLOSE,7))/MA(CLOSE,7)*480,2)*5,COLOR0000FF;
散户:=EMA((CLOSE-MA(CLOSE,11))/MA(CLOSE,11)*480,7)*5,COLOR00FF00;
DRAWICON(CROSS(主力,散户) AND 主力<-10 AND 散户>REF(散户,1) OR (CROSS(主力,散户) AND 散户<-35),J20%价,1);
DRAWTEXT(CROSS(主力,散户) AND 主力<-10 AND (WMA5金叉 OR 金底 OR 三平底),J20%价,8);
DRAWTEXT(CROSS(RSI1,25) AND (WMA5金叉 OR 金底 OR 三平底),J0%价,9);
DRAWTEXT(CROSS(85,RSI1),股价反推J值,10);
{买卖力度柱}
STICKLINE(力度柱>0,J50%价,力度柱+J50%价,0,0),COLOR0000CC;
STICKLINE(力度柱<0,J50%价,力度柱+J50%价,0,0),COLOR009940;
STICKLINE(1,J50%价,J50%价,80,-1),COLOR606060;
{--价量乃为指标之母,亦即先有股价、成交量,始有指标的产生,成反向推算KDJ价--};
652388891.png
|