ma线上线下K线变色
两个均线一个20 一个60当K线站上60日均线的时候 K 线和均线 变成红色当K线 下破20日均线的时候 K 线和均线 变成绿色
MA20:MA(C,20);MA60:MA(C,60);DRAWCOLORKLINE(C>MA60,COLORRED,0);IF(C>MA60,MA60,NULL),COLORRED,NOTEXT;DRAWCOLORKLINE(C<MA20,COLORGREEN,0);IF(C<MA20,MA20,NULL),COLORGREEN,NOTEXT;//收盘价在均线上下,K线和指标线变色。
DIFF := EMA(CLOSE,12) - EMA(CLOSE,26);DEA := EMA(DIFF,9);MACD:=2*(DIFF-DEA);MA1H:=REF(H,1)*29+REF(H,2)*28+REF(H,3)*27+REF(H,4)*26+REF(H,5)*25+REF(H,6)*24+REF(H,7)*23+REF(H,8)*22+REF(H,9)*21+REF(H,10)*20;MA2H:=REF(H,11)*19+REF(H,12)*18+REF(H,13)*17+REF(H,14)*16+REF(H,15)*15+REF(H,16)*14+REF(H,17)*13+REF(H,18)*12+REF(H,19)*11+REF(H,20)*10;MA3H:=REF(H,21)*9+REF(H,22)*8+REF(H,23)*7+REF(H,24)*6+REF(H,25)*5+REF(H,26)*4+REF(H,27)*3+REF(H,28)*2+REF(H,29)*1;MAH:=(MA1H+MA2H+MA3H)/435;SJTJ:=1;MA1L:=REF(L,1)*29+REF(L,2)*28+REF(L,3)*27+REF(L,4)*26+REF(L,5)*25+REF(L,6)*24+REF(L,7)*23+REF(L,8)*22+REF(L,9)*21+REF(L,10)*20;MA2L:=REF(L,11)*19+REF(L,12)*18+REF(L,13)*17+REF(L,14)*16+REF(L,15)*15+REF(L,16)*14+REF(L,17)*13+REF(L,18)*12+REF(L,19)*11+REF(L,20)*10;MA3L:=REF(L,21)*9+REF(L,22)*8+REF(L,23)*7+REF(L,24)*6+REF(L,25)*5+REF(L,26)*4+REF(L,27)*3+REF(L,28)*2+REF(L,29)*1;MAL:=(MA1L+MA2L+MA3L)/435;MA5:=MA(CLOSE,5);MA10:=MA(CLOSE,10);MA20:=MA(CLOSE,20);MA60:=MA(CLOSE,60);MA26:=REF(MA(CLOSE,26),1);MALX:=MIN(MIN(MA20,MA26),MIN(MA10,MAL));MAHD:=MAX(MAX(MA20,MA26),MAX(MAH,MA10));KK16:=MA5<MA10 AND C<MA20 AND C<MA26 AND (C<MA26 OR MACD<0 OR C<MA60) AND EVERY(MACD<REF(MACD,1), 3) AND MA5<MA20 ;DD11:=C>MA5 AND C>MA10 AND C>MA20 AND C>MA26 AND MACD>0 AND MA5>MA20 AND MA10>REF(MA10,1) AND MA5>MA10;DK:=SJTJ AND (C>MAHD OR DD11);KK:=SJTJ AND (C<MALX OR KK16) ;DK1:=BARSLAST(DK);KK1:=BARSLAST(KK);DK2:=BARSLAST(CROSS(KK1,DK1));KK2:=BARSLAST(CROSS(DK1,KK1));HS:=DK2<KK2;LS:=KK2<DK2;MZD:=(MAH+MAL)/2 ;HJFG1:=(MAH-MAL) ;HJFG:=HJFG1*0.66 ;HT8:=IF(HS,MALX,MAHD);开多:IF(HS,MIN(MAL+HJFG,HT8*1.009),NULL),LINETHICK2,COLORMAGENTA;多单止损:IF(HS,HT8,NULL),LINETHICK2,COLORYELLOW;开空:IF(LS,MAX(MAH-HJFG,HT8*0.99),NULL),LINETHICK2,COLORGREEN;空单止损:IF(LS,HT8,NULL),LINETHICK2,COLORYELLOW;DRAWNUMBER1(ISLASTBAR,C,C,0),COLORMAGENTA;DRAWTEXT(HS=1 AND REF(LS,1) ,MIN(HT8,L),'开多 '),COLORYELLOW;DRAWTEXT(LS=1 AND REF(HS,1) ,MAX(HT8,H),'开空 '),COLORYELLOW;AA:=EMA(C,5) > EMA(C,20);BB:=EMA(C,5) < EMA(C,20);CC:= EMA(C,5) > EMA(C,10);CC1:=EMA(C,5) < EMA(C,10);DD:=CLOSE<OPEN;STICKLINE1(AA AND SJTJ,H,L,0,0),COLORRED;STICKLINE(AA AND SJTJ,O,C,3,1),COLORRED;STICKLINE(AA AND SJTJ AND DD,O,C,3,0),COLORRED;STICKLINE1(BB AND SJTJ,H,L,0,0),COLORGREEN;STICKLINE(BB AND SJTJ,O,C,3,1),COLORGREEN;STICKLINE(BB AND SJTJ AND DD,O,C,3,0),COLORGREEN;STICKLINE1(BB AND SJTJ AND CC,H,L,0,1),COLORWHITE;STICKLINE(BB AND SJTJ AND CC,O,C,3,1),COLORWHITE;STICKLINE(BB AND SJTJ AND CC AND DD,O,C,3,0),COLORWHITE;STICKLINE1(AA AND SJTJ AND CC1,H,L,0,0),COLORWHITE;STICKLINE(AA AND SJTJ AND CC1,O,C,3,1),COLORWHITE;STICKLINE(AA AND SJTJ AND CC1 AND DD,O,C,3,0),COLORWHITE;