|
EMA_PERIODS:=13;
EMA_VALUE:=EMA(CLOSE,EMA_PERIODS);
EMA_VALUE_LAST:=EMA(REFWH(CLOSE,1),EMA_PERIODS);
//MACD参数
MACD_LENGTH_FAST:=12;
MACD_LENGTH_SLOW:=26;
MACD_LENGTH_SIGNAL:=9;
// 计算 MACD 相关指标
MACD_MA_FAST:= EMA(CLOSE, MACD_LENGTH_FAST);
MACD_MA_SLOW:= EMA(CLOSE, MACD_LENGTH_SLOW);
MACD:= MACD_MA_FAST - MACD_MA_SLOW;
MACD_SIGNAL:= EMA(MACD, MACD_LENGTH_SIGNAL);
MACD_HISTOGRAM:= MACD - MACD_SIGNAL;
MACD_MA_FAST_LAST:= EMA(REFWH(CLOSE,1), MACD_LENGTH_FAST);
MACD_MA_SLOW_LAST:= EMA(REFWH(CLOSE,1), MACD_LENGTH_SLOW);
MACD_LAST:= MACD_MA_FAST_LAST - MACD_MA_SLOW_LAST;
MACD_SIGNAL_LAST:= EMA(MACD_LAST, MACD_LENGTH_SIGNAL);
MACD_HISTOGRAM_LAST:= MACD_LAST - MACD_SIGNAL_LAST;
// 计算埃尔德动力指标 IMPULSE SYSTEM
ELDER_BULLS:= ((EMA_VALUE > EMA_VALUE_LAST) AND (MACD_HISTOGRAM> MACD_HISTOGRAM_LAST));
ELDER_BEARS:= ((EMA_VALUE < EMA_VALUE_LAST) AND (MACD_HISTOGRAM<MACD_HISTOGRAM_LAST));
//ELDER_COLOR:=IF(ELDER_BULLS,COLORGREEN,IF(ELDER_BEARS,COLORRED,COLORBLUE));
DRAWCOLORKLINE(ELDER_BULLS AND ISDOWN,COLORRED,0);
DRAWCOLORKLINE(ELDER_BULLS AND ISDOWN=0,COLORRED,1);
DRAWCOLORKLINE(ELDER_BEARS AND ISDOWN,COLORGREEN,0);
DRAWCOLORKLINE(ELDER_BEARS AND ISDOWN=0,COLORGREEN,1);
DRAWCOLORKLINE(NOT(ELDER_BULLS OR ELDER_BEARS) AND ISDOWN,COLORWHITE,0);
DRAWCOLORKLINE(NOT(ELDER_BULLS OR ELDER_BEARS) AND ISDOWN=0,COLORWHITE,1);
|
|