Recognize a line in chart

Back to topics list To post a new topic, please log in or register
avatar
19
eddieTrader 2015.05.08 07:57
 

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.

avatar
Moderator
3404
GumRai 2015.05.08 08:32 #
 

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 

avatar
735
honest_knave 2015.05.08 23:13 #
 

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. 

 

avatar
21
CristianoKonrad 2015.05.12 21:23 #
 
.
avatar
19
eddieTrader 2015.05.15 13:31 #
 
Thanks guys for the help!
Back to topics list  

To add comments, please log in or register