horizontal line

 
Hi, this should be an easy question for most of you but i just couldn't figure it out. I draw a horizontal line let say its name is "Horizontal Line 1234". I want to use EA to detect when the price cross that line. So i put something like


if (Ask >= ObjectGetValueByShift("Horizontal Line 1234",0))
alert("price come close to line")

But it doesn't work. However this method works for trendline. So what am I doing wrong. What is the object name for horizontal line?

Someone please help. Thank you

Trav
 
The function "MQL4: ObjectGetValueByShift" is for trendlines only.

The function calculates and returns the price value for the specified bar (shift related to the current bar). The price value is calculated by the first and second coordinates using a linear equation. Applied to trendlines and similar objects. To get the detailed error information, one has to call the "MQL4: GetLastError" function.


Use such expression instead:
if (Ask >= ObjectGet("Horizontal Line 1234",OBJPROP_PRICE1))
Alert("price come close to line");
Reason: