超级趋势操盘 指标 公式 源码[其他软件公式]
指标公式源码分析及使用说明:
操盘趋势绘制:
这部分用于绘制背景颜色,以反映股票价格的操盘趋势。根据收盘价是否大于0来选择不同的颜色。
买卖信号标记:
根据一系列自定义变量的条件,标记买入、卖出和买卖信号的发生。图标(如buy1、sell1等)用于在图表上直观地显示这些信号。
MACD指标绘制:
MACD指标是一种用于分析股票价格走势的技术指标,由快速(短期)和慢速(长期)移动平均线之间的差异计算得出。这段代码计算了MACD指标的三个线:差离值(DIFF)、信号线(DEA)和MACD柱(MACD)。
MACD柱形图绘制:
根据MACD和某些条件,绘制MACD柱形图。通过不同的颜色表示MACD柱的涨跌情况。
低位金叉和二次金叉绘制:
通过判断MACD的快线和慢线是否发生交叉,并结合其他条件,标记出低位金叉和二次金叉。这些金叉信号常被视为买入信号。
生命线、分离线、持股线、上下轨绘制:
这些线条可以帮助分析股票价格的趋势和交易信号。比如生命线是基于成交量计算的,分离线和持股线则根据移动平均线的不同计算逻辑绘制出来,而上下轨则是根据最高价和最低价计算的。
源码:
{操盘趋势}DRAWGBK((CLOSE > 0),COLORRGB(0,0,30),COLORRGB(0,130,100),1);
{BS}
a:="LTFunc5@FORLT2";
s1:="LTFunc5@LT_S1";
hs:="LTFunc5@LT_HS";
ls:="LTFunc5@LT_LS";
p1:="LTFunc5@LT_P1";
upp:="LTFunc5@LT_UPP";
udd:="LTFunc5@LT_UDD";
DRAWICON(p1=1 and ref(p1,1)=0,l*0.985,'buy1');
DRAWICON(p1=0 and ref(p1,1)=1,h*1.03,'sell1');
DRAWICON(s1=1 and ref(s1,1)=0 and (p1+ref(p1,1))<>1,l*0.995,'bs');
DRAWICON(s1=0 and ref(s1,1)=1 and (p1+ref(p1,1))<>1,h*1.01,'ss');{MACD}
DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:=EMA(DIFF,9);
MACD:=2*(DIFF-DEA);
A:=HHV(DIFF,300);
B:=MACD-REF(MACD,1);
K1:=SYSPARAM(3)-SYSPARAM(2)+1;
DIFF1:=HHV(DIFF,K1);
DEA1:=HHV(DEA,K1);
MACD1:=HHV(MACD,K1);
DIFF2:=LLV(DIFF,K1);
DEA2:=LLV(DEA,K1);
MACD2:=LLV(MACD,K1);
MXA:=MAX(DIFF1[DATACOUNT],MAX(DEA1[DATACOUNT],MACD1[DATACOUNT]));
MNA:=MIN(DIFF2[DATACOUNT],MIN(DEA2[DATACOUNT],MACD2[DATACOUNT]));
A2:=(MXA+MNA)/2;
A3:=MXA-MNA;
H1:=HHV(HIGH,K1);
L1:=LLV(LOW,K1);
MXB:=H1[DATACOUNT];
MNB:=L1[DATACOUNT];
B2:=(MXB+MNB)/2;
B3:=MXB-MNB;
DIFFA:=(DIFF-A2)*B3/A3+B2;
DEAA:=(DEA-A2)*B3/A3+B2;
MACDA:=(MACD-A2)*B3/A3+B2;
B4:=-A2*B3/A3+B2;
STICKLINE(MACD>0 AND B>0,B4,MACDA,10,0),color91B5;
STICKLINE(MACD>0 AND B<0,B4,MACDA,10,0),colorA9B5;
STICKLINE(MACD<0 AND B>0,B4,MACDA,10,0),colorB0B07A;
STICKLINE(MACD<0 AND B<0,B4,MACDA,10,0),color8EB03A;
低位金叉:=CROSS(DIFF,DEA) AND DIFF<-0.1;
STICKLINE(低位金叉,B4,B4+B3/20,6,0),colorFFFF;
DRAWTEXT(低位金叉,B4+B3/20,' 低位金叉'),colorFFFF;
JCCOUNT:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));
二次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1;
STICKLINE(二次金叉,B4,B4-B3/40,2,0),colorFF00FF;
DRAWTEXT(二次金叉,B4-B3/40,' 二次金叉'),ALIGN0,colorFF00FF;{操盘线}
MAA:=MA(C,3);
MAB:=MA(C,8);
FILLRGN(MAA<MAB,MAA,MAB),COLORGREEN;{http://www.cxh99.com}
FILLRGN(MAA>MAB,MAA,MAB),color4440FF;
生命线:sum(vol*(o+c)/2,88)/sum(vol,88),colorff80ff,linethick2;
分离线:MA(CLOSE,17)+ABS(MA(CLOSE,17)-REF(MA(CLOSE,17),1)),colorf4e202,linethick2;
MA17:MA(CLOSE,17)+MA(CLOSE,17)-REF(MA(CLOSE,17),1),linethick2,colorf4e202;
持股线:IF(MA(CLOSE,17)<MA17,MA17,MA(CLOSE,17)),color00d500;
PARTLINE(持股线=MA17,持股线),color80ffff,linethick2;
UPPERL: MA(HIGH,15)*(1+15/130),coloryellow,linethick3;
LOWERL: MA(LOW,15)*(1-15/130),colorred,linethick3;{立体K线}
STICKLINE(CLOSE>OPEN,OPEN,LOW,0.5,0 ),COLOR0000ff;
STICKLINE(CLOSE>OPEN,CLOSE,HIGH,0.5 ,0 ),COLOR0000ff;
STICKLINE(OPEN>=CLOSE,CLOSE,LOW,0.5 ,0 ),colorcyan;
STICKLINE(OPEN>=CLOSE,OPEN,HIGH,0.5 ,0 ),colorcyan;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,7,0 ),COLORff7700;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,6,0 ),COLORff9900;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,5,0 ),COLORffbb00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,4,0 ),COLORffcc00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,3,0 ),COLORffdd00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,2,0 ),COLORffee00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,1,0 ),COLORffFF00;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,7,0) ,COLOR000055;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,6,0) ,COLOR000066;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,5,0) ,COLOR000077;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,4,0) ,COLOR000099;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,3,0) ,COLOR0000bb;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,2,0) ,COLOR0000dd;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,1,0) ,COLOR0000ff;{底买入}
TYP_D:= (HIGH + LOW + CLOSE)/3;
CC1_D:=(TYP_D-MA(TYP_D,14))/(0.015*AVEDEV(TYP_D,14));
C1_D:=SMA(CC1_D,3,1);
C2_D:=SMA(C1_D,3,1);
C3_D:=3*C1_D-2*C2_D;
CB1_D:=EMA(C3_D,5);
LC_D:= REF(CLOSE,1);
RSI1_D:=SMA(MAX(CLOSE-LC_D,0),6,1)/SMA(ABS(CLOSE-LC_D),6,1)*100;
RSI_D:=(RSI1_D-50)*5;
R1_D:=SMA(RSI_D,3,1);
D1_D:=SMA(R1_D,3,1);
J1_D:=3*R1_D-2*D1_D;
RR1_D:=EMA(J1_D,5);
RR2_D:=REF(RR1_D,1);
RR_D:=RR1_D>RR2_D;
RSV_D:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K_D:=SMA(RSV_D,3,1);
K1_D:=(K_D-50)*5;
K2_D:=SMA(K1_D,3,1);
D2_D:=SMA(K2_D,3,1);
J2_D:=3*K2_D-2*D2_D;
BB1_D:=EMA(J2_D,5);
底买入:=RR_D AND NOT(REF(RR_D,1)) AND (RR1_D<-100 AND BB1_D<-100) AND CB1_D<-100;
STICKLINE(底买入,CLOSE ,OPEN,7,0),colorAA00BB;
STICKLINE(底买入,CLOSE ,OPEN,6,0),colorBB11BB;
STICKLINE(底买入,CLOSE ,OPEN,4,0),colorCC22BB;
STICKLINE(底买入,CLOSE ,OPEN,3,0),colorDD33BB;
STICKLINE(底买入,CLOSE ,OPEN,2,0),colorEE44BB;
STICKLINE(底买入,CLOSE ,OPEN,1,0),colorFF55BB;{短线强势}
流通:=(AMOUNT / VOL);
资金流量:=(close-ref(close,1))*流通;
CXH111:=SMA(资金流量,10,1);
MID1:=MA(CXH111,26);
UPPER:=MID1 + 2*STD(CXH111,26);
短线强势:=CROSS(CXH111,UPPER) and C>=O;
STICKLINE(短线强势,CLOSE ,OPEN,7,0),colorAAFF;
STICKLINE(短线强势,CLOSE ,OPEN,5.6,0),colorBBFF;
STICKLINE(短线强势,CLOSE ,OPEN,4.4,0),colorCCFF;
STICKLINE(短线强势,CLOSE ,OPEN,3.3,0),colorDDFF;
STICKLINE(短线强势,CLOSE ,OPEN,2.2,0),colorEEFF;
STICKLINE(短线强势,CLOSE ,OPEN,1.1,0),colorFFFF;LC:=REF(CLOSE,1);
RSI:=((SMA(MAX((CLOSE - LC),0),3,1) / SMA(ABS((CLOSE - LC)),3,1)) * 100);
FF:=EMA(CLOSE,3);
MA15:=EMA(CLOSE,21);
DRAWTEXT(CROSS(FF,MA15),(LOW * 0.99),'底背离'),ColorA6E500;
DRAWTEXT(CROSS(88,RSI),(HIGH * 1.02),'顶背离'),Color1880FF;
DRAWTEXT(CROSS("KDJ.K#WEEK"(9,3,3),"KDJ.D#WEEK"(9,3,3)) ,L,'K'),coloryellow;
DRAWTEXT(CROSS("MACD.DEA#WEEK"(12,26,9),"MACD.DIFF#WEEK"(12,26,9)) ,L,'☆M'),coloryellow;DRAWTEXTEX(c,1,5,10,'所属板块:' + BLKNAME),ALIGN4,colorred;
DD:=FINANCE( 1);
SS:=FINANCE( 7);
BL:=SS/DD*100;
GG:=FINANCE(33);
TH:=DYNAINFO(39);
JZ:=FINANCE(34);
DRAWTEXTEX(c,1,5,70,'总股本:'+NUMTOSTR(DD,0)+'万股' +' 流通A股:'
+NUMTOSTR(SS,0)+'万股'+' 流通比例:'+NUMTOSTR(BL,3)+'%'+' 市盈率:'
+NUMTOSTR(TH,2)+' 倍'+' 收益:'+NUMTOSTR(GG,3)+' 元'+' 净资产:'
+NUMTOSTR(JZ,3)+' 元'),COLORGREEN;{http://www.cxh99.com}Explain(ref(open,1)<>ref(close,1) and REF(CLOSE,2)/REF(OPEN,2) > 1.03 AND REF(OPEN,1) > REF(CLOSE,2) AND ABS(REF(OPEN,1)-REF(CLOSE,1))/REF(CLOSE,1)<0.02 AND CLOSE/OPEN<0.97 AND CLOSE<REF(CLOSE,2),'\n* 黄昏之星 -空方势盛 反转信号 跳空成弃婴'),colorwhite;
Explainicon(ref(open,1)<>ref(close,1) and REF(CLOSE,2)/REF(OPEN,2) > 1.03 AND REF(OPEN,1) > REF(CLOSE,2) AND ABS(REF(OPEN,1)-REF(CLOSE,1))/REF(CLOSE,1)<0.02 AND CLOSE/OPEN<0.97 AND CLOSE<REF(CLOSE,2),'30'),align0;
Explain(ref(open,1)<>ref(close,1) and REF(CLOSE,2)/REF
公式导入教程: 【通达信公式源码导入方法教程】 【同花顺公式源码导入方法教程】 【大智慧新一代公式源码导入方法教程】
有思路,想编写各种指标公式,交易模型,选股公式,还原公式的朋友
可联系技术人员 QQ: 262069696 或微信:cxhjy888 进行 有偿收费 编写!(注:由于人数限制,QQ或微信请选择方便的一个联系我们就行,加好友时请简单备注下您的需求,否则无法通过。谢谢您!)
(注:由于人数限制,QQ或微信请选择方便的一个联系我们就行,加好友时请简单备注下您的需求,否则无法通过。谢谢您!)
相关文章
-
没有相关内容