Download MetaTrader 5

Candlestick Patterns

To add comments, please log in or register
agu2a
79
agu2a  

I've been playing with some code to create a custom indicator on MT4 that shows candlestick patterns but I'm not sure it is working properly... here is the logic

      if(doji==true && iOpen(NULL,0,i)==iClose(NULL,0,i)){   // Doji
        IND[i]=iHigh(NULL,0,i)+(200*Point);
       }
      if(harami==true && iOpen(NULL,0,i+1)>iClose(NULL,0,i+1)   // Harami
         && iOpen(NULL,0,i)<iClose(NULL,0,i)
         && iHigh(NULL,0,i)<iOpen(NULL,0,i+1)
         && iLow(NULL,0,i)>iClose(NULL,0,i+1)
       ){  
            IND[i]=iHigh(NULL,0,i)+(200*Point);
       }
       if(harami==true && iOpen(NULL,0,i+1)<iClose(NULL,0,i+1)   // Harami
         && iOpen(NULL,0,i)>iClose(NULL,0,i)
         && iHigh(NULL,0,i)<iClose(NULL,0,i+1)
         && iLow(NULL,0,i)>iOpen(NULL,0,i+1)
       ){  
            IND[i]=iHigh(NULL,0,i)+(200*Point);
       }
       if(dragonfly==true && iOpen(NULL,0,i)==iClose(NULL,0,i)     // Dragonfly
         && iOpen(NULL,0,i)==iHigh(NULL,0,i)
       ){  
        IND[i]=iHigh(NULL,0,i)+(200*Point);
       }
       if(gravestone==true && iOpen(NULL,0,i)==iClose(NULL,0,i)     // Gravestone
         && iOpen(NULL,0,i)==iLow(NULL,0,i)
       ){  
        IND[i]=iHigh(NULL,0,i)+(200*Point);
       }
       if(hammer==true && iOpen(NULL,0,i)==iHigh(NULL,0,i)   // Hammer
         && iOpen(NULL,0,i)>iClose(NULL,0,i)
         && (iClose(NULL,0,i)-iLow(NULL,0,i))>(iOpen(NULL,0,i)-iClose(NULL,0,i))
       ){  
            IND[i]=iHigh(NULL,0,i)+(200*Point);
       }


 Please share your ideas, comments and thoughts whether or not this would work properly...

whroeder1
16058
whroeder1  
agu2a:
if(doji==true && iOpen(NULL,0,i)==iClose(NULL,0,i)){   // Doji
The == operand. - MQL4 forum
To add comments, please log in or register