//+------------------------------------------------------------------+ //| CandleShape.mqh | //| Ada.Jass | //| jass.ada@qq.com | //+------------------------------------------------------------------+ #ifndef __CANDLE_SHAPE_ #define __CANDLE_SHAPE_ #include "PublicStuff.mqh" #property copyright "Ada.Jass" #property link "jass.ada@qq.com" #property strict double iBody(int shift) { return ((iClose(NULL,0,shift)-iOpen(NULL,0,shift))/Point); } double iShadow(int shift) { return (iHigh(NULL,0,shift)-iLow(NULL,0,shift))/Point-MathAbs(iBody(shift)); } bool IsDoji(int shift) { double body=MathAbs(iBody(shift)); double shadow=iShadow(shift); if(body<=CANDLE_STANDARD*0.02&&shadow>=CANDLE_STANDARD*0.7) return true; else return false; } bool IsMarubozu(int shift) { double body=MathAbs(iBody(shift)); double shadow=iShadow(shift); if(body>CANDLE_STANDARD*0.6&&shadow
0?(iHigh(NULL,0,shift)-iClose(NULL,0,shift)/Point):(iOpen(NULL,0,shift)-iLow(NULL,0,shift)/Point); double downShadow=body<0?(iHigh(NULL,0,shift)-iOpen(NULL,0,shift)/Point):(iClose(NULL,0,shift)-iLow(NULL,0,shift)/Point); body=MathAbs(body); if(body+upShadow+downShadow>CANDLE_STANDARD&&body>=CANDLE_STANDARD*0.02&&((upShadow>(body+downShadow)*2)||(downShadow>(body+upShadow)*2))) { return true; }else { return false; } } bool IsBullishEngulfing(int shift) { double preBody=iBody(shift+1); //double preShadow=iShadow(shift+1); double body=iBody(shift); double shadow=iShadow(shift); if(body>0&&body>shadow*2&&body>CANDLE_STANDARD*0.5&&preBody<0&&body+preBody>Point) { return true; }else{ return false; } } bool IsBearishEngulfing(int shift) { double preBody=-iBody(shift+1); //double preShadow=iShadow(shift+1); double body=-iBody(shift); double shadow=iShadow(shift); if(body>0&&body>shadow*2&&body>CANDLE_STANDARD*0.5&&preBody<0&&body+preBody>Point) { return true; }else{ return false; } } bool IsTweezerBottom(int shift) //must occur in downtrend { double body0=iBody(shift); double downShadow0=body0<0?(iHigh(NULL,0,shift)-iOpen(NULL,0,shift)/Point):(iClose(NULL,0,shift)-iLow(NULL,0,shift)/Point); double body1=iBody(shift+1); double downShadow1=body1<0?(iHigh(NULL,0,shift+1)-iOpen(NULL,0,shift+1)/Point):(iClose(NULL,0,shift+1)-iLow(NULL,0,shift+1)/Point); if((iOpen(NULL,0,shift+4)-iClose(NULL,0,shift))/Point>CANDLE_STANDARD*3&&downShadow0>MathAbs(body0*1.5)&& downShadow1>MathAbs(body1*1.5)&&MathAbs(iLow(NULL,0,shift)-iLow(NULL,0,shift+1))/Point<3) { return true; }else{ return false; } } bool IsTweezerTop(int shift) //must occur in uptrend { double body0=iBody(shift); double upShadow0=body0>0?(iHigh(NULL,0,shift)-iClose(NULL,0,shift)/Point):(iOpen(NULL,0,shift)-iLow(NULL,0,shift)/Point); double body1=iBody(shift+1); double upShadow1=body1>0?(iHigh(NULL,0,shift+1)-iClose(NULL,0,shift+1)/Point):(iOpen(NULL,0,shift+1)-iLow(NULL,0,shift+1)/Point); if((iOpen(NULL,0,shift)-iClose(NULL,0,shift+4))/Point>CANDLE_STANDARD*3&&upShadow0>MathAbs(body0*1.5)&& upShadow1>MathAbs(body1*1.5)&&MathAbs(iHigh(NULL,0,shift)-iHigh(NULL,0,shift+1))/Point<3) { return true; }else{ return false; } } bool IsMorningStar(int shift) { double body2=iBody(shift+2); double body1=iBody(shift+1); double body0=iBody(shift); double shadow2=iShadow(shift+2); double shadow0=iShadow(shift); if(body2<-CANDLE_STANDARD*1.5&&MathAbs(body1)