Recognize a line in chart

 

Hi,

This question might sound basic...

What can I do in my EA if I would like to be able to recognize a line in my chart.

I mean, the idea would be to draw (by hand) a line in a chart in MT4, then the EA shold trigger an alert when, for example, the price touches this line.

Not really sure if that can be achieved.

Thanks.

 

You could code the EA to search for a particular named object

Then you could draw a line and rename it so that the EA will find it and act accordingly 

 

Yep, that's pretty much the way I do it (I get the EA to create the line for me either automatically or on button push, but no real difference).

Have a double variable that stores the price of said line.

Run code in OnChartEvent() to see if the line has moved, and update accordingly.

Run code in OnTick() to check where price is relative to the stored value. 

 
.
 
Thanks guys for the help!
Reason: