简单提示: A、尽量选择MACD红柱共振的品种进行操作; B、注意K线所处的位置高低(可考虑增加黄金分割线、时间窗之类等等);
{月金叉红柱}
JC:="macd.MACD#MONTH"<0;
TS:=BARSLAST(JC),NODRAW;
起点:=FILTERX(TS=1,BARSSINCE(C));
终点:=FILTERX(TS>=1 AND REFX(TS,1)=0,BARSSINCE(C));
天数:=BARSLAST(起点);
红柱最高价:IF(天数>=0 AND REFX(TS>=1,BARSNEXT(ISLASTBAR)),CONST(HHV(H,TS)),DRAWNULL),COLORYELLOW;
红柱最低价:IF(天数>=0 AND REFX(TS>=1,BARSNEXT(ISLASTBAR)),CONST(LLV(L,TS)),DRAWNULL),COLORYELLOW;
STICKLINE(起点,红柱最高价,红柱最低价,0,-1),COLORYELLOW;
STICKLINE(ISLASTBAR,红柱最高价,红柱最低价,0,-1),COLORYELLOW;
{月死叉绿柱}
SC:="MACD.MACD#MONTH">0;
TS1:=BARSLAST(SC),NODRAW;
起点1:=FILTERX(TS1=1,BARSSINCE(C));
终点1:=FILTERX(TS1>=1 AND REFX(TS1,1)=0,BARSSINCE(C));
天数1:=BARSLAST(起点1);
绿柱最高价:IF(天数1>=0 AND REFX(TS1>=1,BARSNEXT(ISLASTBAR)),CONST(HHV(H,TS1)),DRAWNULL),COLORLIBLUE;
绿柱最低价:IF(天数1>=0 AND REFX(TS1>=1,BARSNEXT(ISLASTBAR)),CONST(LLV(L,TS1)),DRAWNULL),COLORLIBLUE;
STICKLINE(起点1,绿柱最高价,绿柱最低价,0,-1),COLORLIBLUE;
STICKLINE(ISLASTBAR,绿柱最高价,绿柱最低价,0,-1),COLORLIBLUE;
{周金叉红柱}
ZJC:="MACD.MACD#WEEK"<0;
ZTS:=BARSLAST(ZJC),NODRAW;
Z起点:=FILTERX(ZTS=1,BARSSINCE(C));
Z终点:=FILTERX(ZTS>=1 AND REFX(ZTS,1)=0,BARSSINCE(C));
Z天数:=BARSLAST(Z起点);
Z红柱最高价:IF(Z天数>=0 AND REFX(ZTS>=1,BARSNEXT(ISLASTBAR)),CONST(HHV(H,ZTS)),DRAWNULL),COLORMAGENTA;
Z红柱最低价:IF(Z天数>=0 AND REFX(ZTS>=1,BARSNEXT(ISLASTBAR)),CONST(LLV(L,ZTS)),DRAWNULL),COLORMAGENTA;
STICKLINE(Z起点,Z红柱最高价,Z红柱最低价,0,-1),COLORMAGENTA;
STICKLINE(ISLASTBAR,Z红柱最高价,Z红柱最低价,0,-1),COLORMAGENTA;
{周死叉绿柱}
ZSC:="MACD.MACD#WEEK">0;
ZTS1:=BARSLAST(ZSC),NODRAW;
Z起点1:=FILTERX(ZTS1=1,BARSSINCE(C));
Z终点1:=FILTERX(ZTS1>=1 AND REFX(ZTS1,1)=0,BARSSINCE(C));
Z天数1:=BARSLAST(Z起点1);
Z绿柱最高价:IF(Z天数1>=0 AND REFX(ZTS1>=1,BARSNEXT(ISLASTBAR)),CONST(HHV(H,ZTS1)),DRAWNULL),COLORGREEN;
Z绿柱最低价:IF(Z天数1>=0 AND REFX(ZTS1>=1,BARSNEXT(ISLASTBAR)),CONST(LLV(L,ZTS1)),DRAWNULL),COLORGREEN;
STICKLINE(Z起点1,Z绿柱最高价,Z绿柱最低价,0,-1),COLORGREEN;
STICKLINE(ISLASTBAR,Z绿柱最高价,Z绿柱最低价,0,-1),COLORGREEN;
{日金叉红柱}
RJC:="MACD.MACD#DAY"<0;
RTS:=BARSLAST(RJC),NODRAW;
R起点:=FILTERX(RTS=1,BARSSINCE(C));
R终点:=FILTERX(RTS>=1 AND REFX(RTS,1)=0,BARSSINCE(C));
R天数:=BARSLAST(R起点);
R红柱最高价:IF(R天数>=0 AND REFX(RTS>=1,BARSNEXT(ISLASTBAR)),CONST(HHV(H,RTS)),DRAWNULL),COLORlired;
R红柱最低价:IF(R天数>=0 AND REFX(RTS>=1,BARSNEXT(ISLASTBAR)),CONST(LLV(L,RTS)),DRAWNULL),COLORlired;
STICKLINE(R起点,R红柱最高价,R红柱最低价,0,-1),COLORlired;
STICKLINE(ISLASTBAR,R红柱最高价,R红柱最低价,0,-1),COLORlired;
{日死叉绿柱}
RSC:="MACD.MACD#DAY">0;
RTS1:=BARSLAST(RSC),NODRAW;
R起点1:=FILTERX(RTS1=1,BARSSINCE(C));
R终点1:=FILTERX(RTS1>=1 AND REFX(RTS1,1)=0,BARSSINCE(C));
R天数1:=BARSLAST(R起点1);
R绿柱最高价:IF(R天数1>=0 AND REFX(RTS1>=1,BARSNEXT(ISLASTBAR)),CONST(HHV(H,RTS1)),DRAWNULL),COLORgray;
R绿柱最低价:IF(R天数1>=0 AND REFX(RTS1>=1,BARSNEXT(ISLASTBAR)),CONST(LLV(L,RTS1)),DRAWNULL),COLORgray;
STICKLINE(R起点1,R绿柱最高价,R绿柱最低价,0,-1),COLORgray;
STICKLINE(ISLASTBAR,R绿柱最高价,R绿柱最低价,0,-1),COLORgray;
DRAWKLINE(H,O,L,C);