说明
1、这是2013年2月北沙老师的作品
2、如今老师远在哈萨克斯坦工作
3、昨天聊天时老师说:能吃到豆腐、粉条是一种幸福……
4、以此公式祝老师在异国他乡工作顺利、好运相伴;
5、公式主要提示大趋势和背景、可叠加其它主图中;
6、简单提示:
A、尽量选择MACD红柱共振的品种进行操作;
B、注意K线所处的位置高低(可考虑增加黄金分割线、时间窗之类等等);
{北沙月周日框A——无背景色公式}
{月金叉红柱}
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);
__________________________________________________________________________________
__________________________________________________________________________________
{北沙月周日框B——带背景色公式}
{月金叉红柱}
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;
DRAWBAND(红柱最高价,RGB(100,70,50),红柱最低价,RGB(0,100,100));
{月死叉绿柱}
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;
DRAWBAND(绿柱最高价,RGB(0,100,100),绿柱最低价,RGB(120,80,0));
{周金叉红柱}
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;
DRAWBAND(Z红柱最高价,RGB(100,0,100),Z红柱最低价,RGB(50,150,200));
{周死叉绿柱}
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;
DRAWBAND(Z绿柱最高价,RGB(50,150,200),Z绿柱最低价,RGB(100,0,100));
{日金叉红柱}
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),COLORMAGENTA;
R红柱最低价:IF(R天数>=0 AND REFX(RTS>=1,BARSNEXT(ISLASTBAR)),CONST(LLV(L,RTS)),DRAWNULL),COLORMAGENTA;
STICKLINE(R起点,R红柱最高价,R红柱最低价,0,-1),COLORMAGENTA;
STICKLINE(ISLASTBAR,R红柱最高价,R红柱最低价,0,-1),COLORMAGENTA;
DRAWBAND(R红柱最高价,RGB(220,120,120),R红柱最低价,RGB(80,80,80));
{日死叉绿柱}
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),COLORGREEN;
R绿柱最低价:IF(R天数1>=0 AND REFX(RTS1>=1,BARSNEXT(ISLASTBAR)),CONST(LLV(L,RTS1)),DRAWNULL),COLORGREEN;
STICKLINE(R起点1,R绿柱最高价,R绿柱最低价,0,-1),COLORGREEN;
STICKLINE(ISLASTBAR,R绿柱最高价,R绿柱最低价,0,-1),COLORGREEN;
DRAWBAND(R绿柱最高价,RGB(80,80,80),R绿柱最低价,RGB(220,120,120));
{股海网 www.guhai.com.cn}
DRAWKLINE(H,O,L,C);