You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
any way you like.
As you can see, there's nothing complicated about it. You just have to think about it a bit.
With such a detailed answer, I think TC will be able to write the code by himself.
Many people here have already forgotten school problems because they couldn't grasp their meaning at school.
The output is:
Next, through ObjectGetValueByShift("Line1",a++) and ObjectGetValueByShift("Value",a++) and ObjectGetValueByShift("Line2",a++) search for the intersection
Am I reading it right?In order to solve the problem you have to:
1. draw a perpendicular to the given parallel lines
2. determine the points of intersection of the perpendicular with the given lines
3. calculate the distance between the intersection points
Clearly in pictures:
(different lines and distances between them)
.............................................................................
.............................................................................
.............................................................................
.............................................................................
Not convincing.
Not convincing.
Open your textbooks and be convinced
Yes
Unfortunately I am not a mathematician (blue angle = 90 - line angle
convert angle to radians
red opposing cathetus = green hypotenuse * sine (blue angle)
We have already found the hypotenuse in this thread by crossing both lines vertically
If the angle of the line is 90 or 0, then consider the distance differently, that is, by crossing parallel lines horizontally or vertically.
How about Googling it?
blue angle = 90 - line angle
Convert angle to radians
red opposing cathetus = green hypotenuse * sine (blue angle)
We have already found the hypotenuse in this thread by crossing both lines vertically
If the angle of the line is 90 or 0, then count the distance in another way, that is, by crossing parallel lines horizontally or vertically.
Hmmm...
For some reason it doesn't work
It seems simple ... but it doesn't get the result you want
Yes, everything is simple, except that your task is not solvable.... ))
First of all, forget about theObjectGetDouble(0,"Line1",OBJPROP_ANGLE) function. It will always return 0, since it cannot be applied to a trend line. It is needed, in particular, for the "angle" trend line, which does not depend on the chart scale BUT it also does not depend on bar prices. That is, its angle will not change when changing the scale, but the line itself will move away from bars...
But that's not the biggest problem... The whole point is that you want to find the size of the perpendicular between 2 parallel trend lines, try to draw such a perpendicular on the chart... And then change the scale of the graph... the perpendicular becomes non-perpendicular... )))) So the problem is exactly what you consider a perpendicular (dependence on scale and how YOU see it) and a mathematical perpendicular.
The perpendicular on a price scaled chart is an optical illusion.
Using geometry this problem in its pure form is solved in one go... BUT the mathematical result of the calculation will never coincide with the one seen on the chart... And you need exactly the match, so the problem is unsolvable. Just simplify your requirements, do not look for a perpendicular, but just the distance between 2 lines at the same time point...
I have no words.
I know all the letters, but I can't read the word
Come on, come on, don't give up, study MQL, it's just a matter of time