Skip to content
Home » Posts » Documentation » HTF 4 MA Trend Analysis

HTF 4 MA Trend Analysis

Overview

This indicator will render up to four (4) moving averages on the chart in any higher timeframe and provide a “MA Bullish / Bearish Strength Signal” as a plot output that can be used to link with other indicators on the chart that use the `input.source()` function.

Check it out on TradingView… 🡵

Indicator Anatomy

Figure 1 – Indicator Anatomy

Indicator Settings

General Info

Figure 2 – General Info Section

Version

The version input is for displaying the published version of the indicator. It is intended to be for informational use only.

Moving Averages

Figure 3 – Moving Averages Section

Timeframe

Defines the higher timeframe data to use for the moving averages and drawn onto the chart.

Moving Average 1, 2, 3, & 4

When checked, the moving average line is displayed on the chart using the input values that are beneath this setting.

Type

Sets the type of moving average calculation to use for the plot on the chart. The default is SMA. Possible values are:

Source

Sets the price source for the 1st moving average. The default is close. Possible values are:

  • open – The open price of the current candle.
  • high – The high price of the current candle.
  • low – The low price of the current candle.
  • close – The close price of the current candle.
  • hl2 – The average of the high and low price of the current candle.
  • hlc3 – The average of the high, low, and close price of the current candle.
  • ohlc4 – The average of the open, high, low, and close price of the current candle.
  • hlcc4 – The average of the high, low, and the double of the close price of the current candle.

Length

Sets the number of bars (length) to use for the selected moving average type. The minimum value is 1 and the maximum is unbounded.

⚠️ Note:

The Length values amongst the enabled moving averages are validated to ensure that they are increasing in sequence. If not, a run-time error will occur and prevent the indicator from functioning normally. The following is an example of the run-time error message:

Figure 4 – Length Run-time Error Example

MA Band

Figure 5 – MA Band Section

Moving Average Band

When checked, the upper and lower band is drawn on the moving average line that is being referenced.

MA Reference

Sets the moving average reference to use for the upper and lower bands. The default is MA 1. Possible values are:

  • MA 1 – Moving Average 1
  • MA 2 – Moving Average 2
  • MA 3 – Moving Average 3
  • MA 4 – Moving Average 4
⚠️ Note:

The moving average must be enabled when making a choice for this input. If not, a run-time error will occur and prevent the indicator from functioning normally. The following is an example of the run-time error message:

Figure 6 – MA Reference Run-time Error Example

Deviation (%)

Sets the offset percentage for the upper and lower bands. The default is 1.0. The minimum value is 0.0 and the maximum value is 100.0.

Signal

Figure 7 – Signal Section

MA 1 & 2 Bull & Bear Weight

Defines the weight value to use when the signal value is being calculated with respect to the bull/bear trend between the Moving Average 1 (MA 1) and Moving Average 2 (MA 2). The minimum value for the Bull Weight is 1 and the maximum is unbounded. The maximum value for the Bear Weight is -1 and the minimum is unbounded.

MA 2 & 3 Bull & Bear Weight

Defines the weight value to use when the signal value is being calculated with respect to the bull/bear trend between the Moving Average 2 (MA 2) and Moving Average 3 (MA 3). The minimum value for the Bull Weight is 1 and the maximum is unbounded. The maximum value for the Bear Weight is -1 and the minimum is unbounded.

MA 3 & 4 Bull & Bear Weight

Defines the weight value to use when the signal value is being calculated with respect to the bull/bear trend between the Moving Average 3 (MA 3) and Moving Average 4 (MA 4). The minimum value for the Bull Weight is 1 and the maximum is unbounded. The maximum value for the Bear Weight is -1 and the minimum is unbounded.

Upper & Lower MA Band Weight

Defines the weight value to use when the signal value is being calculated and the price action is above/below the upper/lower MA Band. The minimum value for the Upper Band Weight is 1 and the maximum is unbounded. The maximum value for the Lower Band Weight is -1 and the minimum is unbounded.

Use Previous Bar’s Signal

When checked, the indicator will use the previous bar data to calculate the signal so that it will prevent false signals during the real-time, unfinished bar.

How the Signal Works

Using the four moving averages (each with increasing lengths), the script will compute a trend strength signal value. Specifically, the indicator provides a plot data series called “MA Bullish / Bearish Strength Signal” the is simply the summation of the bullish / bearish trend weight values between the four moving averages.

The bullish / bearish trend weight values are determined by the position of the moving average lines relative to each other. For example, when Moving Average 1 is above Moving Average 2, this is considered a bullish trend and the weight value will be 1. The weight values can be changed to in the settings to define your own specific weights/values to rate the trend strength.

The following list defines the meaning of the “MA Bullish / Bearish Strength Signal” value using the default signal values:

  • -6 = Strong bearish
  • -2 = Moderate bearish
  • 2 = Moderate bullish
  • 6 = Strong bullish
Figure 8 – MA Bullish/Bearish Signal Example

An additional option allows you to add a band around a specific moving average using a deviation percentage to further evaluate the candles being above or below the upper/lower bands. When the candle’s close value is above or below the bands, you can add another weighted value to the signal result. As a result, an additional plot series called “MA Bull/Bear + Band Signal” is provided to include the moving average band weight.

Figure 9 – MA Bullish / Bearish + Band Signal Example

Chart Settings

Figure 10 – Chart Settings Section

Display Mode

Determines the display mode to use for rendering chart lines. Possible values are:

  • Overlay – the indicator will draw only the MA and MA Band plots.
  • Pane – the indicator will draw only the signal plots over a zero line to visualize the signal changes with the chart events.
  • Both – the indicator will draw both the MA/MA Band plots and the signal plots.
Figure 11 – Display Mode Example

Data Window

The indicator will output series data values to the chart that are visible in the Data Window of TradingView. This section will describe each data point to help you understand the data points that are available.

Data Points in Overlay Mode

Figure 12 – Data Window in Overlay Mode

MA 1, 2, 3, & 4

Displays the Moving Average price value for the current bar that is rendered on the chart.

Data Points in Pane Mode

Figure 13 – Data Window in Pane Mode

MA Bull/Bear Signal

Displays the Moving Average Bull/Bear Signal value for the current bar that is rendered on the chart.

MA Bull/Bear + Band Signal

Displays the Moving Average Bull/Bear + Band Signal value for the current bar that is rendered on the chart.

Send me an email when this page has been updated

Leave a Reply

Your email address will not be published. Required fields are marked *