Calculation of the slope angle of the trend line. - page 10

 
Dmitry Fedoseev:

You are a scumbag and not just any scumbag, but a nasty one.

Here the moderator suddenly thinks of banning me for such an expression, I suggest you first deal with the situation soberly and calmly.

I'm sorry, the topic has come up!

Thank you very much for your communication.

It was a pleasure to finally dot the I's and cross the T's,

Gone...
 
Renat Akhtyamov:

Really off-topic....

Read the thread.

Your code has nothing to do with any trending

And the scale of the graph should NEVER be taken into account!

OK, I'll delete it if I don't have to, I thought of a better way, but whatever)
 
Daniil Kurmyshev:
OK, I'll delete it if I don't have to, I was thinking of a better way, but whatever)
You're doing fine with matching the theme and the trend line. It's just that someone here is very full of shit. Too bad the moderators don't get it.
 
Dmitry Fedoseev:
You're doing fine with the theme and the trend line. There's just someone very full of shit here.

Dimitri, you're about to burst with anger.

How pathetic.

Did you spare people the right flormula, I don't get it?

Believe me, I didn't need it.

I posted this formula and code a long time ago in the prediction thread, about a year ago

It's just not realistic to find anything there. And here's a good name for it.
 
Dmitry Fedoseev:
It's all good with the correspondence between the topic and the trend line. It's just that someone here is very full of shit.

Ah, well, then I see)) Then I return the code, maybe someone other thanRenat Akhtyamov will need it, by the way I do not sit on forums much)))

//-----------------------------------------------------------------------------------

// xAngle ///////////////////////////////////////////////////////////////////////////

//-----------------------------------------------------------------------------------

double xAngle(double x1,double y1,double x2,double y2) // x1,x2 Time[] - y1,y2 Price

{

if(x1==0 || x2==0 || y1==y2){return(0);}

if(y1==y2) {return(0);}

//---

double PriceMAX=ChartGetDouble(0,CHART_PRICE_MAX,0);

double PriceMIN=ChartGetDouble(0,CHART_PRICE_MIN,0);

double Bar1proc=(double)(ChartGetInteger(0,CHART_WIDTH_IN_BARS,0)*_Period*60)/100;

double Price1proc=((PriceMAX-PriceMIN)/_Point)/100;

x1=iBarShift(NULL,0,(datetime)x1);

x2=iBarShift(NULL,0,(datetime)x2);

double x1x2=MathAbs(x1-x2)*_Period*60;

double y1y2=MathAbs(y1-y2)/_Point;

double x1x2_proc=x1x2/Bar1proc;

double y1y2_proc=y1y2/Price1proc;

//---

double theta=MathArctan(y1y2_proc/x1x2_proc)*(180/3.1415926535);

if(y2<y1){theta=NormalizeDouble(theta*(-1),2);}

return(theta);

}

//+------------------------------------------------------------------+

As for the trend strategy, by the angle you can estimate the strength and approximate term of the trend.

 
Renat Akhtyamov:

Dimitri, you're about to burst with anger.

What a pity.

Did you spare people the right flormula, I don't get it?

Believe me, I didn't need it.

I published this formula and code a long time ago in the forecast branch, about a year ago.

It's just not realistic to find anything there. There's a good name for it.
There's no secret there, if someone needs angle for the code in EA of course no one will be bound to some virtual scale. And if you want to draw dashes on the chart manually and meditate on the scale, then you don't need a formula there either.
 
Sergei75:
Good afternoon. I need to calculate the slope angle of the trend line on the chart in degrees programmatically (MQL5). I would like to know the formula or a method to do it.

The question is about a graph that already exists. What transformations were required to build it is not important. The graph is visible - its main property. We are talking about a graph that is already visible on a given monitor. So, horizontally and vertically it is the same unit of measurement for everyone looking at the screen - the pixel. You need to calculate the arctangent of the ratio of the vertical increment to the horizontal increment (pixel/pixel, a dimensionless value) and convert it to degrees. I don't think there are any questions in this procedure.

And the fact that different monitors have different aspect ratios ( https://ru.wikipedia.org/wiki/%D0%A1%D0%BE%D0%BE%D1%82%D0%BD%D0%BE%D1%88%D0%B5%D0%BD%D0%B8%D0%B5_%D1%81%D1%82%D0%BE%D1%80%D0%BE%D0%BD_%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0), the author, as I understand it, is not interested. On this monitor and that's it.

I suspect, that's not the point of interest. I thought, where can there be any objective characteristic. We're talking about course increments in increments of time. If we take not the astronomical time, but the number of incoming ticks (it is also called the proprietary and operational time); if the company sends to the terminal every change of the rate for its quotation step Point, which most often takes place in the case of 4-digit quotation, then the extremely fast rate increase will look like plus one Point on every tick. By measuring this time by the number of ticks and rate growth by the number of minimal steps of Point, we obtain the limiting angle of the growth line slope +45 degrees, arctg(1/1). Faster means that the company does not have time to send the minimum steps, gaps occur, if they are larger than the spread - price gaps. So, there seems to be some natural characteristic. However, I do not know why it is converted to degrees. The ratio 1/1 itself also fits well in my mind and reminds me of a natural barrier.

 

You can use a Hanne fan and a Hanne line, enter the calculated line data into the fan and form the main Hanne angles.

 

You all speak different languages?

Folks, until you define the terms, you don't agree. And you have different degrees...

 

Hello again friends, I decided to get a little stir on this issue and solve this problem as I think in full, created an indicator that calculates the slope of any object that is on the chart and which has a slope (channels and trend lines), degrees wrote automatically, also modify degrees when you change, the text colour takes the colour of the original line, as well as text applies the slope of the corresponding line or channel for convenience, here I send a test demo version, its complete working capacity

I'm waiting for criticism, if you have any personal questions and needs write to the LS, thank you all.

I would also like to find a person who could do one interesting test on the angle of slope change, in a combination of my indicator + trend line + MA and on different TFs according to a certain pattern, more details in the LJ, who is interested will give an extended version of the indicator for a longer period for free, my offer is valid until 31.01.2017.

Photo report on indicator performance and compliance with terminal values, e.g. the same trend line by slope angle.

Files:
xAngle.ex4  17 kb