IF(PERIODNAME<>"日线")
{
统计:"该指标只在日线周期下有效。";
RETURN;
}
//大单净量
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*短线波段,coloryellow;
//买入条件;
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,今日转向;
SIGNALBUY=(CD1=1 OR CD2=1 OR CD3=1);
X=(SIGNALBUY AND COUNT(SIGNALBUY,3)=1);
DRAWICON(X,机会区,"buy");