{主图分TD准备和TD13倒数两部分}
{TD准备}
A:=REF(C,1)>REF(C,4);
AB:=C<REF(C,4);
AA:=A AND AB;
LS0:=BARSLAST(AA);
LS11:=IF(1,LS0=1,AA);
LS21:=IF(1,LLV(C,1)<REF(C,4),1);
A1:=LS11 AND LS21;
LS12:=IF(2,LS0=2,AA);
LS22:=IF(2,LLV(C,2)<REF(C,4),1);
A2:=LS12 AND LS22;
LS13:=IF(3,LS0=3,AA);
LS23:=IF(3,LLV(C,3)<REF(C,4),1);
A3:=LS13 AND LS23;
LS14:=IF(4,LS0=4,AA);
LS24:=IF(4,LLV(C,4)<REF(C,4),1);
A4:=LS14 AND LS24;
LS15:=IF(5,LS0=5,AA);
LS25:=IF(5,LLV(C,5)<REF(C,4),1);
A5:=LS15 AND LS25;
LS16:=IF(6,LS0=6,AA);
LS26:=IF(6,LLV(C,6)<REF(C,4),1);
A6:=LS16 AND LS26;
LS17:=IF(7,LS0=7,AA);
LS27:=IF(7,LLV(C,7)<REF(C,4),1);
A7:=LS17 AND LS27;
LS18:=IF(8,LS0=8,AA);
LS28:=IF(8,LLV(C,8)<REF(C,4),1);
A8:=LS18 AND LS28;
LS19:=IF(9,LS0=9,AA);
LS29:=IF(9,LLV(C,9)<REF(C,4),1);
A9:=LS19 AND LS29;
DRAWTEXT(A1,L-0.3,'1'),COLORGREEN;
DRAWTEXT(A2,L-0.3,'2'),COLORGREEN;
DRAWTEXT(A3,L-0.3,'3'),COLORGREEN;
DRAWTEXT(A4,L-0.3,'4'),COLORGREEN;
DRAWTEXT(A5,L-0.3,'5'),COLORGREEN;
DRAWTEXT(A6,L-0.3,'6'),COLORGREEN;
DRAWTEXT(A7,L-0.3,'7'),COLORGREEN;
DRAWTEXT(A8,L-0.3,'8'),COLORGREEN;
DRAWTEXT(A9,L-0.3,'9'),COLORGREEN;
{TD13次倒数}
B:=C<=REF(L,2);
LSP:=BARSLAST(A9);
LS11A:=IF(1,LSP=1,B);
LS21A:=IF(1,LLV(C,1)<REF(L,2),1);
D1:=LS11A AND LS21A;
LS12A:=IF(2,LSP=2,B);
LS22A:=IF(2,LLV(C,2)<REF(L,2),1);
D2:=LS12A AND LS22A;
LS13A:=IF(3,LSP=3,B);
LS23A:=IF(3,LLV(C,3)<REF(L,2),1);
D3:=LS13A AND LS23A;
LS14A:=IF(4,LSP=4,B);
LS24A:=IF(4,LLV(C,4)<REF(L,2),1);
D4:=LS14A AND LS24A;
LS15A:=IF(5,LSP=5,B);
LS25A:=IF(5,LLV(C,5)<REF(L,2),1);
D5:=LS15A AND LS25A;
LS16A:=IF(6,LSP=6,B);
LS26A:=IF(6,LLV(C,6)<REF(L,2),1);
D6:=LS16A AND LS26A;
LS17A:=IF(7,LSP=7,B);
LS27A:=IF(7,LLV(C,7)<REF(L,2),1);
D7:=LS17A AND LS27A;
LS18A:=IF(8,LSP=8,B);
LS28A:=IF(8,LLV(C,8)<REF(L,2),1);
D8:=LS18A AND LS28A;
LS19A:=IF(9,LSP=9,B);
LS29A:=IF(9,LLV(C,9)<REF(L,2),1);
D9:=LS19A AND LS29A;
LS10A:=IF(10,LSP=10,B);
LS20A:=IF(10,LLV(C,10)<REF(L,2),1);
D10:=LS10A AND LS20A;
LS110A:=IF(11,LSP=11,B);
LS210A:=IF(11,LLV(C,11)<REF(L,2),1);
D11:=LS110A AND LS210A;
LS120A:=IF(12,LSP=12,B);
LS220A:=IF(12,LLV(C,12)<REF(L,2),1);
D12:=LS120A AND LS220A;
LS130A:=IF(13,LSP=13,B);
LS230A:=IF(13,LLV(C,13)<REF(L,2),1);
D13:=LS130A AND LS230A;
DRAWTEXT(D1,L-0.6,'1'),COLORRED;
DRAWTEXT(D2,L-0.6,'2'),COLORRED;
DRAWTEXT(D3,L-0.6,'3'),COLORRED;
DRAWTEXT(D4,L-0.6,'4'),COLORRED;
DRAWTEXT(D5,L-0.6,'5'),COLORRED;
DRAWTEXT(D6,L-0.6,'6'),COLORRED;
DRAWTEXT(D7,L-0.6,'7'),COLORRED;
DRAWTEXT(D8,L-0.6,'8'),COLORRED;
DRAWTEXT(D9,L-0.6,'9'),COLORRED;
DRAWTEXT(D10,L-0.6,'10'),COLORRED;
DRAWTEXT(D11,L-0.6,'11'),COLORRED;
DRAWTEXT(D12,L-0.6,'12'),COLORRED;
DRAWTEXT(D13,L-0.6,'13'),COLORRED;
{卢卡斯螺旋周期,《超级短线新武器》一书有具体的实战案例}
DRAWTEXT(DATACOUNT-BARPOS+1=7,HIGH*1.025,'7'), COLORWHITE;
DRAWTEXT(DATACOUNT-BARPOS+1=11,HIGH*1.025,'11'), COLORWHITE;
DRAWTEXT(DATACOUNT-BARPOS+1=18,HIGH*1.025,'18'), COLORWHITE;
DRAWTEXT(DATACOUNT-BARPOS+1=29,HIGH*1.025,'29'), COLORWHITE;
DRAWTEXT(DATACOUNT-BARPOS+1=47,HIGH*1.025,'47'), COLORWHITE;
DRAWTEXT(DATACOUNT-BARPOS+1=76,HIGH*1.025,'76'), COLORWHITE;
DRAWTEXT(DATACOUNT-BARPOS+1=123,HIGH*1.025,'123'), COLORWHITE;
DRAWTEXT(DATACOUNT-BARPOS+1=199,HIGH*1.025,'199'), COLORWHITE;
DRAWTEXT(DATACOUNT-BARPOS+1=322,HIGH*1.025,'322'), COLORWHITE;
DRAWTEXT(DATACOUNT-BARPOS+1=521,HIGH*1.025,'521'), COLORWHITE;
DRAWTEXT(DATACOUNT-BARPOS+1=843,HIGH*1.025,'843'), COLORWHITE;
DRAWTEXT(DATACOUNT-BARPOS+1=1364,HIGH*1.025,'1364'), COLORWHITE;
DRAWTEXT(DATACOUNT-BARPOS+1=2207,HIGH*1.025,'2207'), COLORWHITE;
DRAWTEXT(DATACOUNT-BARPOS+1=3571,HIGH*1.025,'3571'), COLORWHITE;
//DRAWTEXT_FIX(1,0.01,0.9,0,'绿数字为狄马克TD准备,红为TD13倒数,白为卢卡斯螺旋周期'),COLORBROWN;
半分位:=(O+C)/2;
昨半分位:=REF(半分位,1);
STICKLINE(ISLASTBAR,昨半分位,昨半分位,10,0),COLORWHITE;
DRAWNUMBER(ISLASTBAR,昨半分位,昨半分位,2);
DRAWTEXT(ISLASTBAR,昨半分位,' 昨半分位'),COLORGRAY;
{黄金分割}
NB:=80;
MB:=3;
MA5X:=MA(C,5);
MA13X:=MA(C,13);
高:=REF(HHV(H,NB),MB);
低:=REF(LLV(L,NB),MB);
H19:=高-(高-低)*0.191;
H38:=高-(高-低)*0.382;
H中:=高-(高-低)*0.5;
H61:=高-(高-低)*0.618;
H80:=高-(高-低)*0.809;
一:REFX(高,DATE),POINTDOT,COLORWHITE;
二:REFX(H19,DATE),POINTDOT,COLORYELLOW;
三:REFX(H38,DATE),POINTDOT,COLORMAGENTA;
四:REFX(H中,DATE),POINTDOT,COLORRED;
五:REFX(H61,DATE),POINTDOT,COLORMAGENTA;
六:REFX(H80,DATE),POINTDOT,COLORYELLOW;
七:REFX(低,DATE),POINTDOT,COLORWHITE;
DRAWTEXT(ISLASTBAR,一,' 高'),COLORWHITE;
DRAWTEXT(ISLASTBAR,二,' 809'),COLORYELLOW;
DRAWTEXT(ISLASTBAR,三,' 618'),COLORMAGENTA;
DRAWTEXT(ISLASTBAR,四,' 中'),COLORRED;
DRAWTEXT(ISLASTBAR,五,' 382'),COLORMAGENTA;
DRAWTEXT(ISLASTBAR,六,' 191'),COLORYELLOW;
DRAWTEXT(ISLASTBAR,七,' 低'),COLORWHITE;