Slope MA Indicator For Detecting Trends

Slope MA Indicator For Detecting Trends

27 January 2022, 17:36
Abir Pathak
0
1 203

Features:

  • Moving Average Slope for Max Past Bars
  • Slope Period
  • Slope Thresholds
  • Multiple Slope Type options
  • See slope visually as a histogram
  • Info Panel Show/Hide


Slope Calculations and Types:

The slope value is calculated using the Slope Period. Suppose Period is 5, it will check the MA value for bar (x) and bar (x+5).

And find the slope angle between them.

Now in order to calculate an accurate angle between 2 lines, the 2 units for both should be the same. But in trading the units are Price and Time.

And we need this angle for MA Slope:


So exact slope can never be calculated. But these slope values are useful when we compare them relative to each other.

We can get a very good idea of trending and ranging markets.

Note: Slope calculation is done only once per bar. After that slopes are calculated only for new bars. This is to prevent repainting.

But if you reload the indicator, then depending on Slope Type selected, repainting might occur. For “Chart Slope” or “Radian Slope (Normalized)”


Slope Types:

  • True Slope (Fixed 1:1 Chart)

Now, MT4 auto resizes chart when we move left and right. So it’s easier visually. But if we select 1:1 chart from properties, then chart will look a lot different:

True slope, will stop MT4 auto resize and will fix the chart to 1:1 fixed scale.

And find the slope between MA price and time.

Cons: This option will make scrolling through the chart a bit difficult.

  • Chart Slope (Current Chart)

This will use the current chart’s slope.

Cons: If chart is resized and slope value re-loaded, the slope will change.

Only use this option, if you are interested in current chart’s slope only. Despite the chart resized:

  • Radian Slope

This version fixes the previous issues.

By taking the radian angle: Price – Prev_Price and dividing by time difference and uses this Radian value and converts it into Slope

Radian to Degrees (atan (slope in radians)) / Symbol Points
Cons: Different timeframes will have different slope values, despite the MA looking the same. This is because Points for lower timeframes are smaller and for higher timeframes, the same point distance is larger.
  • Radian Slope (Normalized)

This option normalizes the Point values. And makes all timeframes have similar slopes by using ATR value of Slope for M15.

Cons: Since it uses ATR for normalizing, slope values will shift slightly as time goes on. So to prevent repainting, slopes are calculated only once for all bars. And then new slopes are calculated for newer bars only.

 

Settings:

Max Past Bars: Scan past bars and draw histogram showing MA slope values for past bars

Slope Period: Calculate the MA SLope between these number of bars:

Slope High and Slope Low: Are Thresholds. Histogram will turn Green/Red if Slope is beyond these thresholds

Slope Type: 4 types as above

ATR Period: Used for normalizing the slope in “Radian Slope Normalized”

MA Params: MA Period, MA Method, MA Applied Price are for generating the moving average and slope is calculated for that

Info Panel Settings: Are for positioning the info panel or to show/hide it

All other settings are for Alerts and Logs.

Share it with friends: