分享

TD主图趋势划线公式源码

 亨利永贞 2018-05-27


M1:=5;M2:=10;M3:=20;M4:=60;

VAR1:=EMA(CLOSE,2);

VAR2:=EMA(SLOPE(CLOSE,21)*20+CLOSE,42);

STICKLINE(VAR1>=VAR2,REFDATE(HHV(HIGH,0),DATE),REFDATE(LLV(LOW,0),DATE),6,0),COLOR000030;

DRAWKLINE(HIGH,OPEN,LOW,CLOSE);

VAR3:=STRCAT(HYBLOCK,6);

VAR4:=STRCAT(VAR3,DYBLOCK);

VAR5:=STRCAT(VAR4,6);

DRAWTEXT_FIX(ISLASTBAR,0,0,0,STRCAT(VAR5,GNBLOCK)),COLORRED;

NOTEXTMA1:MA(CLOSE,M1),COLORWHITE;

NOTEXTMA2:MA(CLOSE,M2),COLORMAGENTA;

NOTEXTMA3:MA(CLOSE,M3),COLORCYAN;

NOTEXTMA4:MA(CLOSE,M4),COLORGREEN;

VAR6:=REF(CLOSE,1);

VAR7:=REF(HIGH,8)=HHV(HIGH,2*8+1);

VAR8:=REF(LOW,8)=LLV(LOW,2*8+1);

VAR9:=BACKSET(VAR7,8+1);

VAR10:=BACKSET(VAR8,8+1);

VAR11:=FILTER(VAR9,8) AND HIGH=HHV(HIGH,8+1);

VAR12:=FILTER(VAR10,8) AND LOW=LLV(LOW,8+1);

VAR13:=BARSLAST(VAR11);

VAR14:=BARSLAST(VAR12);

VAR15:=IF(VAR11,CURRBARSCOUNT,0);

VAR16:=IF(VAR12,CURRBARSCOUNT,0);

VAR17:=IF(VAR13,REF(VAR15,VAR13),VAR15);

VAR18:=IF(VAR14,REF(VAR16,VAR14),VAR16);

VAR19:=CONST(VAR17);

VAR20:=CONST(VAR18);

VAR21:=CONST(REF(HIGH,VAR19-1));

VAR22:=CONST(REF(LOW,VAR20-1));

VAR23:=REF(VAR17,VAR13+1);

VAR24:=REF(VAR18,VAR14+1);

VAR25:=CONST(VAR23);

VAR26:=CONST(VAR24);

VAR27:=CONST(REF(HIGH,VAR23-1));

VAR28:=CONST(REF(LOW,VAR24-1));

VAR29:=BACKSET(ISLASTBAR,VAR19);

VAR30:=BACKSET(ISLASTBAR,VAR20);

VAR31:=BACKSET(ISLASTBAR,VAR23);

VAR32:=BACKSET(ISLASTBAR,VAR24);

VAR33:=INTPART(3*8/5);

VAR34:=REF(HIGH,VAR33)=HHV(HIGH,2*VAR33+1);

VAR35:=BACKSET(VAR34,VAR33+1);

VAR36:=FILTER(VAR35,VAR33) AND HIGH=HHV(HIGH,VAR33+1);

VAR37:=BARSLAST(VAR36);

VAR38:=IF(VAR36,CURRBARSCOUNT,0);

VAR39:=IF(VAR37,REF(VAR38,VAR37),VAR38);

VAR40:=CONST(VAR39);

VAR41:=REF(VAR39,VAR37+1);

VAR42:=CONST(VAR41);

VAR43:=REF(LOW,VAR33)=LLV(LOW,2*VAR33+1);

VAR44:=BACKSET(VAR43,VAR33+1);

VAR45:=FILTER(VAR44,VAR33) AND LOW=LLV(LOW,VAR33+1);

VAR46:=BARSLAST(VAR45);

VAR47:=IF(VAR45,CURRBARSCOUNT,0);

VAR48:=IF(VAR46,REF(VAR47,VAR46),VAR47);

VAR49:=CONST(VAR48);

VAR50:=REF(VAR48,VAR46+1);

