通达信主图公式交易参考源码

 2023-07-22 11:59:44    通达信指标网  

{参数s=2,p=0}   

VARA:=(((CLOSE - EMA(CLOSE,13)) / EMA(CLOSE,13)) * (0 - 100));   

趋势线:=EMA(((VARA/10)+EMA(CLOSE,10)),3);   

VARB:=(OPEN+HIGH+LOW)/3;   

VARC:=EMA(VARB,4);   

行情线:=VARC;   

BUY11:=IF(CROSS(行情线,趋势线) OR (REF(行情线,1)=REF(趋势线,1) AND 行情线>趋势线),1,0);    

DRAWTEXT(CROSS(行情线,趋势线) OR (REF(行情线,1)=REF(趋势线,1) AND 行情线>趋势线),LOW*0.98,'▲'),COLOR0000FF;   

DRAWTEXT(CROSS(行情线,趋势线) OR (REF(行情线,1)=REF(趋势线,1) AND 行情线>趋势线),LOW*0.97,'∣'),COLOR0000FF;   

DRAWTEXT(CROSS(行情线,趋势线) OR (REF(行情线,1)=REF(趋势线,1) AND 行情线>趋势线),LOW*0.975,'‖'),COLOR0000FF;   

DRAWTEXT(CROSS(行情线,趋势线) OR (REF(行情线,1)=REF(趋势线,1) AND 行情线>趋势线),LOW*0.96,'∣'),COLOR0000FF;   

DRAWTEXT(CROSS(行情线,趋势线) OR (REF(行情线,1)=REF(趋势线,1) AND 行情线>趋势线),LOW*0.97,'‖'),COLOR0000FF;   

DRAWTEXT(CROSS(行情线,趋势线) OR (REF(行情线,1)=REF(趋势线,1) AND 行情线>趋势线),LOW*0.95,'∣'),COLOR0000FF;   

DRAWTEXT(CROSS(行情线,趋势线) OR (REF(行情线,1)=REF(趋势线,1) AND 行情线>趋势线),LOW*0.965,'‖'),COLOR0000FF;   

DRAWTEXT(CROSS(趋势线,行情线) OR (REF(行情线,1)=REF(趋势线,1) AND 行情线<趋势线),HIGH*1.02,'▼'),COLOR00FF00;   

DRAWTEXT(CROSS(趋势线,行情线) OR (REF(行情线,1)=REF(趋势线,1) AND 行情线<趋势线),HIGH*1.030,'∣'),COLOR00FF00;   

DRAWTEXT(CROSS(趋势线,行情线) OR (REF(行情线,1)=REF(趋势线,1) AND 行情线<趋势线),HIGH*1.025,'‖'),COLOR00FF00;   

DRAWTEXT(CROSS(趋势线,行情线) OR (REF(行情线,1)=REF(趋势线,1) AND 行情线<趋势线),HIGH*1.040,'∣'),COLOR00FF00;   

DRAWTEXT(CROSS(趋势线,行情线) OR (REF(行情线,1)=REF(趋势线,1) AND 行情线<趋势线),HIGH*1.03,'‖'),COLOR00FF00;   

DRAWTEXT(CROSS(趋势线,行情线) OR (REF(行情线,1)=REF(趋势线,1) AND 行情线<趋势线),HIGH*1.050,'∣'),COLOR00FF00;   

DRAWTEXT(CROSS(趋势线,行情线) OR (REF(行情线,1)=REF(趋势线,1) AND 行情线<趋势线),HIGH*1.035,'‖'),COLOR00FF00;   

FF:=EMA(CLOSE,3);   

MA15:=EMA(CLOSE,21);   

FA:=IF(CROSS(FF,MA15),1,0);   

TR:=MAX(MAX((HIGH - LOW),ABS(REF(CLOSE,1) - HIGH)),ABS(REF(CLOSE,1) - LOW));   

ATR:=MA(TR,14);   

AA:=(HHV(HIGH,20) - (2 * ATR));   

BB:=CROSS(CLOSE,REF(HHV(HIGH,55),1));   

SSS:=CROSS(MIN(MA(CLOSE,13),AA),CLOSE);   

BBB:=BARSLAST(BB);   

SSSB:=BARSLAST(SSS);   

B1:=((BBB = 0) AND (REF(SSSB,1) < REF(BBB,1)));   

B1B:=BARSLAST(B1);   

B2:=((((BB = 1) AND (B1B < SSSB)) AND (B1B > 0)) AND (COUNT(BB,SSSB) < 3));   

B2B:=BARSLAST(B2);   

B3:=((((BB = 1) AND (B2B < B1B)) AND (COUNT(BB,SSSB) < 4)) AND (COUNT(BB,SSSB) > 2));   

DRAWTEXT((B1=1 AND 行情线>=趋势线 AND BUY11=0) OR (B2=1 AND 行情线>=趋势线 AND BUY11=0),LOW*0.98,'▲'),COLORFF00FF;   

A:=(3*CLOSE+LOW+OPEN+HIGH)/6;   

X:=(20*A+19*REF(A,1)+18*REF(A,2)+17*REF(A,3)+16*REF(A,4)+15*REF(A,5)+   

14*REF(A,6)+13*REF(A,7)+12*REF(A,8)+11*REF(A,9)+10*REF(A,10)+9*REF(A,11)+8*REF(A,12)   

+7*REF(A,13)+6*REF(A,14)+5*REF(A,15)+4*REF(A,16)+3*REF(A,17)+2*REF(A,18)+   

REF(A,20))/210;   

Y:=EMA(X,13);   

加仓A:=SMA(EMA((C-REF(C,1))/REF(C,1),5)*100,3,1)*10;   

DRAWTEXT(FILTER((CROSS(加仓A,0) OR CROSS(CLOSE,Y)) AND 行情线>=趋势线 AND BUY11=0 AND FA=0,3),LOW*0.98,'▲'),COLORFF00FF;   

加仓:=(B1=1 AND 行情线>=趋势线 AND BUY11=0) OR (B2=1 AND 行情线>=趋势线 AND BUY11=0) OR FILTER((CROSS(加仓A,0) OR CROSS(CLOSE,Y)) AND 行情线>=趋势线 AND BUY11=0 AND FA=0,3);   

STICKLINE(加仓,C,O,6,1),COLORFF00FF;   

STICKLINE(加仓,OPEN,CLOSE,4.5,1),COLORFF0099;   

STICKLINE(加仓,OPEN,CLOSE,3,0),COLORFF00CC;   

STICKLINE(加仓,OPEN,CLOSE,2,0),COLORFF00FF;   

VARJ1:=REF(CLOSE,1);   

VARJ2:=((SMA(MAX(CLOSE-VARJ1,0),6,1))/(SMA(ABS(CLOSE-VARJ1),6,1)))*(100);   

减仓A:=CROSS(85,VARJ2);   

DRAWTEXT(减仓A AND 行情线>=趋势线,HIGH*1.02,'▼'),COLORYELLOW;   

MTM:=C-REF(C,1);   

DX:=100*EMA(EMA(MTM,6),6)/EMA(EMA(ABS(MTM),6),6);   

DY:=HHV(DX,2)=HHV(DX,7) AND COUNT(DX>50,2) AND CROSS(MA(DX,2),DX);   

LC:=REF(CLOSE,1);   

RSI:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100;    

减仓B:=FILTER(CROSS(84,RSI) OR DY,5);   

DRAWTEXT(减仓B AND 行情线>=趋势线,H*1.02,'▼'),COLORYELLOW;   

减仓:=减仓A OR 减仓B;   

DRAWTEXT(FA AND BUY11=0,(LOW * 0.98),'□□'),COLOR0099FF;   

底背离:=FA AND BUY11=0;   

{TY:=C;   

HD:=FILTER(BACKSET(FILTER(REF(TY,10)=HHV(TY,2*10+1),10),10+1),10);   

LD:=FILTER(BACKSET(FILTER(REF(TY,10)=LLV(TY,2*10+1),10),10+1),10);   

A2:=REF(C,BARSLAST(HD));   

B2A:=REF(C,BARSLAST(LD));   

T1:=BARSLAST(HD)<BARSLAST(LD) AND NOT(HD) ;   

T2:=BARSLAST(HD)>BARSLAST(LD) AND NOT(LD);   

顶:IF(T1,A2,A2),COLOR00FF00,POINTDOT,LINETHICK2;   

STICKLINE(T1,A2,A2,9,0),COLOR00FF00;   

底:IF(T2,B2A,B2A),COLORFF00FF,POINTDOT,LINETHICK2;   

STICKLINE(T2,B2A,B2A,9,0),COLORFF00FF;}   

VAR2:=(C+L+O+H)/4;   

多头线:=(20*VAR2+19*REF(VAR2,1)+18*REF(VAR2,2)+17*REF(VAR2,3)+16*REF(VAR2,4)+15*REF(VAR2,5)+14*REF(VAR2,6)+13*REF(VAR2,7)+12*REF(VAR2,8)+11*REF(VAR2,9)+10*REF(VAR2,10)+9*REF(VAR2,11)+8*REF(VAR2,12)+7*REF(VAR2,13)+6*REF(VAR2,14)+5*REF(VAR2,15)+4*REF(VAR2,16)+3*REF(VAR2,17)+2*REF(VAR2,18)+REF(VAR2,19))/210;   

空头线:=EMA(多头线,4);   

STICKLINE(多头线>空头线,多头线,空头线,4,1),COLORYELLOW;   

