献给有指标编辑爱好的朋友们共享
通达信指标编辑之:变色线形的应用
一,单线变双色
var1:ma(c,30),colorred;
上升:if(var1>ref(var1,1),var1,drawnull),colorred;
下降:if(var1<ref(var1,1),var1,drawnull),colorgreen;
二,单线变三色
var1:ma(c,240),colorred;
上升:if(var1>ref(var1,1),var1,drawnull),colorred;
走平:if(var1=ref(var1,1),var1,drawnull),colorred;
下降:if(var1<ref(var1,1),var1,drawnull),colorgreen;
三,技术指标变色
通达信公式中画分段线的方法
例如:kdj分段线源码:
rsv:=(close-llv(low,9))/(hhv(high,9)-llv(low,9))*100;
k:sma(rsv,3,1),colorwhite;
d:sma(k,3,1),coloryellow;
j:3*k-2*d,coloryellow;
if(k<ref(k,1),k,drawnull),colorgreen,linethick1;
if(d<ref(d,1),d,drawnull),colorgreen,linethick1;
if(j<ref(j,1),j,drawnull),colorffff00,linethick1;
if(k>ref(k,1),k,drawnull),colorred,linethick1;
if(d>ref(d,1),d,drawnull),colorred,linethick1;
if(j>ref(j,1),j,drawnull),colorff00ff,linethick1;
四,macd变色
附图公式,变色macd
dif1:=ema(close,12) - ema(close,26);
dea1:=ema(dif1,9);
macd1:=2*(dif1-dea1),stick;
macd2:=ema(macd1,3);
stickline(macd1>macd2 and macd1>0,0,macd1,1,0),colorred;
stickline(macd1>macd2 and macd1<0,0,macd1,1,0),colorgreen;
stickline(macd1<macd2,0,macd1,1,0),colorcbcbc0;
stickline(macd1>=0 or macd1<=0,0,0,50,1),colorwhite;
dif:dif1,color33ff33;
dea:dea1,coloryellow;
macd:macd1,nodraw,colormagenta;
强:if(dif1>=dea1,dif1,drawnull),colorred,linethick2;
五,变色移动平均线
周:ma(c,5),colorred,linethick2;
k1:=backset(周<ref(周,1),2);
if(k1,周,drawnull),color00cc33,linethick2;
二周:ma(c,10),colorred,linethick2;
k2:=backset(二周<ref(二周,1),2);
if(k2,二周,drawnull),color00cc33,linethick2;
月:ma(c,30),color9933cc,linethick2;
k3:=backset(月<ref(月,1),2);
if(k3,月,drawnull),colorffffff,linethick2;
季:ma(c,60),colorcyan,linethick1;
k4:=backset(季<ref(季,1),2);
if(k4,季,drawnull),color00ffff,linethick1;
半年:ma(c,120),circledot,color6699ff,linethick2;
k5:=backset(半年<ref(半年,1),2);
if(k5,半年,drawnull),circledot,colorffffcc,linethick2;
年:ma(c,240),color0000ff,crossdot,linethick2;
k6:=backset(年<ref(年,1),2);
if(k6,年,drawnull),color00ff00,crossdot,linethick2;
二年:ma(c,480),color00ffff,crossdot,linethick2;
k7:=backset(二年<ref(二年,1),2);
if(k7,二年,drawnull),color006633,crossdot,linethick3;
三年:ma(c,720),colorff00ff,crossdot,linethick2;
k8:=backset(三年<ref(三年,1),2);
if(k8,三年,drawnull),colorff9900,crossdot,linethick2;
六,仿飞狐均线和k线
var1:=close>ref(close,1) and close>ref(close,2);
var2:=ref(var1,1) and close<=ref(close,1) and close>=ref(close,2);
var3:=ref(var2,1) and close>=ref(close,1) and close<=ref(close,2);
var4:=ref(var3,1) and close<=ref(close,1) and close>=ref(close,2);
var5:=ref(var4,1) and close>=ref(close,1) and close<=ref(close,2);
var6:=ref(var5,1) and close<=ref(close,1) and close>=ref(close,2);
var7:=ref(var6,1) and close>=ref(close,1) and close<=ref(close,2);
var8:=ref(var7,1) and close<=ref(close,1) and close>=ref(close,2);
var9:=ref(var8,1) and close>=ref(close,1) and close<=ref(close,2);
vara:=ref(var9,1) and close<=ref(close,1) and close>=ref(close,2);
varb:=ref(vara,1) and close>=ref(close,1) and close<=ref(close,2);
varc:=ref(varb,1) and close<=ref(close,1) and close>=ref(close,2);
stickline(var1 or var2 or var3 or var4 or var5 or var6 or var7 or
var8 or var9 or vara or varb or varc,close,ref(close,1),3,1),colorred;{红1}
vard:=close<ref(close,1) and close<ref(close,2);
vare:=ref(vard,1) and close>=ref(close,1) and close<=ref(close,2);
varf:=ref(vare,1) and close<=ref(close,1) and close>=ref(close,2);
var10:=ref(varf,1) and close>=ref(close,1) and close<=ref(close,2);
var11:=ref(var10,1) and close<=ref(close,1) and close>=ref(close,2);
var12:=ref(var11,1) and close>=ref(close,1) and close<=ref(close,2);
var13:=ref(var12,1) and close<=ref(close,1) and close>=ref(close,2);
var14:=ref(var13,1) and close>=ref(close,1) and close<=ref(close,2);
var15:=ref(var14,1) and close<=ref(close,1) and close>=ref(close,2);
var16:=ref(var15,1) and close>=ref(close,1) and close<=ref(close,2);
var17:=ref(var16,1) and close<=ref(close,1) and close>=ref(close,2);
var18:=ref(var17,1) and close>=ref(close,1) and close<=ref(close,2);
stickline(vard or vare or varf or var10 or var11 or var12 or var13 or
var14 or var15 or var16 or var17 or var18,close,ref(close,1),3,0),colorffcc66;
var19:=ref(vard or vare or varf or var10 or var11 or var12 or var13 or
var14 or var15 or var16 or var17 or var18,1) and var1;
stickline(var19,ref(close,1),ref(close,2),4,1),coloryellow;
var1a:=ref(var1 or var2 or var3 or var4 or var5 or var6 or var7 or
var8 or var9 or vara or varb or varc,1) and vard;
stickline(var1a,ref(close,1),ref(close,2),4,2),color00ff00{98fd};
stickline(var19,ref(close,1),ref(close,2),3,0),color00c8ff;
stickline(var19,ref(close,1),ref(close,2),2,0),color10ecff;
stickline(var19,ref(close,1),ref(close,2),2,0),color10ffff;
stickline(var1a,ref(close,1),ref(close,2),3,0),color00d900;
stickline(var1a,ref(close,1),ref(close,2),3,0),color93ff22;
stickline(var1a,ref(close,1),ref(close,2),0,0),color090ff2;
pma:ma(c,5),colorwhite,linethick2;
if(pma>ref(pma,1),pma,drawnull),colorred,linethick2;
if(pma<ref(pma,1),pma,drawnull),colorgreen,linethick2;
x:=(3*c+l+o+h)/6;
多空线:(20*x+19*ref(x,1)+18*ref(x,2)+17*ref(x,3)+16*ref(x,4)+15*ref(x,5)+14*ref(x,6)
+13*ref(x,7)+12*ref(x,8)+11*ref(x,9)+10*ref(x,10)+9*ref(x,11)+8*ref(x,12)
+7*ref(x,13)+6*ref(x,14)+5*ref(x,15)+4*ref(x,16)+3*ref(x,17)+2*ref(x,18)+
ref(x,20))/210,colorff00ff,linethick2;
{用法:黄托底买进,绿压顶买出。}
dd:=多空线<ref(多空线,1);
if(dd,多空线,drawnull),color00ffff,linethick2;
a:=(pma>多空线);
if(a,多空线,drawnull),color33ff33,pointdot,linethick4;
七,变色yje
aa:=ref(close,1);
bbb:=sma(max(close-aa,0),21,1)/sma(abs(close-aa),21,1)*1000;
hhh:=bbb-llv(bbb,27);
ccc:=llv(bbb,27)-bbb;
qq:(ma(hhh,2)*3+hhh*13)/16,color0000ff,linethick1;
ss:(ma(ccc,2)*3+ccc*13)/16,colorff00ff,linethick1;
gg:ma(hhh,5),linethick1,colorgreen;
mm:ma(ccc,5),linethick1,colorgreen;
ww:if(qq<gg ,ss,mm),linethick1, colorcyan;
ee:if(ss<mm ,gg,qq),colorffffcc,linethick1;
s:0,color00ffff;
上一指标公式:判断趋势-一个用于判断趋势的很不错的指标详解 通达信判断
下一指标公式:大盘副图深沪自动切换指标详解 通达信大盘切换
☉ 好公式网发布的指标公式主要用于软件技术面分析,仅供参考,勿用于实际操作,据此操作风险自负!
☉ 解压密码:www.goodgongshi.com 就是好公式网域名,希望大家看清楚,切勿输错。
☉ tnc和tni格式指标公式,仅可以用通达信软件引入使用,例如可以用通达信软件引入使用指标公式;
☉ tne格式指标公式,仅可以用通达信软件公式编辑器5.0版导入,高版本兼容低版本;
☉ fnc格式指标公式,可以用大智慧软件新一代高速行情分析系统股票软件使用,少部分可以用分析家软件引入使用;
☉ alg格式指标公式,仅仅可以用飞狐交易师软件引入使用;exp格式指标公式,仅可以用大智慧经典版软件引入使用;
☉ hxf格式指标公式,仅可以用同花顺软件引入使用。
☉ 如果您发现下载软件链接错误,请联系管理员报告错误。
☉ 好公式网欢迎各位网友帮忙宣传转发本站网址,有您的支持,我们会做得更好!
☉ 本文变色线形的应用指标详解 通达信变色源码仅供学习研究。