how to loop and declare zones; And How do i also detect lines that are too close to each other
"nearest line to it" What is it? Until you can state what you want, it can not be coded.
"detect lines that are too close" To close to what?
"nearest line to it" What is it? Until you can state what you want, it can not be coded.
"detect lines that are too close" To close to what?
I am talking about nearest lines to each other, meaning if a HLine is near each other by 100pip then declare as a zone for both lines.
By "detecting lines that are to close", meaning that i want to be able to see what Hline are near each other so i can add the lines position up and divide it by how much lines are near each other.
For example the second picture has a lot of Hline that are all near each other i want to detect when there is a group of lines that are too close to each other so i can remove them and plot a line that was the average of the lines that was crowded.
Does any one know how i can loop around all object that are hLine find the nearest line to it and declare it a zone . Like this example first picture below:
And On the second picture shows how would i detect lines that are too close to each other like this example:
Purpose being so i can average out all the lines and plot a line on average position.
You need to include the graphical objects library and declare an array of type CChartObjectHLine and a second array of a structure containing the values necessary for the construction of all the lines in the array of graphical objects.
#include <ChartObjects/ChartObjectsLines.mqh> CChartObjectHLine HLine[]; struct HLineStruct { long chart_id; string name; long window; double price; }; HLineStruct HS[];
You can add array fields with ArrayResize. Then first calculate the data you and store them in the structures. Secondly create the object with data from the corresponding structure and the field index it should belong to. Like so:
h_line[i].Create(HS[i].chart_id, HS[i].name, HS[i].window, HS[i].price); //here you use the values from the corresponding structure directly.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Does any one know how i can loop around all object that are hLine find the nearest line to it and declare it a zone . Like this example first picture below:
And On the second picture shows how would i detect lines that are too close to each other like this example:
Purpose being so i can average out all the lines and plot a line on average position.