identify a doji bar? how?

 

Hi fellows, especially fellow programmers.... I was wondering the ways of how the bot can identify a doji price bar, where the open and close price of a bar close relatively the same. I'm not programming this myself but I'd like inputs on how to do it MQL4's language wise.. I mean its easy and basic to code if (Open[1]==Close[1]) that would also be a doji bar, unfortunately it doesn't always close at the same exact price, so I need help of other ways to make this more complex, say the close closes 2 pips away from the open, that's still a valid doji.... Any help appreciated thanks.


Regards,

mank

 
mank wrote >>

Hi fellows, especially fellow programmers.... I was wondering the ways of how the bot can identify a doji price bar, where the open and close price of a bar close relatively the same. I'm not programming this myself but I'd like inputs on how to do it MQL4's language wise.. I mean its easy and basic to code if (Open[1]==Close[1]) that would also be a doji bar, unfortunately it doesn't always close at the same exact price, so I need help of other ways to make this more complex, say the close closes 2 pips away from the open, that's still a valid doji.... Any help appreciated thanks.

Regards,

mank

try this if(double MathAbs(open[1]-close[1]) <=2*Point).........doji = true.

You could also use a percentage of say close[1] as in 0.01*close[1]; instead of the fixed value of 2 pips, that would give you a sliding value for all time frames.

likely need to determine value of percentage to use empirically.

cheers

Keith

 
kminler:

try this if(double MathAbs(open[1]-close[1]) <=2*Point).........doji = true.

You could also use a percentage of say close[1] as in 0.01*close[1]; instead of the fixed value of 2 pips, that would give you a sliding value for all time frames.

likely need to determine value of percentage to use empirically.

cheers

Keith

Many thanks Keith!