同花顺CPX操盘线公式
源码
IF(PERIODNAME<>"日线")
{
统计:"该指标只在日线周期下有效。";
RETURN;
}
//1.抄底-------------抄底
//大单净量
r:=((ZDMR[-1]+BDMR[-1])-(ZDMC[-1]+BDMC[-1]))/SHGZG*100;
//相对强弱
LC := REF(CLOSE,1);//前一日收盘价;
RSI$1:=SMA(MAX(CLOSE-LC,0),3,1)/SMA(ABS(CLOSE-LC),3,1)*100;
RSI$2:=SMA(MAX(CLOSE-LC,0),5,1)/SMA(ABS(CLOSE-LC),5,1)*100;
RSI$3:=SMA(MAX(CLOSE-LC,0),8,1)/SMA(ABS(CLOSE-LC),8,1)*100;
相对强弱:=0.5*RSI$1+0.31*RSI$2+0.19*RSI$3;
wave$1:=SMA(100*(CLOSE-LLV(LOW,8))/(HHV(HIGH,8)-LLV(LOW,8)),3,1);
wave$2:=SMA(100*(CLOSE-LLV(LOW,8))/(HHV(HIGH,8)-LLV(LOW,8)),5,1);
wave$3:=SMA(100*(CLOSE-LLV(LOW,8))/(HHV(HIGH,8)-LLV(LOW,8)),8,1);
短线波段:=0.5*wave$1+0.31*wave$2+0.19*wave$3;
机会区:=20,POINTDOT,colorred;
风险区:=80,POINTDOT,colorgreen;
操盘系数:0.5*相对强弱+0.5*短线波段,colorwhite,LINETHICK3;
//抄底条件;
CD1:=IF(操盘系数<20 AND CLOSE>OPEN AND r>0,1,0);//波段小于20,股价翻红;
CD2:=IF(操盘系数<20 AND LOW>=REF(LOW,1) AND CLOSE>LOW AND r>0,1,0);//波段小于20,股价未翻红,但未创新低;
CD3:=IF(REF(操盘系数,1)<20 AND 操盘系数>REF(操盘系数,1),1,0);//前一日波段小于20,今日转向;
SIGNALCD=(CD1=1 OR CD2=1 OR CD3=1);
X=(SIGNALCD AND COUNT(SIGNALCD,3)=1);
DRAWTEXT(X,机会区,"底");
//2.操作线---------------------操作线
VAR1:=LLV(LOW,13);
VAR2:=HHV(HIGH,13);
VAR3:=SMA((CLOSE-VAR1)/(VAR2-VAR1)*100,5,1);
VAR4:=SMA((VAR2-CLOSE)/(VAR2-VAR1)*100,5,1);
主:VAR3,colorblue,LINETHICK2;
散:VAR4,colorcyan;
//VAR5:=SMA(MAX(CLOSE-REF(CLOSE,1),0),5,1)/SMA(ABS(CLOSE-REF(CLOSE,1)),5,1)*100;
//操作:EMA(VAR5,3),coloryellow,LINETHICK3;
//STICKLINE(C,90,90,1,0),COLOR3C3CFF;
//STICKLINE(C,50,50,1,0),coloryellow;
//STICKLINE(C,10,10,1,0),colorcyan;
底:10,POINTDOT,colorcyan;
中:50,POINTDOT,coloryellow;
顶:90,POINTDOT,COLOR3C3CFF;
//操盘买卖条件;
操盘TJ1:=主>REF(主,1) AND 散<REF(散,1) AND 操盘系数>=REF(操盘系数,1); //多
操盘TJ2:=主<REF(主,1) AND 散>REF(散,1) AND 操盘系数<REF(操盘系数,1); //空
操盘TJ3:=主<REF(主,1) OR 散>REF(散,1) OR 操盘系数<REF(操盘系数,1); //震荡减仓
//3.多空
r0:=((IF(ISNULL(ZDMR[-1]),0,ZDMR)+IF(ISNULL(BDMR[-1]),0,BDMR))-(IF(ISNULL(ZDMC[-1]),0,ZDMC)+IF(ISNULL(BDMC[-1]),0,BDMC)))/SHGZG*100;
MA5:=MA(r0,5);
中位线:=1.75;
最小值:=LLV(LOW,10);
最大值:=HHV(HIGH,25);
波动线:=EMA((CLOSE-最小值)/(最大值-最小值)*4,4);
平均线:=EMA(波动线,3);
//个股多空晴雨表
K多:=平均线>=REF(平均线,1);
K空:=平均线<REF(平均线,1);
PARTLINE(-10,K多,colorred,K空,colorgreen),LINETHICK3;
//PARTLINE(95,K多,colorred,K空,colorgreen),LINETHICK3;
FILLRGN(20,80,K多 AND 操盘TJ1,RGB(155,50,50),K空 OR 操盘TJ2,RGB(0,50,50));//,(K多 AND 操盘TJ2) OR (K空 AND 操盘TJ1),RGB(50,0,50)
//3. 主动攻击 公式网www.gszb.com
主力动能:=MA(r0,5);
主力攻击:=r0-(ABS(REF(r0,1))+ABS(REF(r0,2))+ABS(REF(r0,3))+ABS(REF(r0,4))+ABS(REF(r0,5))/2)>0 AND 平均线>=REF(平均线,1) AND REF(平均线,1)<REF(平均线,2);
主力撤退:=-((r0+(ABS(REF(r0,1))+ABS(REF(r0,2))+ABS(REF(r0,3))+ABS(REF(r0,4))+ABS(REF(r0,5))/2)<0) AND 平均线<=REF(平均线,1) AND REF(平均线,1)>REF(平均线,2));
DRAWTEXT(主力攻击>0,5," 主力攻击"),colorred;
DRAWTEXT(主力撤退<0,5," 主力撤退"),colorgreen;
STICKLINE(主力攻击>0,-10,0,1,0),colorred,LINETHICK3;
STICKLINE(主力撤退<0,-10,0,1,0),colorgreen,LINETHICK3;
......
请点击附件下载公式