Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

TrendLinearReg - MetaTrader 5 Script - MetaTrader 5 Script

author EAcpu | 5 reads | 0 comments |

TrendLinearReg - indicator for MetaTrader 5 - indicator for MetaTrader 5

TrendLinearReg - indicator for MetaTrader 5 - indicator for MetaTrader 5

(Converted from https://www.mql5.com/en/code/7883)

How are trends changing? How to determine the real estate? How to trade? ...etc. This indicator will help answer these questions.

If you assume that the trend within N bars is a straight line, you can calculate the parameters of this line. You know the equation of a straight line from school, it is y = bx + с. The slope of a line is characterized by the "b" coefficient, or the tangent of the slope angle. The indicator uses linear regression on each bar to calculate this parameter and displays it in a separate window. If the color is green, it means that the value is larger than the previous value, that is, the tilt angle increases, and red means the opposite.

TrendLinearReg - indicator for MetaTrader 5 - indicator for MetaTrader 5

In fact, the "b" coefficient in the chart consists of two coefficients: the tangent of the line angle and the coefficient characterizing the currency pair (probably a point), so the scale of the indicator differs on different currency pairs.

How to use indicators? I think there are several variations:

1. Cross the zero line.

2. Maximum value channel.

3. If you identify an area near the zero line, then it is a flat area and you can trade on the breakout.

If anyone has ideas on how to improve this indicator or how to use it, I'd be grateful.


Attachment download

📎 trendlinearreg.mq5 (3.23 KB)

Source: MQL5 #41943

Verification code Refresh