VAR51:=CONST(VAR50);

VAR52:=REF(HIGH,5)=HHV(HIGH,2*5+1);

VAR53:=FILTER(VAR52,5);

VAR54:=BACKSET(VAR53,5+1);

VAR55:=FILTER(VAR54,5);

VAR56:=BACKSET(ISLASTBAR,BARSLAST(VAR55)+1);

VAR57:=VAR56>REF(VAR56,1);

VAR58:=REF(LOW,5)=LLV(LOW,2*5+1);

VAR59:=FILTER(VAR58,5);

VAR60:=BACKSET(VAR59,5+1);

VAR61:=FILTER(VAR60,5);

VAR62:=BACKSET(ISLASTBAR,BARSLAST(VAR61)+1);

VAR63:=VAR62>REF(VAR62,1);

VAR64:=10;

VAR65:=10;

VAR66:=REF(HIGH,VAR64)=HHV(HIGH,2*VAR64+1);

VAR67:=BACKSET(VAR66,VAR64+1);

VAR68:=FILTER(VAR67,VAR64) AND HIGH=HHV(HIGH,VAR64+1);

VAR69:=BARSLAST(VAR68);

VAR70:=IF(VAR68,CURRBARSCOUNT,0);

VAR71:=IF(VAR69,REF(VAR70,VAR69),VAR70);

VAR72:=CONST(VAR71);

VAR73:=REF(VAR71,VAR69+1);

VAR74:=CONST(VAR73);

VAR75:=REF(LOW,VAR65)=LLV(LOW,2*VAR65+1);

VAR76:=BACKSET(VAR75,VAR65+1);

VAR77:=FILTER(VAR76,VAR65) AND LOW=LLV(LOW,VAR65+1);

VAR78:=BARSLAST(VAR77);

VAR79:=IF(VAR77,CURRBARSCOUNT,0);

VAR80:=IF(VAR78,REF(VAR79,VAR78),VAR79);

VAR81:=CONST(VAR80);

VAR82:=REF(VAR80,VAR78+1);

VAR83:=CONST(VAR82);

VAR84:=BACKSET(ISLASTBAR,SUMBARS(VOL,CAPITAL));

VAR85:=VAR84>REF(VAR84,1);

NOTEXT1上:DRAWLINE(CURRBARSCOUNT=VAR42,HIGH,CURRBARSCOUNT=VAR40,HIGH,1),COLORGRAY;

NOTEXT1下:DRAWLINE(CURRBARSCOUNT=VAR51,LOW,CURRBARSCOUNT=VAR49,LOW,1),COLORGRAY;

NOTEXT1:IF(VAR31,VAR27,DRAWNULL),POINTDOT,COLORLIGRAY;

NOTEXT2:IF(VAR29,VAR21,DRAWNULL),POINTDOT,COLORLIGRAY;

NOTEXT3:IF(VAR32,VAR28,DRAWNULL),POINTDOT,COLORLIGRAY;

NOTEXT4:IF(VAR30,VAR22,DRAWNULL),POINTDOT,COLORLIGRAY;

高压:DRAWLINE(CURRBARSCOUNT=VAR74,HIGH,CURRBARSCOUNT=VAR72,HIGH,1),COLORMAGENTA;

低撑:DRAWLINE(CURRBARSCOUNT=VAR83,LOW,CURRBARSCOUNT=VAR81,LOW,1),COLORMAGENTA;

短压:DRAWLINE(VAR55,HIGH,VAR57,HIGH,1),COLORYELLOW;

短撑:DRAWLINE(VAR61,LOW,VAR63,LOW,1),COLORYELLOW;

VAR86:=MA(MA(CLOSE,3),1);

轨道:MA(MA(CLOSE,3),3),COLOR32CD32,LINETHICK2;

NOTEXT_升:IF(VAR86>=轨道,轨道,DRAWNULL),COLORMAGENTA,LINETHICK2;

涨家数:INDEXADV,NODRAW,COLORRED;

跌家数:INDEXDEC,NODRAW,COLORCYAN;

