N:=5;
P:=2;
MID : MA(CLOSE,N),colorwhite;
UPPER: MID + P*STD(CLOSE,N),coloryellow,linethick2;
LOWER: MID - P*STD(CLOSE,N),colorFF00FF,linethick2;
MID1: MA(CLOSE,26),color006699,linethick2;
stickline(MID1>ref(MID1,1),MID1+0.02,MID1-0.02,10,0),colorred;
UPPER1: MID1 + P*STD(CLOSE,26),colorgreen;
LOWER1: MID1 - P*STD(CLOSE,26),colorblue;
高:MA(REF(HIGH,1)/REF(CLOSE,2),27)*REF(CLOSE,1),colorred ,LINETHICK1;
低:MA(REF(LOW,1)/REF(CLOSE,2),27)*REF(CLOSE,1),LINETHICK2;
预测值:MA(REF(HIGH,1)/REF(CLOSE,2),N)*REF(CLOSE,1),COLORbrown,LINETHICK1;
RSV:=(CLOSE-LLV(LOW,5))/(HHV(HIGH,5)-LLV(LOW,5))*100;
K0:=SMA(RSV,3,1);
K:=K0;D:=SMA(K,2,1);
j1:=(3*k-2*d);
j2:=MA(j1,2);
买:=filter((count(低<LOWER1,5)>=1) and (LOWER < LOWER1) and cross(低,LOWER1) or count(low<lower1,5)>=1 and cross("kdj.k","kdj.d") and C>O,5);
卖:=filter((count(高>UPPER1,5)>=1) and (UPPER > UPPER1) and cross(UPPER1,高) or count(high>UPPER1,5)>=1 and cross("kdj.d","kdj.k") and O<C,5);
{卖:=UPPER > UPPER1 and 高>UPPER1 and 预测值<ref(预测值,1) and ref(预测值,1)>ref(预测值,2); }
drawicon(买 ,LOWER*0.98,1);
drawicon(卖,UPPER*1.02,2);
drawicon((低<LOWER or low<LOWER ) and "macd.diff">"macd.dea" and MID>ref(MID,1) and cross(j1,j2)
or ((低<LOWER or low<LOWER) and c>o and cross(j1,j2) or cross(低,LOWER ) and j1>j2 and ma(v,10)>ref(ma(v,10),1)
and c>1.05*ref(c,1)) and MID>ref(MID,1) ,LOWER-0.2,4);
drawicon("macd.macd"<ref("macd.macd",1) and ((cross(j2,j1) or(j1<j2)) and ((预测值>UPPER or high>UPPER ))
or cross(UPPER,(高 or 预测值)) and j1<j2),UPPER+0.2,5),colorblue;