STICKLINE(多头线<空头线,多头线,空头线,4,1),COLORCCCCCC;   

压制:DRAWLINE(C=HHV(C,60),HHV(H,3),C=HHV(C,30) AND C<HHV(C,45),HHV(HIGH,1),P),COLORYELLOW;   

依托:DRAWLINE(L=LLV(L,60),LLV(L,3),L=LLV(L,30) AND L>LLV(L,45),LLV(L,3),P),COLORGREEN;   

E:=(REF(H,S-1)+REF(L,S-1)+REF(C,S-1))/3;   

CRTP:=2*E+(REF(H,S-1)-2*REF(L,S-1));   

CRZL:=2*E-REF(L,S-1);   

CRZC:=2*E-REF(H,S-1);   

CRFZ:=2*E-(2*REF(H,S-1)-REF(L,S-1));   

高:=CONST(CRTP),COLORRED;   

阻:=CONST(CRZL),COLORC7C9FF;   

平:=CONST(E),COLORBLUE;   

支:=CONST(CRZC),COLOR7C9CFF;   

反:=CONST(CRFZ),COLORDD00DD;   

AH:DRAWLINE(S>1&&CURRBARSCOUNT=S+1,高,ISLASTBAR,高,1),COLORRED;   

STICKLINE(ISLASTBAR AND C>(高+阻)*0.5,高,高,22,0),COLORRED;   

NH:DRAWLINE(S>1&&CURRBARSCOUNT=S,阻,ISLASTBAR,阻,1),COLORC7C9FF;   

STICKLINE(ISLASTBAR AND C>(支+平)*0.5,阻,阻,18,0),COLORC7C9FF;   

CDP:DRAWLINE(S>1&&CURRBARSCOUNT=S+3,平,ISLASTBAR,平,1),COLORBLUE;   

STICKLINE(ISLASTBAR,平,平,27,0),COLORBLUE;   

NL:DRAWLINE(S>1 &&CURRBARSCOUNT=S,支,ISLASTBAR,支,1),COLOR7C9CFF;   

STICKLINE(ISLASTBAR AND C<(阻+平)*0.5 ,支,支,18,0),COLOR7C9CFF;   

AL:DRAWLINE(S>1&&CURRBARSCOUNT=S+1,反,ISLASTBAR,反,1),COLORDD00DD;   

STICKLINE(ISLASTBAR AND C<(反+支)*0.5,反,反,22,0),COLORDD00DD;   

TBP:2*REF(C,S)-REF(C,(S+2)),COLORYELLOW,NODRAW;   

TXR:=MAX(MAX((REF(H,S-1)-REF(L,S-1)),ABS(REF(C,S-1) -REF(H,S))),ABS(REF(C,S-1) - REF(L,S))),NODRAW;   

TPS:=CONST(E-TXR),NODRAW;   

TMB:=CONST(E+TXR),NODRAW;   

PS:DRAWLINE(S>1&&CURRBARSCOUNT=S+2,TPS,ISLASTBAR,TPS,S),COLORLICYAN;   

STICKLINE(ISLASTBAR AND C<平,TPS,TPS,25,0),COLORLICYAN;   

MB:DRAWLINE(S>1&&CURRBARSCOUNT=S+2,TMB,ISLASTBAR,TMB,S),COLORLIGRAY;   

STICKLINE(ISLASTBAR AND C>平,TMB,TMB,25,0),COLORLIGRAY;   

RMB:=CONST(BBI),NODRAW;   

RR:DRAWLINE(S>1&&CURRBARSCOUNT=2+2,RMB,ISLASTBAR,RMB,1),COLORLIRED,CIRCLEDOT;   

强D:=HHV(((HIGH + REF(C,1)+REF(LOW,1))/3),17),COLORRED,{NODRAW};   

强K:=HHV(((HIGH+C+REF(LOW,1))/3),17),COLORYELLOW,POINTDOT{MAX(强DNODRAW};   

QD50:=((强D+强K)*0.5+MAX(强D,强K))*0.5;   

DRAWBAND(强D,RGB(0,153,0),QD50,RGB(255,0,0));   

弱D:=LLV(((REF(HIGH,1)+REF(C,1)+LOW)/3),17*(P+1)),COLORGREEN;   

弱K:=LLV(((HIGH+C+REF(LOW,1))/3),17*(P+1)),COLORYELLOW,POINTDOT;   

RD50:=((弱D+弱K)*0.5+MIN(弱D,弱K))*0.5;   

XO:=(强D+弱D)*0.5,COLORMAGENTA;   

DRAWBAND(弱D,RGB(255,255,53),RD50,RGB(0,102,255));  

  •  标签:  

原文链接:https://www.tdxzb.com/?id=1497

本文版权:如无特别标注,本站文章均为原创。

相关文章

服务热线

18020657357

微信客服

微信客服