Calculate the distance between two parallel lines including ! - page 5

 
Itum:


Do I understand correctly that the delta is the blue line ... And the size of the red line is not there?

https://c.mql5.com/3/181/lineee__2.jpg

Delta is the distance between two lines in pips.

We can set this distance in the code, but it is searched considering that we don't know it - it is searched based on the delta "b" of the first and second functions.

 
 // ЗАДАЕМ ДВЕ ТОЧКИ ПРИВЯЗКИ ДЛЯ ГЛАВНОЙ ЛИНИИ: ТОЧКА1(ВРЕМЯ,ЦЕНА) и ТОЧКА2(ВРЕМЯ,ЦЕНА)
   // ЭТА ЛИНИИ ГЛАВНАЯ
   datetime Line1_Врем0=Time[0], Line1_Врем1=Time[10];
   double Line1_Цена0=High[10], Line1_Цена1=Low[10];

   ObjectCreate("Line1",OBJ_TRENDBYANGLE,0,Line1_Врем0,Line1_Цена0,Line1_Врем1,Line1_Цена1);
   ObjectSetInteger(0,"Line1",OBJPROP_STYLE,STYLE_SOLID);
   ObjectSetInteger(0,"Line1",OBJPROP_COLOR,Red);
   ObjectSetInteger(0,"Line1",OBJPROP_WIDTH,2);

   // СТРОИМ ПАРАЛЛЕЛЬНУЮ ЛИНИЮ ТОЛЬКО ПО ОДНОЙ ТОЧКЕ-ПРИВЯЗКЕ
   ObjectCreate("Line2",OBJ_TRENDBYANGLE,0,Time[15],Low[15],0,0);
   ObjectSetInteger(0,"Line2",OBJPROP_STYLE,STYLE_SOLID);
   ObjectSetInteger(0,"Line2",OBJPROP_COLOR,Lime);
   ObjectSetInteger(0,"Line2",OBJPROP_WIDTH,2);

  // ПРИСВАИВАЕМ ЛИНИИ Line2 ТАКОЙ ЖЕ САМЫЙ УГОЛ КАК В ЛИНИИ Line1 ЧТО БЫ ЛИНИИ БЫЛИ ПАРАЛЛЕЛЬНЫЕ 
   ObjectSetDouble(0,"Line2",OBJPROP_ANGLE,ObjectGetDouble(0,"Line1",OBJPROP_ANGLE)); 

   // РИСУЕМ ПЕРПЕНДИКУЛЯРНУЮ ЛИНИЮ К Line1 и Line2
   ObjectCreate("Value",OBJ_TRENDBYANGLE,0,Time[0],Low[15],0,0);
   ObjectSetInteger(0,"Value",OBJPROP_RAY,false);
   ObjectSetInteger(0,"Value",OBJPROP_COLOR,Gold);
   ObjectSetInteger(0,"Value",OBJPROP_WIDTH,3);
   ObjectSetDouble(0,"Value",OBJPROP_ANGLE,90+ObjectGetDouble(0,"Line1",OBJPROP_ANGLE));

   // ЗАДАЧА: ПОЛУЧИТЬ РАЗМЕР ЖЕЛТОЙ ЛИНИИ МЕЖДУ Line1 и Line2. ОПТИМАЛЬНЫМ И УНИВЕРСАЛЬНЫМ ПАРАМЕТРОМ РАЗМЕРА НАВЕРНОЕ БУДУТ - ПИКСЕЛИ.
 
Itum:

You should check your code - shit is being drawn.

Forget the corners - it's a dead issue. Corners should be plotted by pixels and MT plots by price.
 
Itum:

Oh, I just noticed that, too.

why do you need the lines on the corner?

 
Aleksey Vyazmikin:

You should check your code - shit is being drawn.

Forget the corners - it's a dead issue. Corners should be drawn by pixels and MT draws by price.


Why crap ? Why dead?


Renat Akhtyamov:

Oh, I just noticed that too.

why do you need to draw lines by angle?


How do you know the size of the hatched line ?
 
Itum:

Why is it crap? Why dead?



How do you know the size of the dashed line ?

There's a formula for that in the pictures.

 
Itum:

Why is it crap? Why dead?



How do you find out the size of the dashed line ?

Will you always have them built on a corner?

If so, simply find the cathetus in the triangle using the formula

 

The disproportionality of the scales along the axes in the visible part of the overall picture results in a deformed picture.

But these are perpendiculars constructed according to strict formulas. Although visually it seems that they are not.


...............................................................


...............................................................

 

to understand what we are talking about:


..................................................................


..................................................................

 
Renat Akhtyamov:

Will you always have them built on a corner?

If so, simply use the formula to find the cathetus in the triangle

Yes

Oleg avtomat:

There's a formula for that in the pictures.

unfortunately I'm not a mathematician (