MQL4 CandleStick Pattern

Milan Zivanovic
208

Can anyone help me with the correct formula for detecting Three White Soldiers and Three Black Crows?

I've tried several different patterns and I can't detect them every time.


Three White Soldiers:

iClose(NULL,0,1)>iClose(NULL,0,2) && iClose(NULL,0,2)>iClose(NULL,0,3) && 
iClose(NULL,0,1)>iOpen(NULL,0,1) && iClose(NULL,0,2)>iOpen(NULL,0,2) && iClose(NULL,0,3)>iOpen(NULL,0,3) &&
MathAbs(iClose(NULL,0,3)-iOpen(NULL,0,3))>(iHigh(NULL,0,3)-iLow(NULL,0,3))*0.50 && MathAbs(iClose(NULL,0,2)-iOpen(NULL,0,2))>(iHigh(NULL,0,2)-iLow(NULL,0,2))*0.50 && 
(iHigh(NULL,0,1)-iLow(NULL,0,1))>(iHigh(NULL,0,2)-iLow(NULL,0,2)) && 
iOpen(NULL,0,1)>iOpen(NULL,0,2) && iOpen(NULL,0,1)<iClose(NULL,0,2) && 
iOpen(NULL,0,2)>iOpen(NULL,0,3) && iOpen(NULL,0,2)<iClose(NULL,0,3) && 
iOpen(NULL,0,3)>iOpen(NULL,0,4) && iOpen(NULL,0,3)<iClose(NULL,0,4) && 
iClose(NULL,0,1)>iHigh(NULL,0,1)*0.85 && iClose(NULL,0,2)>iHigh(NULL,0,2)*0.85 && 
iClose(NULL,0,3)>iHigh(NULL,0,3)*0.85


Three Black Crows:

iOpen(NULL,0,2)<iOpen(NULL,0,3) && iOpen(NULL,0,2)>iClose(NULL,0,3) && 
iOpen(NULL,0,1)<iOpen(NULL,0,2) && iOpen(NULL,0,1)>iClose(NULL,0,2) && 
iClose(NULL,0,2)<iLow(NULL,0,3) && iClose(NULL,0,1)<iLow(NULL,0,2) && 
iClose(NULL,0,3)<iLow(NULL,0,3)*1.05 && iClose(NULL,0,2)<iLow(NULL,0,2)*1.05 && 
iClose(NULL,0,1)<iLow(NULL,0,1)*1.05