K线背后的秘密----主图叠加大盘介绍
K线背后的秘密----主图叠加大盘
把下面代码加到你的主图代码前面,可同时显示大盘的K线(为不影响原K线,用了较暗的色彩,不满意的话可自己调整)。(见下图)
{主图叠加大盘;}
周期:=120;
盘1:=CONST(LLV(INDEXL,周期)); 盘差:=CONST(HHV(INDEXH,周期))-盘1;
价1:=CONST(LLV(L,周期)); 价差:=CONST(HHV(H,周期))-价1;
价盘比:= 价差/盘差;
{大盘: 价1+(INDEXC-盘1)*价盘比,COLORAA0077;}
CX:=价1+(INDEXC-盘1)*价盘比;
HX:=价1+(INDEXH-盘1)*价盘比;
LX:=价1+(INDEXL-盘1)*价盘比;
OX:=价1+(INDEXO-盘1)*价盘比;
STICKLINE(OX<=CX,HX,LX,0,0),COLOR660066;
STICKLINE(OX<=CX,OX,CX,1,1),COLOR660066;
STICKLINE(OX>=CX,HX,LX,0,0),COLOR8A0000;
STICKLINE(OX>=CX,OX,CX,1,1),COLOR8A0000;
{重绘K线}
DRAWKLINE(HIGH,OPEN,LOW,CLOSE);
{以上代码加到你主图代码的前面}
{以下是你的主图原码}
{比如:布林线信号}
H_L:=价差;
BOLL:MA(C,20),COLORGREEN;
UPPER:BOLL+2*STD(C,20),COLORMAGENTA;
LOWER:BOLL-2*STD(C,20),COLORMAGENTA;
DRAWICON(CROSS(C,LOWER),L-H_L*0.1,7);{买信号B}
DRAWICON(CROSS(UPPER,C),H+H_L*0.1,8);{卖信号S};
gd16979