写出笑脸和哭脸的选股
更多金钻指标股票技术讨论QQ群:966329692 技术讨论QQ群:220302856 技术讨论QQ群:39652085 如群满可换一个

编写要求:

N:=2;SHORT:=12*N;LONG:=29*N;M:=9*N;DIFF : EMA(CLOSE,SHORT) - EMA(CLOSE,LONG);DEA : EMA(DIFF,M);MACD : 2*(DIFF-DEA), COLORSTICK;0,dotline,colorwhite;{以下处理底背离}N1:=last(MACD<0);{绿柱天数}N2:=REF(last(MACD>0),N1);{绿柱前红柱天数}N3:=REF(last(MACD<0),N2+N1);{红柱前绿柱天数}MINMD1:=LLV(MACD,N1);MINMD3:=REF(LLV(MACD,N3+N2),N1);MINDIFF1:=LLV(DIFF,N1);MINDIFF3:=REF(LLV(DIFF,N2+N3),N1);MINDEA1:=LLV(DEA,N1);MINDEA3:=REF(LLV(DEA,N2+N3),N1);股价L1:=LLV(L,N1);股价L3:=REF(LLV(L,N2+N3),N1);股价LL:=LLV(L,N1+N2+N3);绿柱缩短:=MACD<0 AND MACD>REF(MACD,1) AND REF(MACD,1)MINMD3;DIFF底背离:=DIFF<0 AND MINDIFF1>MINDIFF3;DEA底背离:=DEA<0 AND MINDEA1>MINDEA3;股价新低:=股价L1=股价LL and 股价L1/股价L3<0.9;底背离:绿柱缩短 AND MACD底背离 AND DIFF底背离 AND DEA底背离 AND 股价新低,COLORRED,PRECIS0,LINETHICK0;VERTLINE(底背离 ,1 ),colorred;DRAWICON(底背离,MACD*0.97,1,1),ALIGN1;{以下处理顶背离}M1:=last(MACD>0);{ 红柱天数}M2:=REF(last(MACD<0),M1); {红柱前绿柱天数}M3:=REF(last(MACD>0),M2+M1); {绿柱前红柱天数}MAXMD1:=HHV(MACD,M1);MAXMD3:=REF(HHV(MACD,M3+M2),M1);MAXDIFF1:=HHV(DIFF,M1);MAXDIFF3:=REF(HHV(DIFF,M2+M3),M1);MAXDEA1:=HHV(DEA,M1);MAXDEA3:=REF(HHV(DEA,M2+M3),M1);股价H1:=HHV(H,M1);股价HH:=HHV(H,M1+M2+M3);红柱缩短:=MACD>0 AND MACDREF(MACD,2);MACD顶背离:=MACD>0 AND MAXMD10 AND MAXDIFF10 AND MAXDEA1

解答:

 N:=2;

SHORT:=12*N;
LONG:=29*N;
M:=9*N;
DIFF := EMA(CLOSE,SHORT) - EMA(CLOSE,LONG);
DEA  := EMA(DIFF,M);
MACD := 2*(DIFF-DEA);
 
{以下处理底背离}
N1:=last(MACD<0);{绿柱天数}
N2:=REF(last(MACD>0),N1);{绿柱前红柱天数}
N3:=REF(last(MACD<0),N2+N1);{红柱前绿柱天数}
MINMD1:=LLV(MACD,N1);
MINMD3:=REF(LLV(MACD,N3+N2),N1);
MINDIFF1:=LLV(DIFF,N1);
MINDIFF3:=REF(LLV(DIFF,N2+N3),N1);
MINDEA1:=LLV(DEA,N1);
MINDEA3:=REF(LLV(DEA,N2+N3),N1);
股价L1:=LLV(L,N1);
股价L3:=REF(LLV(L,N2+N3),N1);
股价LL:=LLV(L,N1+N2+N3);
绿柱缩短:=MACD<0 AND MACD>REF(MACD,1) AND REF(MACD,1)<REF(MACD,2);
MACD底背离:=MACD<0 AND MINMD1>MINMD3;
DIFF底背离:=DIFF<0 AND MINDIFF1>MINDIFF3;
DEA底背离:=DEA<0 AND MINDEA1>MINDEA3;
股价新低:=股价L1=股价LL  and 股价L1/股价L3<0.9;
笑脸:绿柱缩短 AND  MACD底背离 AND DIFF底背离 AND DEA底背离 AND 股价新低;
 
 
{以下处理顶背离}
M1:=last(MACD>0);{ 红柱天数}
M2:=REF(last(MACD<0),M1); {红柱前绿柱天数}
M3:=REF(last(MACD>0),M2+M1); {绿柱前红柱天数}
MAXMD1:=HHV(MACD,M1);
MAXMD3:=REF(HHV(MACD,M3+M2),M1);
MAXDIFF1:=HHV(DIFF,M1);
MAXDIFF3:=REF(HHV(DIFF,M2+M3),M1);
MAXDEA1:=HHV(DEA,M1);
MAXDEA3:=REF(HHV(DEA,M2+M3),M1);
股价H1:=HHV(H,M1);
股价HH:=HHV(H,M1+M2+M3);
红柱缩短:=MACD>0 AND MACD<REF(MACD,1) AND REF(MACD,1)>REF(MACD,2);
MACD顶背离:=MACD>0 AND MAXMD1<MAXMD3;
DIFF顶背离:=DIFF>0 AND MAXDIFF1<MAXDIFF3;
DEA顶背离:=DEA>0 AND MAXDEA1<MAXDEA3;
股价新高:=股价H1=股价HH;
哭脸:红柱缩短 AND  MACD顶背离 AND 股价新高;

选股票看什么指标最好 >股票指标网