- 金币:
-
- 奖励:
-
- 热心:
-
- 注册时间:
- 2007-6-22
|
|
DIFF : EMA(CLOSE,SHORT) - EMA(CLOSE,LONG);
DEA : EMA(DIFF,M);
MACD : 2*(DIFF-DEA);
Zero : 0;
//判断峰底 峰顶
isL:=MACD>REF(MACD,1) AND REF(MACD,1)<REF(MACD,2)AND MACD<0;
isH:=MACD<REF(MACD,1) AND REF(MACD,1)>REF(MACD,2)AND MACD>0;
//获取当前时间与前一峰底的时间间隔
LASTLT:=BARSLAST(isL,1);
//获取前一峰底的值
LASTL:= TOSTRING(REF(MACD,LASTLT+1),5);
//获取当前时间与前一峰顶的时间间隔
LASTHT:=BARSLAST(isH);
//一买
//1.是峰底 2.当前峰比前峰低 3.中间没有红峰(前一红峰出现的时间比前一绿峰出现的时间早)
DRAWTEXT(isL AND REF(MACD,1)>LASTL AND LASTHT>LASTLT,MACD,'1');
LASTLT2:=BARSLAST(isL,2);
LASTHT2:=BARSLAST(isH,1);
//二买
//1.峰底
//2.前边有1买
isFIRST:=LASTL<REF(LASTL,1);
//3.当前峰比前峰低
isSECOND:=REF(MACD,1)>LASTL;
//4.前边双峰之间无红峰
isN:= LASTLT>LASTHT AND LASTLT2>LASTHT OR (LASTLT<LASTHT AND LASTLT2<LASTHT);
//5.(一买二买之间只隔一个红峰)
isONE:=LASTLT<BARSLAST(isH,1)AND LASTLT2<BARSLAST(isH,1);
DRAWTEXT(isL AND isFIRST AND isSECOND AND isN AND isONE ,MACD,'2'); 出现语法错误 |
|
|