test of trendlines

 
How can I write an EA that loops through all the open charts and sends an alert if the price has violated any of the trendlines drawn on the chart. I could write an EA and attach it to a single chart and that'd work. However I want one EA to loop through all the open charts so I can avoid attaching an EA to each of the currency pairs.
 

How can I write an EA that loops through all the open charts

... short answer is no.

However I want one EA to loop through all the open charts so I can avoid attaching an EA to each of the currency pairs.
... why?

 

You can do it this way... but it's ugly.

1. Draw the line on the windows you want.

2. Make a script that saves the parameters of the lines in a text file, (you have to run it on each window) that has in its name a symbol and a timeframe (like EURUSDH1.txt)

3. Make the final ea that, in its init() a list of the pairs and timeframes, testing for existent files:

    EURUSDM1.txt, EURUSDM5.txt ... GBPJPYM1.txt ... and so on, loading the lines parameters, then checks, in start(), for each of them, if the price of the pair is away not farther than N pips from the present point on trendline.

 

Phy..if I am trading multiple systems, attaching an EA for a system to each and every pair will mean I have to open numerous charts and it personally I am not able to manage 50-60 open charts at one time.


TheEconomist..Thanks for your suggestion. I had to write a script that writes the TL values from a chart onto a file. Then I had to write an indicator that copies the TL values from the file and paints on the chart and also identifies if the trendline was violated one or two bars ago.. Then I wrote an EA which calls each chart and executes iCustom to calculate if the Trendline was violated on the chart.


Thinking about your method, how can I draw objects from an EA on the GBPUSD chart if the EA is attached to the EURUSD chart?

Reason: