通达信机构散户资金分时主图指标主图源码
DRAWGBK(1,RGB(0,0,0),RGB(1,1,1),1,0,0);
VR1:=1270915;VR2:=1270920;
VR3:=IF(DATE>VR1,IF(CLOSE<80,1,0),0);
VR4:=IF(DATE>VR2,1,VR3);
P2:=IF(VR3=1,0,240);
TC1:=IF(H=HHV(H,P2),C,DRAWNULL);
TC2:=CONST(BARSLAST(TC1=H))+1;
UPPER:=CONST(IF(TC2=1,C,REF(C,TC2-1)));
BC1:=IF(L=LLV(L,P2),C,DRAWNULL);
BC2:=CONST(BARSLAST(BC1=L))+1;
LOWER:=CONST(IF(BC2=1,C,REF(C,BC2-1)));
NOD:=(IF(TC2>BC2,TC2,BC2)-IF(TC2>BC2,BC2,TC2));{用时}
LR1:=FORCAST(C,NOD+1);
NP:=IF(CURRBARSCOUNT<=MAX(BC2,TC2),CONST(IF(MIN(TC2,BC2)=1,LR1,REF(LR1,MIN(TC2,BC2)-1))),DRAWNULL),POINTDOT,COLORLIGRAY;{近点}
LR2:=SLOPE(C,NOD+1);
LR3:=CONST(IF(MIN(TC2,BC2)=1,LR2,REF(LR2,MIN(TC2,BC2)-1)));
FP:=NP-LR3*(NOD),POINTDOT,COLORGRAY;{远点}
EQU:=(NP+FP)/2,POINTDOT,COLOR0000FF;
AD:=ABS(NP-FP);{高差};
DBL:=BARSLAST(BC1!=DRAWNULL)+1;
DBH:=BARSLAST(TC1!=DRAWNULL)+1;
BSP:=IF(BC2>TC2,DBL,DBH)-1;
LRL:=IF(NP>FP,FP+AD/NOD*BSP,FP-AD/NOD*BSP);
AT1:=IF(BETWEEN(CURRBARSCOUNT,BC2,TC2) AND H>LRL,H,LRL);
AT2:=HHV(AT1-LRL,MAX(BC2,TC2));
AT3:=CONST(BARSLAST(AT1-LRL=AT2));
AT4:=CONST(IF(AT3=0,H,REF(H,AT3)));
AT5:=CONST(IF(AT3=0,AT1-LRL,REF(AT1-LRL,AT3)));
ATL:=LRL+AT5;
UT1:=IF(BETWEEN(CURRBARSCOUNT,BC2,TC2) AND L<LRL,L,LRL);
UT2:=HHV(LRL-UT1,MAX(BC2,TC2));
UT3:=CONST(BARSLAST(LRL-UT1=UT2));
UT4:=CONST(IF(UT3=0,H,REF(H,UT3)));
UT5:=CONST(IF(UT3=0,LRL-UT1,REF(LRL-UT1,UT3)));
UTL:=LRL-UT5;
RH:=IF(CURRBARSCOUNT>=MIN(BC2,TC2)-10,ATL,CONST(REF(ATL,MIN(BC2,TC2)-11)));{限制高}
RL:=IF(CURRBARSCOUNT>=MIN(BC2,TC2)-10,UTL,CONST(REF(UTL,MIN(BC2,TC2)-11)));{限制低}
中轨2:=IF(NP>FP,IF(LRL<=RH,LRL,DRAWNULL),IF(LRL>=RL,LRL,DRAWNULL)),COLORBLUE,,DOTLINE;
上轨2:=IF(NP>FP,IF(ATL<=RH,ATL,DRAWNULL),IF(ATL>=RL,ATL,DRAWNULL)),COLORMAGENTA,,DOTLINE;
下轨2:=IF(NP>FP,IF(UTL<=RH,UTL,DRAWNULL),IF(UTL>=RL,UTL,DRAWNULL)),COLOR00EE00,,DOTLINE;
T30:=IF(BARSSINCE(C>0)>=30,1,0);
{画线}
{IF(T30 AND 上轨2>REF(上轨2,2),上轨2,DRAWNULL),COLOR660066;
IF(T30 AND 中轨2>REF(中轨2,2),中轨2,DRAWNULL),COLOR660066;
IF(T30 AND 下轨2>REF(下轨2,2),下轨2,DRAWNULL),COLOR660066;
IF(T30 AND 上轨2<=REF(上轨2,2),上轨2,DRAWNULL),COLOR999900;
IF(T30 AND 中轨2<=REF(中轨2,2),中轨2,DRAWNULL),COLOR999900;
IF(T30 AND 下轨2<=REF(下轨2,2),下轨2,DRAWNULL),COLOR999900;}
X_1:=SUM(VOL*CLOSE,0)/SUM(VOL,0);
X_2:=EMA(X_1,50)/0.97;
X_3:=(X_1+X_2)/2;
DRAWBAND(X_2,RGB(100,30,0),X_3,0);{上轨填充色}
DRAWBAND(X_3,RGB(0,100,50),X_1,0);
上轨:X_2,COLORGREEN,LINETHICK2;
上轨变色:IF(X_2>REF(X_2,1),X_2,DRAWNULL),COLORRED,LINETHICK2;
中轨:X_3,COLORYELLOW;
下轨:X_1,COLORBLUE;
现价:CLOSE,COLORWHITE,LINETHICK2;
X_4:=CONST(REF(CLOSE,480));
X_5:=CONST(HHV(HIGH,480));
X_6:=CONST(LLV(LOW,480));
X_7:=EMA(CLOSE,30);
X_8:=EMA(CLOSE,900);
X_9:=MAX(X_4,X_5);
X_10:=MIN(X_4,X_6);
X_11:=X_9-X_10;
X_12:=X_10+X_11*7/8;
X_13:=X_10+X_11*0.5/8;
漂移点1:=DRAWICON(LONGCROSS(X_13,CLOSE,2),CLOSE*0.995,7);
漂移点2:=DRAWICON(LONGCROSS(CLOSE,X_12,2),CLOSE*1.005,8);
X_14:=BARSCOUNT(CLOSE);
X_15:=CROSS(CLOSE,REF(HHV(HIGH,X_14),1)) AND CLOSE/X_1<1.09 AND X_14>=1 AND X_14<240;
DRAWICON(FILTER(X_15,1),X_1,32);{分时轨道小图标}
FSX_1:=CONST(REF(CLOSE,480));
FSX_2:=CONST(HHV(HIGH,480));
FSX_3:=CONST(LLV(LOW,480));
FSX_4:=MAX(FSX_1,FSX_2);
FSX_5:=MIN(FSX_1,FSX_3);
FSX_6:=FSX_4-FSX_5;
FSX_9:=SUM(CLOSE*VOL,BARSSINCE(VOL>0)+1)/SUM(VOL,BARSSINCE(VOL>0)+1)+(BARSSINCE(VOL>0)+1)*0;
FSX_12:EMA(EXPMA(CLOSE,20),13)COLORMAGENTA;
均价:=FSX_9,COLORYELLOW,LINETHICK2;
阻力FS:=FSX_5+FSX_6*7/8;
支撑FS:=FSX_5+FSX_6*1/8;
{FS顶:=STICKLINE(C>阻力FS,C,阻力FS,1,0),COLORGREEN;}
FS底:=STICKLINE(C<支撑FS,C,支撑FS*1.005,1,0),COLORRED;
攻击量:=((HSL*0.50+REF(HSL,1)*0.33)+(REF(HSL,2)*0.17))*SUM(C,FROMOPEN)/FROMOPEN;
攻击量A:=SUM(IF(C>REF(C,1),攻击量*V,0),FROMOPEN);
攻击量B:=-SUM(IF(C<REF(C,1),攻击量*V,0),FROMOPEN);
攻击流量:=攻击量A+攻击量B;
攻击比:=攻击流量/SUM(V,FROMOPEN)*100;
资金攻击度:=IF(攻击比>=0,(攻击比+50),100-ABS((攻击比-50)));
资金流入:=SUM(IF(C>REF(C,1),V,0),FROMOPEN);
资金流出:=-SUM(IF(C<REF(C,1),V,0),FROMOPEN);
资金出入:=资金流入+资金流出;
资金比:=资金出入/SUM(V,FROMOPEN)*100;
资金流量比:=IF(资金比>=0,(资金比+100)/2,100-ABS((资金比-100)/2));
DRAWTEXT_FIX(1,0.2,1,1,STRCAT(STRCAT('【资金流量比】',CON2STR(资金流量比,2)),'%买'));
DRAWTEXT_FIX(1,0.2,0.93,1, STRCAT(STRCAT('【资金攻击度】',CON2STR(资金攻击度,2)),'%买'));
XGBB:=HHV(H,480);
去除5:=STICKLINE(FILTER(CROSS(C,REF(XGBB,1)),10) AND C>REF(XGBB,1),C*0.99,C,8,0);
去除6:=DRAWTEXT(FILTER(CROSS(C,REF(XGBB,1)),10) AND C>REF(XGBB,1),C*0.99,'突破');
RQ:=DATETODAY(DATE)-DATETODAY(REF(DATE,TOTALBARSCOUNT-CURRBARSCOUNT))+1;
JY:=BARSLAST((RQ-REF(RQ,1))!=WEEKDAY-REF(WEEKDAY,1) OR TOTALBARSCOUNT-CURRBARSCOUNT=0)+1;
MA1:=REF(C,JY);
MA2:=REF(MA1,JY);
MA3:=REF(MA2,JY);
MA4:=REF(MA3,JY);
MA5:=REF(MA4,JY);
MA6:=REF(MA5,JY);
MA7:=REF(MA6,JY);
MA8:=REF(MA7,JY);
MA9:=REF(MA8,JY);
CK:=REFDATE((C+MA1+MA2+MA3+MA4+MA5+MA6+MA7+MA8+MA9)/10,DATE);
去除8:=DRAWTEXT(ISLASTBAR,CK,' 参考线');
DIF:=(EMA(CLOSE,12)-EMA(CLOSE,26))+DYNAINFO(3);
DEA:=EMA(DIF,9);
MACD1:=10*(DIF-DEA);
MACD2:=EMA(MACD1,2);
源码过长,未粘贴完.......请下载附件源码...
未来函数检测结果如下:
该公式包含未来函数:DYNAINFO
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
填充背景(1,RGB(0,0,0),RGB(1,1,1),1,0,0)
VR1赋值:1270915
VR2赋值:1270920
VR3赋值:IF(DATE>VR1,IF(收盘价<80,1,0),0)
如果DATE>VR2返回1否则返回VR3
如果VR3=1返回0否则返回240
TC1赋值:IF(H=P2日内H最高值,C,DRAWNULL)
TC2赋值:CONST(上次TC1=H距今天数)+1
UPPER赋值:CONST(IF(TC2=1,C,TC2-1日前的C))
BC1赋值:IF(L=P2日内L最低值,C,DRAWNULL)
BC2赋值:CONST(上次BC1=L距今天数)+1
LOWER赋值:CONST(IF(BC2=1,C,BC2-1日前的C))
如果TC2>BC2返回TC2否则返回BC2
{用时}
LR1赋值:FORCAST(C,NOD+1)
NP赋值:IF( 到最后交易的周期<=BC2和TC2较大值,CONST(IF(TC2和BC2的较小值=1,LR1,REF(LR1,TC2和BC2的较小值-1))),DRAWNULL),POINTDOT,COLORLIGRAY
{近点}
LR2赋值:SLOPE(C,NOD+1)
LR3赋值:CONST(IF(TC2和BC2的较小值=1,LR2,REF(LR2,TC2和BC2的较小值-1)))
FP赋值:NP-LR3*(NOD),POINTDOT,COLORGRAY
{远点}
EQU赋值:(NP+FP)/2,POINTDOT,COLOR0000FF
AD赋值:NP-FP的绝对值
{高差}
DBL赋值:上次BC1!=DRAWNULL距今天数+1
DBH赋值:上次TC1!=DRAWNULL距今天数+1
如果BC2>TC2返回DBL否则返回DBH
如果NP>FP返回FP+AD/NOD*BSP否则返回FP-AD/NOD*BSP
AT1赋值:IF(BETWEEN( 到最后交易的周期,BC2,TC2) AND H>LRL,H,LRL)
AT2赋值:BC2和TC2较大值日内AT1-LRL最高值
AT3赋值:CONST(上次AT1-LRL=AT2距今天数)
AT4赋值:CONST(IF(AT3=0,H,AT3日前的H))
AT5赋值:CONST(IF(AT3=0,AT1-LRL,AT3日前的AT1-LRL))
ATL赋值:LRL+AT5
UT1赋值:IF(BETWEEN( 到最后交易的周期,BC2,TC2) AND L
UT2赋值:BC2和TC2较大值日内LRL-UT1最高值
UT3赋值:CONST(上次LRL-UT1=UT2距今天数)
UT4赋值:CONST(IF(UT3=0,H,UT3日前的H))
UT5赋值:CONST(IF(UT3=0,LRL-UT1,UT3日前的LRL-UT1))
UTL赋值:LRL-UT5
RH赋值:IF( 到最后交易的周期>=BC2和TC2的较小值-10,ATL,CONST(REF(ATL,BC2和TC2的较小值-11)))
{限制高}
RL赋值:IF( 到最后交易的周期>=BC2和TC2的较小值-10,UTL,CONST(REF(UTL,BC2和TC2的较小值-11)))
{限制低}
中轨2赋值:IF(NP>FP,IF(LRL<=RH,LRL,DRAWNULL),IF(LRL>=RL,LRL,DRAWNULL)), 画蓝色,,DOTLINE
上轨2赋值:IF(NP>FP,IF(ATL<=RH,ATL,DRAWNULL),IF(ATL>=RL,ATL,DRAWNULL)),画洋红色,,DOTLINE
下轨2赋值:IF(NP>FP,IF(UTL<=RH,UTL,DRAWNULL),IF(UTL>=RL,UTL,DRAWNULL)),COLOR00EE00,,DOTLINE
T30赋值:IF(BARSSINCE(C>0)>=30,1,0)
{画线}
{IF(T30 AND 上轨2>2日前的上轨2,上轨2,DRAWNULL),COLOR660066
IF(T30 AND 中轨2>2日前的中轨2,中轨2,DRAWNULL),COLOR660066
IF(T30 AND 下轨2>2日前的下轨2,下轨2,DRAWNULL),COLOR660066
IF(T30 AND 上轨2<=2日前的上轨2,上轨2,DRAWNULL),COLOR999900
IF(T30 AND 中轨2<=2日前的中轨2,中轨2,DRAWNULL),COLOR999900
IF(T30 AND 下轨2<=2日前的下轨2,下轨2,DRAWNULL),COLOR999900
}
X_1赋值:0的成交量*收盘价日累和/0的成交量日累和
X_2赋值:X_1的50日指数移动平均/0.97
X_3赋值:(X_1+X_2)/2
DRAWBAND(X_2,RGB(100,30,0),X_3,0)
{上轨填充色}
DRAWBAND(X_3,RGB(0,100,50),X_1,0)
输出上轨:X_2,画绿色,LINETHICK2
上轨变色:IF(X_2>1日前的X_2,X_2,DRAWNULL),画红色,LINETHICK2
输出中轨:X_3,画黄色
输出下轨:X_1, 画蓝色
输出现价:收盘价,画白色,LINETHICK2
X_4赋值:CONST(480日前的收盘价)
X_5赋值:CONST(480日内最高价最高值)
X_6赋值:CONST(480日内最低价最低值)
X_7赋值:收盘价的30日指数移动平均
X_8赋值:收盘价的900日指数移动平均
X_9赋值:X_4和X_5较大值
X_10赋值:X_4和X_6的较小值
X_11赋值:X_9-X_10
X_12赋值:X_10+X_11*7/8
X_13赋值:X_10+X_11*0.5/8
漂移点1赋值:DRAWICON(LONGCROSS(X_13,收盘价,2),收盘价*0.995,7)
漂移点2赋值:DRAWICON(LONGCROSS(收盘价,X_12,2),收盘价*1.005,8)
X_14赋值:收盘价的有效数据周期数
X_15赋值:CROSS(收盘价,REF(X_14日内最高价最高值,1)) AND 收盘价/X_1<1.09 AND X_14>=1 AND X_14<240
DRAWICON(X_15的1过滤,X_1,32)
{分时轨道小图标}
FSX_1赋值:CONST(480日前的收盘价)
FSX_2赋值:CONST(480日内最高价最高值)
FSX_3赋值:CONST(480日内最低价最低值)
FSX_4赋值:FSX_1和FSX_2较大值
FSX_5赋值:FSX_1和FSX_3的较小值
FSX_6赋值:FSX_4-FSX_5
FSX_9赋值:SUM(收盘价*成交量,BARSSINCE(成交量>0)+1)/SUM(成交量,BARSSINCE(成交量>0)+1)+(BARSSINCE(成交量>0)+1)*0
FS输出X_12:收盘价的20日指数移动平均的13日指数移动平均画洋红色
均价赋值:FSX_9,画黄色,LINETHICK2
阻力FS赋值:FSX_5+FSX_6*7/8
支撑FS赋值:FSX_5+FSX_6*1/8
当满足条件C>阻力FS时,在C和阻力FS之间画柱状线
当满足条件C<支撑FS时,在C和支撑FS*1.005之间画柱状线
攻击量赋值:((HSL*0.50+1日前的HSL*0.33)+(2日前的HSL*0.17))*FROM开盘价的C日累和/FROM开盘价
攻击量A:=SUM(IF(C>1日前的C,攻击量*V,0),FROM开盘价)
攻击量B:=-SUM(IF(C<1日前的C,攻击量*V,0),FROM开盘价)
攻击流量赋值:攻击量A+攻击量B
攻击比赋值:攻击流量/FROM开盘价的V日累和*100
资金攻击度赋值:IF(攻击比>=0,(攻击比+50),100-(攻击比-50的绝对值))
资金流入赋值:SUM(IF(C>1日前的C,V,0),FROM开盘价)
资金流出赋值:-SUM(IF(C<1日前的C,V,0),FROM开盘价)
资金出入赋值:资金流入+资金流出
资金比赋值:资金出入/FROM开盘价的V日累和*100
资金流量比赋值:IF(资金比>=0,(资金比+100)/2,100-(资金比-100的绝对值/2))
DRAWTEXT_FIX(1,0.2,1,1,STRCAT(STRCAT('【资金流量比】',CON2STR(资金流量比,2)),'%买'))
DRAWTEXT_FIX(1,0.2,0.93,1, STRCAT(STRCAT('【资金攻击度】',CON2STR(资金攻击度,2)),'%买'))
XGBB赋值:480日内H最高值
去除5赋值:STICKLINE(FILTER(CROSS(C,1日前的XGBB),10) AND C>1日前的XGBB,C*0.99,C,8,0)
去除6赋值:DRAWTEXT(FILTER(CROSS(C,1日前的XGBB),10) AND C>1日前的XGBB,C*0.99,'突破')
RQ赋值:DATETODAY(DATE)-DATETODAY(TOTALBARSCOUNT- 到最后交易的周期日前的DATE)+1
JY赋值:上次(RQ-1日前的RQ距今天数!=WEEKDAY-1日前的WEEKDAY OR TOTALBARSCOUNT- 到最后交易的周期=0)+1
MA1赋值:JY日前的C
MA2赋值:JY日前的MA1
MA3赋值:JY日前的MA2
MA4赋值:JY日前的MA3
MA5赋值:JY日前的MA4
MA6赋值:JY日前的MA5
MA7赋值:JY日前的MA6
MA8赋值:JY日前的MA7
MA9赋值:JY日前的MA8
CK赋值:REFDATE((C+MA1+MA2+MA3+MA4+MA5+MA6+MA7+MA8+MA9)/10,DATE)
当满足条件ISLASTBAR时,在CK和' 参考线'位置书写文字
DIF赋值:(收盘价的12日指数移动平均-收盘价的26日指数移动平均)+DYNAINFO(3)
DEA赋值:DIF的9日指数移动平均
MACD1赋值:10*(DIF-DEA)
MACD2赋值:MACD1的2日指数移动平均
源码过长,未粘贴完.......请下载附件源码...