最新消息: USBMI致力于为网友们分享Windows、安卓、IOS等主流手机系统相关的资讯以及评测、同时提供相关教程、应用、软件下载等服务。

MACD叠加KDJ通达信指标公式源码x

IT圈 admin 41浏览 0评论

2024年4月15日发(作者:褒籁)

4184 <5

T

.36

86・ 362,9O

TWO”

OKJM8 DLA 21 02

OeC-9 37 1400 >44170

lh

.

I

llhlllllll [llllll

Al

iiOii

SO71

46 3<

受人委托,将MACD叠加KDJ合二为一.

合成后的特点是MACD与KDJ较为协调,不会产生其屮任一副图的严重压缩.KDJ只保留了 90天

的数据,这个可以根据自己需要来调节.

仅是模块,任由加工.

MACD是我在传统MACD的基础上加了一条快速线,使原来的DIF变成DEA,快速线则变成 DIF

了,柱子还是传统MACD柱.

这些都不是什么好东西,貝提供有需要的人参考.

DIF:EMA(CLOSE

Z

12)-EMA(CLOSE

/

26),COLORFFOOFF

Z

NODRAW;

DEA:EMA(DIF,9),COLORCCC555,NODRAW;

MACD:(DIF-DEA)*2,NODRAW;

DIFT: =6*DIF-5*EMA(DIF,4);

DEAT:=EMA(DIFT,4);

MACDT:=(DIFT-DEAT)*2;

跟庄器:IF(DIFT>0 AND MACD>0,DIFT,0)

Z

COLOROOOOCC

Z

NODRAW;

DIX:(DIFT+DEA)/2,COLOROOFFFF,NODRAW;

K:=

n

KDJ.K";

D:=

n

KDJ.D

H

;

J:=“KDJ.J”

红天:IF(MACD>=0,BARSLAST(CROSS(MACD

z

O))+l

z

O)

z

COLOROOOOFF,NODRAW;

绿天:IF(MACD

z

BARSLAST(CROSS(0,MACD))+l,0),COLOROOFFOO,NODRAW;

红M2:IF(红

天〉0,SUM(MACD,BARSLAST(CROSS(MACD,0))+1),0),COLOROOOOFF,NODRAW;

绿M2:IF(绿

天〉0,SUM(MACD

z

BARSLAST(CROSS(0,MACD))+l)

z

O),COLOROOFFOO,NODRAW;

界面高:=CONST(H HV(DIF, 120))* 1.1;

界面低:=CONST(H HV(DIF, 120))* 1.1;

界而中轴:=CONST(IF(CONST((界面高+界面低)/2)>0,(界面高•界而低)/2+界而高,界而低

+(界面高■界面低)/2));

叠加界面髙

=IF(CONST((HHV(DIF,10)+LLV(DIF,10))/2)>0』,MAX(ABS(界面髙),ABS(界面

低)))

叠加界面低:=IF(CONST((HHV(DIF,10)+LLV(DIF,10))/2)>0,-MAX(ABS(界面高),ABS(界面

低)),0)

最人界面比例:=MAX(叠加界而高,叠加界而低);

最小界面比例

=MIN(S加界而高,叠加界而低);

叠加比例中轴:=(最大界面比例+最小界面比例)/2;

壳加比例差值匸最大界面比例•最小界面比例;

叠加指标中轴:=(100

0)/2;

叠加指标差值

=(100-0);

叠加平衡基值:=0

YY100:=IF(CURRBARSCOUNT<=60,((100-ft加指标中轴)*叠加比例差值/叠加指标差值+ 叠加

比例中轴)+叠加平衡基值QRAWNULL);

YY80:=IF(CURRBARSCOUNTv=60,((80•叠加指标中轴)*叠加比例差值/叠加指标差值+叠 加比

例中轴)+叠加平衡基值QRAWNULL);

YY50:=IF(CURRBARSCOUNT<=60,((50-叠加指标中轴)*叠加比例差值/叠加指标差值+叠 加比

例中轴)+叠加平衡基值QRAWNULL);

YY20:=IF(CURRBARSCOUNTv=60,((20•叠加指标中轴)*叠加比例差值/叠加指标差值+叠 加比

例中轴)+叠加平衡基值QRAWNULL);

YY00:=IF(CURRBARSCOUNTv=60,((0 ■叠加指标中轴)*叠加比例差值/叠加指标差值+叠加 比

例中轴)+叠加平衡基值QRAWNULL);

DRAWBAND(YY100,RGB(75,75,75)

z

YY80,DRAWNULL);

DRAWBAND(YY80,RGB(40

z

75,40),YY50,DRAWNULL);

DRAWBAND(YY50,RGB(75,75,40),YY20,DRAWNULL);

DRAWBAND(YY20,RGB(0

z

0,155),YY00

z

DRAWNULL);

KKYY:=IF(CURRBARSCOUNT<=60,((K-叠加指标中轴)*叠加比例差值/叠加指标差值+叠加 比

例中轴)+叠加平衡基值QRAWNULL);

DDYY:=IF(CURRBARSCOUNTv=60,((D ■叠加指标中轴)*叠加比例差值/叠加指标差值+叠 加

比例中轴)+叠加平衡基值QRAWNULL);

JJYY:=IF(CURRBARSCOUNTv=60,((J ■叠加指标中轴)*叠加比例差侑/叠加指标差值+叠加 比

例中轴)+叠加平衡基值QRAWNULL);

DRAWBAND(DIF

z

RGB(60

z

60

z

60)

z

DIX,RGB(85,5,0));

STICKLINE(MACD>0

Z

MACD,0,1.2

Z

1),COLORD088FF;

STICKLINE(MACD>0 AND MACDT>=O

z

MACD

z

O

z

1.2

z

O),COLORD088FF;

STICKLINE(MACD>0 AND MACD

z

O,1.2

z

l),COLOREEEEAA;

STICKLINE(MACD>0 AND MACDvREF(MACD,l) AND

MACDT<0,MACD

Z

0,1.2,0COLOREEEEAA;

STICKLINE(MACD<0,0,MACD,1.2

Z

1),COLOR999000;

STICKLINE(MACD<0 AND MACDT<0

Z

0

Z

MACD,1.2,0)

Z

COLOR999000;

STICKLINE(MACD<0 AND MACD>=REF(MACD,1),O,MACD,1.2,1),COLOR2255CC;

STICKLINE(MACD<0 AND MACD>=REF(MACD,1) AND

MACDT>=0,0,MACD,1.2,0),COLOR770066;

零下 TJ:=IF(CROSS(0,DEA)

Z

1,0);

DIF 金叉:=IF(DIF>0 AND CROSS(DIF,DEA),1,0);

总金叉 TJ:=IF(零下 TJ

Z

SUM(DIF 金叉,0),0);

最后金叉次

=HHV(总金叉TJ,0);

总金叉次

=SUM(DIF金叉,0);

轴上首金:IF(总金叉次•最后金叉次=1 AND总金叉次〉REF(总金叉次,1) AND LLV(DIF

z

5)>0

AND LLV(DIF,5)<0.6,HHV(MACD,20),0)

z

COLOR0000FF;

零下 TJ2:=IF(CROSS(0,DEA)

Z

1,0);

DIF 死叉

=IF(DIF>0 AND CROSS(DEA,DIF),l

z

O);

总死叉 TJ:=IF(零下 TJ2,SUM(DIF 死叉,0),0);

最后死叉次

=HHV(总死叉TJ,0);

总死叉次:=SUM(DIF死叉,0);

轴上第1次死叉:=IF(总死叉次•最后死叉次=1 AND总死叉次>REF(总死叉次,1)丄0);

死叉天

=IF(MACD<0 AND DIF>0,BARSLAST(轴上第 1 次死叉)+1,0);

轻装上阵:IF(MACD>REF(MACD,1) AND REF(MACD

天,1,15) AND REF(DIF>0 AND DIF<0.6,l),HHV(DIF,30)/2,0)

Z

COLORFFOOFF;

IF(跟庄

器〉0,IF(MACD>=0,

0.05,0.05),DRAWNULL),CIRCLEDOT,COLOROOOOCC 丄 INETHICK2;

DEA,COLOR0011EE,LINETHICK2;

IF(DEA

Z

DRAWNULL)

Z

COLOR005900

Z

LINETHICK2;

DIF,COLORFFOOFF 丄 INETHICK2;

IF(DIFvREF(DIF,l),DIF,DRAWNULL),COLORDDDDDD 丄 INETHICK2;

DIX,COLOROOFFFF 丄 INETHICK1;

IF(DIX

Z

1),DIX,DRAWNULL),COLORCCC555,LINETHICK1;

DRAWICON(CROSS(DIX

Z

DIF),MACD*1.06

Z

1);

DRAWICON(CROSS(DIF,DIX),MACD*1.06

Z

2);

JJYY,COLORFFFOOO;

KKYY,COLOROOFFOO;

DDYY

Z

COLOROOFFFF;

DRAWTEXT(ISLASTBAR,YY80

Z

VARCAT(

,

K:',VAR2STR(K

Z

2))),COLOROOFFOO;

