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

Extended RegressionStopAndReverse - MetaTrader 4 Script - MT4/MT5 Resources

author EAcpu | 3 reads | 0 comments |

Extended Regression StopAndReverse - indicator for MetaTrader 4

The Extended Regression StopAndReverse indicator is based on some popular and quite useful programs, scripts and experts.

Extended Regression StopAndReverse - indicator for MetaTrader 4

Extended regression stops and reverses

On startup, the indicator automatically determines the time frame, calculates two types of regressions for the current time frame, and calculates the root mean square deviation of prices in the current range. First, the straight golden line - a first-level regression line that shows the direction and status of the current real trend in the selected time frame. It is obvious that the larger the angle to the horizontal, the more sloping the trend. Therefore, certain conclusions can be drawn about the status of the currency pair through the current position of the price relative to the regression line. For example, in the most general case, if the ray is pointing upwards and price is below the ray, it means that the recent minor retracement has ended and price should be expected to naturally move into the area above the return ray in the continuation of the trend.

The support and resistance lines are parallel to the trend line and are at a certain distance from the golden line. They are located above and below the trend line respectively. These are effectively linear thresholds because they are plotted against the root mean square deviation values ​​within the calculated range and the corresponding Fibonacci coefficients.

Using the root mean square deviation values ​​and the corresponding Fibonacci coefficients, the indicator calculates the values ​​of the adaptive "Stop Loss" and "Stop Loss/Reversal" levels of the current price with the help of a special algorithm. These levels can be interpreted as instantaneous extreme values ​​of the deviation of the time interval of the last bar. Depending on the status of the currency pair, these values ​​are displayed via colored dots above and/or below the price. Blue shaded dots are drawn below the price, the lighter dots are "stops" and the darker dots are "stops/reversals". Points shaded in red are plotted above the price and also show stop loss and reversal levels. For any price value on any bar, the indicator always shows only two instantaneous value levels, but not all four. This helps to draw appropriate conclusions about the trend status. Important note - If one or both stop loss levels are truly exceeded, the indicator will show this event by reversing the instantaneous value when the closing price of the bar exceeds the corresponding levels. For example, if these were resistance levels before a breakout, the indicator would plot the instantaneous support levels instead of them. So if there is a reversal - at least a short-term change in trend, a small pullback

The indicator uses specified regression coefficients to calculate and display non-linear channels, which are necessary to predict the immediate future, and also act as linear channels, i.e. showing valid support and resistance levels, but changing dynamically and non-linearly over time. By default, the indicator uses a parabolic regression coefficient, which is 2.

The interpretation of indicator values ​​is relatively simple:
- For example, let the non-linear regression channel curve and cross the golden line of the uptrend from above. This is a signal of exhaustion – expect a pullback or even a trend change. If it crosses below – this is a sign of increasing trend strength. Accordingly, everything is reflected in the downtrend. Also need to switch to higher, smaller time frames and watch what happens there.

Price crosses a support or resistance line:
- If the price breaks the resistance level in an uptrend, it is expected to return to the channel, but there is no need to close the position. If the price breaks support in an uptrend and breaks the stop/reversal levels, a strong pullback is expected. In order to understand the situation more accurately, it is also necessary to consider the channel status relative to the trend golden line and the values ​​of adjacent time frames. Accordingly, everything is reflected in the downtrend.

All channels are dynamically recalculated and redrawn with each new bar based on current market conditions. Although the mathematical calculations are quite complex, this indicator does not load the CPU at all and does not require any special computer resources.

Input parameters:
_RegressionDegree – degree of non-linear regression; reasonable values ​​– 2 or 3.
_K_DeviationChannel – Deviation multiplier (not Fibonacci!); allows specifying a multiplier for the deviation, a reasonable value is - 2, but one might benefit from a value of 3.


Attachment download

📎 jX_ParabolicRegression_StopAndReverse.mq4 (17.28 KB)

Source: MQL5 #7086

Verification code Refresh