[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 75

 
Elenn: As far as I understand, the straight line option will also "involve" all the points, not three of them.
Then I don't understand anything at all. Which three, why do you have to choose them during the solution? Do you understand the problem well yourself?
 
artmedia70:

Not really. What if the order is not selected? Where is the price normalization when sending a trade order?

Orders are closed in a loop, and that means that the search should be done not from zero, but from OrdersTotal()-1 to >=0


Would you describe the normalization in more detail?

 
Mathemat:
Then I don't understand anything at all. Which three, why should they be chosen? Do you yourself understand the task well?


There are two variants in the picture, each of them has 5 points. In variant "A" the sum of distances from three points is minimal, in variant "B" the sum of distances from 5 points is minimal. You should find the "three" points where the sum of distances from them to the line is minimal among all other variants.

 

The solution on the left is wrong. The correct one is rather like this (green line):

And once again: you want to solve the problem for circles, not for straight lines. This is a different problem, much more complicated.

 
Mathemat:

The solution on the left is wrong. The correct one is rather like this (green line):


Well, yes, the correct solution is the green line. As for the circle, both there and in the case of the line, the problem of choosing those very three "best" points is the same. The question is how to do it more elegantly.
 
Elenn: As for the circle, both there and in the case of a straight line, the problem of choosing these three "best" points is the same. The question is how to do it more elegantly.

Not only that, how can you not understand. You have to choose which distances to take. This kills any possible finesse at the root.

For each chosen 3 points, you will have to count 8 sums of the three distances (or distances squared).

 
Mathemat:

Not only that, how can you not understand. You have to choose which distances to take. This kills all possible finesse.

For every 3 points you choose, you have to count 8 sums of the three distances (or distances squared).


Maybe I don't understand something, can you tell me the difference between the shortest path from a point to a line and the shortest path from a point to a circle?
 
Elenn:

Maybe I don't understand something, explain me, what is the difference between the shortest path from a point to a line and the shortest path from a point to a circle?
Lena, your formulation of the problem has an excess of degrees of freedom (choosing 3 points out of 8 plus the radius of the circle plus the coordinates of its centre), so I'm afraid there may be more than one solution, if not an infinite number. Clarification of the conditions is required.
 

You can always draw a single perpendicular to a line. This will indicate the distance from the point to the line.

There are almost always two "distances" to a circle from a given point:


From point A to the circle in this case they are AB and AC. And which one to choose as the "correct" one is not obvious.

 
Myth63:


what about normalisation?

MT4 can easily give you Ask=1.456121212 instead of 1.4561 (or some of your values, obtained as a result of calculations),
but it (it only plays a role when working with orders) is not able to "understand" what it has done.
To fix it, use the function (example for Ask):

NormalizeDouble(Ask, Digits)

So, all values that are put into the order functions should be normalized before sending them to the server.