流通市值:FINANCE(40)/100000000,NODRAW,COLORRED;

流通亿股:FINANCE(7)/100000000,NODRAW,COLOR0080FF;

日成交亿:AMOUNT/100000000,NODRAW,COLORMAGENTA;

净买额:(DYNAINFO(23)-DYNAINFO(22))*CLOSE/1000000,NODRAW,COLORRED;

买卖比:DYNAINFO(23)/DYNAINFO(22),NODRAW,COLORWHITE;

VAR87:=IF(PERIOD=16,0.03,IF(PERIOD=15,0.03,IF(PERIOD=14,0.006,IF(PERIOD=11,0.02,IF(PERIOD=10,0.02,IF(PERIOD=9,0.02,IF(PERIOD=8,0.002,IF(PERIOD=7,0.05,IF(PERIOD=6,0.03,IF(PERIOD=5,0.018,IF(PERIOD=4,0.005,IF(PERIOD=3,0.004,IF(PERIOD=2,0.003,IF(PERIOD=1,0.0015,IF(PERIOD=0,0.0012,0)))))))))))))));

VAR88:=MA(CLOSE,5);

VAR89:=MA(CLOSE,10);

VAR90:=REF(HIGH,5)=HHV(HIGH,11);

VAR91:=REF(LOW,5)=LLV(LOW,11);

VAR92:=BACKSET(VAR90,6)>BACKSET(VAR90,5);

VAR93:=BACKSET(VAR91,6)>BACKSET(VAR91,5);

VAR94:=IF(BARSLAST(VAR92)=BARSLAST(VAR93) AND VAR88>VAR89,VAR92,IF(BARSLAST(VAR93)>BARSLAST(VAR92),VAR92,0));

VAR95:=IF(BARSLAST(VAR92)=BARSLAST(VAR93) AND VAR89>VAR88,VAR93,IF(BARSLAST(VAR92)>BARSLAST(VAR93),VAR93,0));

VAR96:=VAR94 AND HIGH=HHV(HIGH,BARSLAST(VAR95));

VAR97:=VAR95 AND LOW=LLV(LOW,BARSLAST(VAR94));

VAR98:=IF(VAR96,HIGH,DRAWNULL);

VAR99:=IF(VAR97,LOW,DRAWNULL);

VAR100:=LOW>REF(HIGH,1) AND DAY!=REF(DAY,1);

VAR101:=HIGH<REF(LOW,1) AND DAY!=REF(DAY,1);

VAR102:=REF(LOW,BARSLAST(VAR100));

VAR103:=REF(HIGH,BARSLAST(VAR101));

VAR104:=REF(HIGH,BARSLAST(VAR96));

VAR105:=REF(LOW,BARSLAST(VAR96));

VAR106:=REF(HIGH,BARSLAST(VAR96)+1);

VAR107:=REF(LOW,BARSLAST(VAR96)+1);

VAR108:=REF(HIGH,BARSLAST(VAR96)+2);

VAR109:=REF(LOW,BARSLAST(VAR96)+2);

VAR110:=REF(HIGH,BARSLAST(VAR97));

VAR111:=REF(LOW,BARSLAST(VAR97));

VAR112:=REF(HIGH,BARSLAST(VAR97)+1);

VAR113:=REF(LOW,BARSLAST(VAR97)+1);

VAR114:=REF(HIGH,BARSLAST(VAR97)+2);

VAR115:=REF(LOW,BARSLAST(VAR97)+2);

VAR116:=IF(VAR105<=VAR107,VAR108,VAR106);

VAR117:=IF(VAR106<VAR105,VAR105,IF(VAR105<=VAR107,VAR109,VAR107));

VAR118:=IF(VAR113>VAR110,VAR110,IF(VAR110>=VAR112,VAR114,VAR112));

VAR119:=IF(VAR110>=VAR112,VAR115,VAR113);

VAR120:=VAR104>VAR118 AND VAR96;

VAR121:=VAR111<VAR117 AND VAR97;

VAR122:=VAR120 AND VAR104>VAR110 AND VAR105>VAR111 AND VAR107>VAR111;

VAR123:=VAR121 AND VAR111<VAR105 AND VAR110<VAR104 AND VAR112<VAR104;

VAR124:=HIGH<=REF(HIGH,1) AND LOW>=REF(LOW,1) OR (HIGH>=REF(HIGH,1) AND LOW<=REF(LOW,1));

VAR125:=COUNT(VAR124,BARSLAST(VAR97));

VAR126:=COUNT(VAR124,BARSLAST(VAR96));

VAR127:=COUNT(VAR100,BARSLAST(VAR97));

VAR128:=COUNT(VAR101,BARSLAST(VAR96));

VAR129:=IF(VAR125>0,VAR125+2,IF(VAR126,VAR126+2,3));

VAR130:=IF(VAR127,VAR129-VAR127,IF(VAR128,VAR129-VAR128,VAR129));

VAR131:=VAR122 AND BARSLAST(VAR123)>VAR130;

VAR132:=VAR123 AND BARSLAST(VAR122)>VAR130;

VAR133:=VAR96 AND REF(HIGH,BARSLAST(VAR96))>=REF(HIGH,BARSLAST(VAR131)) AND BARSLAST(VAR132)>BARSLAST(VAR131) OR (VAR120 AND COUNT(VAR100,BARSLAST(VAR121))>0 AND REF(HIGH,BARSLAST(VAR120))>REF(HIGH,BARSLAST(VAR131)));

VAR134:=VAR97 AND REF(LOW,BARSLAST(VAR97))<=REF(LOW,BARSLAST(VAR132)) AND BARSLAST(VAR131)>BARSLAST(VAR132) OR (VAR121 AND COUNT(VAR101,BARSLAST(VAR120))>0 AND REF(LOW,BARSLAST(VAR121))<REF(HIGH,BARSLAST(VAR132)));

VAR135:=IF(BARSLAST(VAR134)>BARSLAST(VAR133),REF(HIGH,BARSLAST(VAR133)),REF(HIGH,BARSLAST(VAR134)));

VAR136:=IF(BARSLAST(VAR133)>BARSLAST(VAR134),REF(LOW,BARSLAST(VAR134)),REF(LOW,BARSLAST(VAR133)));

VAR137:=VAR133 AND HIGH=HHV(VAR135,BARSLAST(VAR134)+1) AND HIGH>REF(HIGH,1) AND BARSLAST(VAR134)>BARSLAST(VAR133);

VAR138:=VAR55 AND LOW=LLV(VAR136,BARSLAST(VAR133)+1) AND LOW<REF(LOW,1) AND BARSLAST(VAR133)>BARSLAST(VAR134);

VAR139:=VAR137 OR (VAR96 AND REF(HIGH,BARSLAST(VAR96))>REF(HIGH,BARSLAST(VAR137)) AND BARSLAST(VAR138)>BARSLAST(VAR137));

VAR140:=VAR138 OR (VAR97 AND REF(LOW,BARSLAST(VAR97))<REF(LOW,BARSLAST(VAR138)) AND BARSLAST(VAR137)>BARSLAST(VAR138));

NOTEXT高点:IF(VAR131,HIGH,DRAWNULL),POINTDOT,COLORGREEN,LINETHICK4;

NOTEXT低点:IF(VAR132,LOW,DRAWNULL),POINTDOT,COLORYELLOW,LINETHICK4;

NOTEXT上:DRAWLINE(VAR132,LOW,VAR131,HIGH,0),COLORGRAY;

NOTEXT下:DRAWLINE(VAR131,HIGH,VAR132,LOW,0),COLOR888888;

VAR141:=BARSLAST(VAR131);

VAR142:=BARSLAST(VAR132);

DRAWNUMBER(VAR132,LOW,VAR141),COLORYELLOW;

DRAWNUMBER(VAR131,HIGH+HIGH*VAR87,VAR142),COLORGREEN;

DRAWNUMBER(ISLASTBAR,IF(BARSLAST(VAR131)>BARSLAST(VAR132),LOW,HIGH+HIGH*VAR87),MIN(VAR141,VAR142)),COLORMAGENTA;


    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约