N:=45;
M:=15;
MTRD:=SUM(MAX(MAX(HIGH-LOW,ABS(HIGH-REF(CLOSE,1))),ABS(REF(CLOSE,1)-LOW)),N);
HD :=HIGH-REF(HIGH,1);
LD :=REF(LOW,1)-LOW;
DMP:=SUM(IF(HD 0 AND HD LD,HD,0),N);
DMM:=SUM(IF(LD 0 AND LD HD,LD,0),N);
PDI:=DMP*100/MTRD;
MDI:=DMM*100/MTRD;
U:=BARSLAST(CROSS(MDI,30));
D:=BARSLAST(CROSS(PDI,30));
涨:IF(U D,0.2,DRAWNULL),COLORRED,LINETHICK3;
跌:IF(D U,-0.2,DRAWNULL),COLORGREEN,LINETHICK3;
MTR:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
SS1:=2/5;{S理论调节波长参数}
CQ1:=SS1*SS1/(50-EMA(MTR,2));
A:=EMA(C,1/CQ1);{调节参数波段长度有变化}
S理论 :SIN(A),COLORGRAY,DOTLINE;
区间波长:(S理论 -REF(S理论 ,1)),COLORBROWN;
AA:=S理论 -REF(S理论 ,1);
AAA:=AA 0.1 AND AA -0.1;
一级频率:BARSLAST(AAA),COLORBROWN,NODRAW;{窄频区}
AB:=S理论 -REF(S理论 ,1);{宽频区}
AAB:=S理论 0.2 AND S理论 -0.2;
二级频率:BARSLAST(AAB),COLORYELLOW,NODRAW;
STICKLINE(一级频率 0 AND 涨=0.2,1,1.2,1,0),COLORLIRED;
STICKLINE(二级频率 0 AND 二级频率 20 AND 涨=0.2,1.3,1.4,1,0),COLORRED;
STICKLINE(一级频率 0 AND 跌=-0.2,-1,-1.2,1,0),COLORLIBLUE;
STICKLINE(二级频率 0 AND 二级频率 20 AND 跌=-0.2,-1.3,-1.4,1,0),COLORGREEN;
STICKLINE(二级频率 20,0.1,-0.1,1,0),COLORBLUE;
0.2,COLORGRAY,DOTLINE;
-0.2,COLORGRAY,DOTLINE;
涨段:=(一级频率 0 AND 涨=0.2) OR (二级频率 0 AND 二级频率 20 AND 涨=0.2);
跌段:=(一级频率 0 AND 跌=-0.2) OR (二级频率 0 AND 二级频率 20 AND 跌=-0.2);
阴线开多:IF(S理论 0.2 AND S理论 REF(S理论 ,1) AND 涨段=1,S理论 ,DRAWNULL),COLORRED,LINETHICK1;
阳线平多:IF( S理论 REF(S理论 ,1) AND 涨段=1,S理论 ,DRAWNULL),COLORLIBLUE,LINETHICK1;
阳线开空:IF(S理论 -0.2 AND S理论 REF(S理论 ,1) AND 跌段=1,S理论 ,DRAWNULL),COLORGREEN,LINETHICK1;
阴线平空:IF( S理论 REF(S理论 ,1) AND 跌段=1,S理论 ,DRAWNULL),COLORLIRED,LINETHICK1;
DRAWICON(阴线开多 AND C REF(C,1),阴线开多,1);{-1就是设置控制跌幅}
DRAWICON(阳线开空 AND C REF(C,1),阳线开空,2);{-1就是设置控制跌幅}
{(C/MA(C,5)-1)*1000;};