DRAWTEXT(ISLASTBAR,YY50

Z

VARCAT(

,

D:

,

Z

VAR2STR(D,2)))

Z

COLOROOFFFF;

DRAWTEXT(ISLASTBAR,YY20

Z

VARCAT(

,

J:

,

,VAR2STR(J,2))),COLORFFFOOO;

2024年4月15日发(作者:褒籁)

4184 <5

T

.36

86・ 362,9O

TWO”

OKJM8 DLA 21 02

OeC-9 37 1400 >44170

lh

.

I

llhlllllll [llllll

Al

iiOii

SO71

46 3<

受人委托,将MACD叠加KDJ合二为一.

合成后的特点是MACD与KDJ较为协调,不会产生其屮任一副图的严重压缩.KDJ只保留了 90天

的数据,这个可以根据自己需要来调节.

仅是模块,任由加工.

MACD是我在传统MACD的基础上加了一条快速线,使原来的DIF变成DEA,快速线则变成 DIF

了,柱子还是传统MACD柱.

这些都不是什么好东西,貝提供有需要的人参考.

DIF:EMA(CLOSE

Z

12)-EMA(CLOSE

/

26),COLORFFOOFF

Z

NODRAW;

DEA:EMA(DIF,9),COLORCCC555,NODRAW;

MACD:(DIF-DEA)*2,NODRAW;

DIFT: =6*DIF-5*EMA(DIF,4);

DEAT:=EMA(DIFT,4);

MACDT:=(DIFT-DEAT)*2;

跟庄器:IF(DIFT>0 AND MACD>0,DIFT,0)

Z

COLOROOOOCC

Z

NODRAW;

DIX:(DIFT+DEA)/2,COLOROOFFFF,NODRAW;

K:=

n

KDJ.K";

D:=

n

KDJ.D

H

;

J:=“KDJ.J”

红天:IF(MACD>=0,BARSLAST(CROSS(MACD

z

O))+l

z

O)

z

COLOROOOOFF,NODRAW;

绿天:IF(MACD

z

BARSLAST(CROSS(0,MACD))+l,0),COLOROOFFOO,NODRAW;

红M2:IF(红

天〉0,SUM(MACD,BARSLAST(CROSS(MACD,0))+1),0),COLOROOOOFF,NODRAW;

绿M2:IF(绿

天〉0,SUM(MACD

z

BARSLAST(CROSS(0,MACD))+l)

z

O),COLOROOFFOO,NODRAW;

界面高:=CONST(H HV(DIF, 120))* 1.1;

界面低:=CONST(H HV(DIF, 120))* 1.1;

界而中轴:=CONST(IF(CONST((界面高+界面低)/2)>0,(界面高•界而低)/2+界而高,界而低

+(界面高■界面低)/2));

叠加界面髙

=IF(CONST((HHV(DIF,10)+LLV(DIF,10))/2)>0』,MAX(ABS(界面髙),ABS(界面

低)))

叠加界面低:=IF(CONST((HHV(DIF,10)+LLV(DIF,10))/2)>0,-MAX(ABS(界面高),ABS(界面

低)),0)

最人界面比例:=MAX(叠加界而高,叠加界而低);

最小界面比例

=MIN(S加界而高,叠加界而低);

叠加比例中轴:=(最大界面比例+最小界面比例)/2;

壳加比例差值匸最大界面比例•最小界面比例;

叠加指标中轴:=(100

0)/2;

叠加指标差值

=(100-0);

叠加平衡基值:=0

YY100:=IF(CURRBARSCOUNT<=60,((100-ft加指标中轴)*叠加比例差值/叠加指标差值+ 叠加

比例中轴)+叠加平衡基值QRAWNULL);

YY80:=IF(CURRBARSCOUNTv=60,((80•叠加指标中轴)*叠加比例差值/叠加指标差值+叠 加比

例中轴)+叠加平衡基值QRAWNULL);

YY50:=IF(CURRBARSCOUNT<=60,((50-叠加指标中轴)*叠加比例差值/叠加指标差值+叠 加比

例中轴)+叠加平衡基值QRAWNULL);

YY20:=IF(CURRBARSCOUNTv=60,((20•叠加指标中轴)*叠加比例差值/叠加指标差值+叠 加比

例中轴)+叠加平衡基值QRAWNULL);

YY00:=IF(CURRBARSCOUNTv=60,((0 ■叠加指标中轴)*叠加比例差值/叠加指标差值+叠加 比

例中轴)+叠加平衡基值QRAWNULL);

DRAWBAND(YY100,RGB(75,75,75)

z

YY80,DRAWNULL);

DRAWBAND(YY80,RGB(40

z

75,40),YY50,DRAWNULL);

DRAWBAND(YY50,RGB(75,75,40),YY20,DRAWNULL);

DRAWBAND(YY20,RGB(0

z

0,155),YY00

z

DRAWNULL);

KKYY:=IF(CURRBARSCOUNT<=60,((K-叠加指标中轴)*叠加比例差值/叠加指标差值+叠加 比

例中轴)+叠加平衡基值QRAWNULL);

DDYY:=IF(CURRBARSCOUNTv=60,((D ■叠加指标中轴)*叠加比例差值/叠加指标差值+叠 加

比例中轴)+叠加平衡基值QRAWNULL);

JJYY:=IF(CURRBARSCOUNTv=60,((J ■叠加指标中轴)*叠加比例差侑/叠加指标差值+叠加 比

例中轴)+叠加平衡基值QRAWNULL);

DRAWBAND(DIF

z

RGB(60

z

60

z

60)

z

DIX,RGB(85,5,0));

STICKLINE(MACD>0

Z

MACD,0,1.2

Z

1),COLORD088FF;

STICKLINE(MACD>0 AND MACDT>=O

z

MACD

z

O

z

1.2

z

O),COLORD088FF;

STICKLINE(MACD>0 AND MACD

z

O,1.2

z

l),COLOREEEEAA;

STICKLINE(MACD>0 AND MACDvREF(MACD,l) AND

MACDT<0,MACD

Z

0,1.2,0COLOREEEEAA;

STICKLINE(MACD<0,0,MACD,1.2

Z

1),COLOR999000;

STICKLINE(MACD<0 AND MACDT<0

Z

0

Z

MACD,1.2,0)

Z

COLOR999000;

STICKLINE(MACD<0 AND MACD>=REF(MACD,1),O,MACD,1.2,1),COLOR2255CC;

STICKLINE(MACD<0 AND MACD>=REF(MACD,1) AND

MACDT>=0,0,MACD,1.2,0),COLOR770066;

零下 TJ:=IF(CROSS(0,DEA)

Z

1,0);

DIF 金叉:=IF(DIF>0 AND CROSS(DIF,DEA),1,0);

总金叉 TJ:=IF(零下 TJ

Z

SUM(DIF 金叉,0),0);

最后金叉次

=HHV(总金叉TJ,0);

总金叉次

=SUM(DIF金叉,0);

轴上首金:IF(总金叉次•最后金叉次=1 AND总金叉次〉REF(总金叉次,1) AND LLV(DIF

z

5)>0

AND LLV(DIF,5)<0.6,HHV(MACD,20),0)

z

COLOR0000FF;

零下 TJ2:=IF(CROSS(0,DEA)

Z

1,0);

DIF 死叉

=IF(DIF>0 AND CROSS(DEA,DIF),l

z

O);

总死叉 TJ:=IF(零下 TJ2,SUM(DIF 死叉,0),0);

最后死叉次

=HHV(总死叉TJ,0);

总死叉次:=SUM(DIF死叉,0);

轴上第1次死叉:=IF(总死叉次•最后死叉次=1 AND总死叉次>REF(总死叉次,1)丄0);

死叉天

=IF(MACD<0 AND DIF>0,BARSLAST(轴上第 1 次死叉)+1,0);

轻装上阵:IF(MACD>REF(MACD,1) AND REF(MACD

天,1,15) AND REF(DIF>0 AND DIF<0.6,l),HHV(DIF,30)/2,0)

Z

COLORFFOOFF;

IF(跟庄

器〉0,IF(MACD>=0,

0.05,0.05),DRAWNULL),CIRCLEDOT,COLOROOOOCC 丄 INETHICK2;

DEA,COLOR0011EE,LINETHICK2;

IF(DEA

Z

DRAWNULL)

Z

COLOR005900

Z

LINETHICK2;

DIF,COLORFFOOFF 丄 INETHICK2;

IF(DIFvREF(DIF,l),DIF,DRAWNULL),COLORDDDDDD 丄 INETHICK2;

DIX,COLOROOFFFF 丄 INETHICK1;

IF(DIX

Z

1),DIX,DRAWNULL),COLORCCC555,LINETHICK1;

DRAWICON(CROSS(DIX

Z

DIF),MACD*1.06

Z

1);

DRAWICON(CROSS(DIF,DIX),MACD*1.06

Z

2);

JJYY,COLORFFFOOO;

KKYY,COLOROOFFOO;

DDYY

Z

COLOROOFFFF;

DRAWTEXT(ISLASTBAR,YY80

Z

VARCAT(

,

K:',VAR2STR(K

Z

2))),COLOROOFFOO;

DRAWTEXT(ISLASTBAR,YY50

Z

VARCAT(

,

D:

,

Z

VAR2STR(D,2)))

Z

COLOROOFFFF;

DRAWTEXT(ISLASTBAR,YY20

Z

VARCAT(

,

J:

,

,VAR2STR(J,2))),COLORFFFOOO;

发布评论

评论列表 (0)

  1. 暂无评论