Detect when price "cross" a line
Posted: Tue Jan 12, 2010 11:40 am
Hi All,
I was wondering if there would be any function in MQL4 to simply detect when price cross a line (a certain given price). When we trade manually it's visual and simple, price cross the line, we act.
But when coding the only solution I found is to use a set of conditions like that:
Bid > line - x AND price < Bid + x
(line being the price at which we want to trigger something)
- Do any of you know a better way to do this? How do you do?
- If this is the best way to do it, how would you optimize the x?
I was wondering if there would be any function in MQL4 to simply detect when price cross a line (a certain given price). When we trade manually it's visual and simple, price cross the line, we act.
But when coding the only solution I found is to use a set of conditions like that:
Bid > line - x AND price < Bid + x
(line being the price at which we want to trigger something)
- Do any of you know a better way to do this? How do you do?
- If this is the best way to do it, how would you optimize the x?