通达信副图指标简介:
大资金主升浪副图通过计算多个变量,包括指数移动平均线(EMA)、价格波动、成交量分配、价格偏离程度等,来识别市场趋势和潜在的大资金建仓信号。代码中使用了多个条件判断和数学运算,如绝对值、平均值、加权移动平均等,以捕捉市场的细微变化。特别地,代码中的VAR11和VAR22变量分别用于检测大资金建仓和加速拉升的市场条件。最后,代码通过STICKLINE和DRAWTEXT函数在图表上绘制相应的图形和文本,以直观地展示这些信号。
指标效果图:
指标公式源码及源码注释:
VAR1:=EMA(C,6)-EMA(C,12);{计算6日EMA与12日EMA的差值}
VAR2:=EMA(VAR1,5);{计算VAR1的5日EMA}
VAR3:=VAR1-VAR2;{计算VAR1与其5日EMA的差值}
VAR4:=ABS(C-O);{计算收盘价与开盘价的绝对差值}
VAR5:=VOL/((H-L)*2-VAR4);{计算成交量与价格波动范围的比例}
VAR6:=IF(C>O,VAR5*(H-L),IF(C<O,VAR5*(H-O+(C-L)),VOL/2))+IF(C>O,0-VAR5*(H-C+(O-L)),IF(C<O,0-VAR5*(H-L),0-VOL/2));{根据收盘价与开盘价的关系计算成交量的分配}
VAR7:=VAR6/20/1.15;{将VAR6标准化,公式网WWW.GUKOUDAI.COM}
VAR8:=EMA(VAR7*0.55+REF(VAR7,1)*0.33+REF(VAR7,2)*0.22,3);{计算VAR7的加权3日EMA}
VAR9:=100-3*SMA((CLOSE-LLV(LOW,75))/(HHV(HIGH,75)-LLV(LOW,75))*100,20,1)+2*SMA(SMA((CLOSE-LLV(LOW,75))/(HHV(HIGH,75)-LLV(LOW,75))*100,20,1),15,1);{计算基于75日高低点的价格变动百分比的加权移动平均}
VAR10:=100-3*SMA((OPEN-LLV(LOW,75))/(HHV(HIGH,75)-LLV(LOW,75))*100,20,1)+2*SMA(SMA((OPEN-LLV(LOW,75))/(HHV(HIGH,75)-LLV(LOW,75))*100,20,1),15,1);{与VAR9类似,但基于开盘价}
VAR11:=VAR9<REF(VAR10,1) AND VOL>REF(VOL,1) AND CLOSE>REF(CLOSE,1);{判断是否为大资金建仓信号}
VAR12:=(HIGH+LOW+CLOSE)/3;{计算价格的平均值}
VAR13:=(VAR12-MA(VAR12,14))/(0.015*AVEDEV(VAR12,14));{计算价格平均值与其14日平均值的偏离程度}
VAR14:=(VAR12-MA(VAR12,70))/(0.015*AVEDEV(VAR12,70));{计算价格平均值与其70日平均值的偏离程度}
VAR15:=IF(VAR13>=150 AND VAR13<200 AND VAR14>=150 AND VAR14<200,10,0);{判断价格偏离程度是否在特定范围内}
VAR16:=IF(VAR13<=-150 AND VAR13>-200 AND VAR14<=-150 AND VAR14>-200,-10,VAR15);{与VAR15相反,判断负偏离程度}
VAR17:=(CLOSE-MA(CLOSE,13))/MA(CLOSE,13)*100;{计算收盘价与其13日平均值的百分比偏离}
VAR18:=100-ABS(VAR17);{计算VAR17的绝对值并从100中减去}
VAR19:=IF(VAR18<90,VAR18,100);{如果VAR18小于90,则取其值,否则为100}
VAR20:=IF(MA(100*(CLOSE-LLV(CLOSE,34))/(HHV(HIGH,34)-LLV(LOW,34)),5)-20>0,MA(100*(CLOSE-LLV(CLOSE,34))/(HHV(HIGH,34)-LLV(LOW,34)),5)-20,0);{计算34日价格变动百分比的5日平均并调整}
VAR21:=IF(VAR14>=200 AND VAR13>=150,15,IF(VAR14<=-200 AND VAR13<=-150,-15,VAR16))+60;{综合VAR13和VAR14的偏离程度}
VAR22:=VAR20>48 AND VAR21>60 AND VAR19<100;{判断是否为加速拉升信号}
STICKLINE(VAR8>0 AND VAR3>0,ABS(VAR3/30),0,1,0),COLORRED;{绘制红色柱状图表示VAR8和VAR3均为正}
STICKLINE(VAR8>0 AND VAR3<0,0,ABS(VAR3/30),1,0),COLORGREEN;{绘制绿色柱状图表示VAR8为正而VAR3为负}
DRAWTEXT(VAR11 AND COUNT(VAR11,30)=1,0.025,' ←大资金建仓'),COLOR80FFFF;{在大资金建仓信号时绘制文本}
STICKLINE(VAR11 AND COUNT(VAR11,30)=1,0,0.03,2,0),COLORFF00FF;{在大资金建仓信号时绘制紫色柱状图}
DRAWTEXT(VAR22 AND COUNT(VAR22,30)=1,0.025,' ←加速拉升'),LINETHICK1,COLOR0000FF;{在加速拉升信号时绘制文本}
STICKLINE(VAR22 AND COUNT(VAR22,30)=1,0,0.03,2,0),COLOR0000FF;{在加速拉升信号时绘制蓝色柱状图}