Implementing Hull Moving Average on Multiple Time Frames (MTF) with GRAPHONPRICE

18 Nov 2017
0 comment
0 attachment

This code snippet demonstrates how to replace a standard moving average with a Hull Moving Average (HMA) in a multi-time frame (MTF) indicator setup using the GRAPHONPRICE feature in ProBuilder. The Hull Moving Average provides a faster and smoother average, which is often preferred for its reduced lag compared to traditional moving averages.


// Define the time frame and period for the Hull Moving Average
TimeFrame1 = 15
Period = 9

// Calculate the Hull Moving Average for the specified time frame
HMA = HullAverage[Period](close) as TimeFrame1

// Plot the Hull Moving Average on the price chart
return HMA as "HMA on Price"

Explanation of the code:

  • TimeFrame1 and Period: The variables TimeFrame1 and Period are set to define the time frame (15 minutes) and the period (9 periods) for the Hull Moving Average calculation.
  • Hull Moving Average Calculation: The HullAverage[Period](close) function calculates the Hull Moving Average of the closing prices over the specified period. The as TimeFrame1 part ensures that the calculation is applied to the 15-minute time frame.
  • Plotting the HMA: The calculated Hull Moving Average is returned and labeled as “HMA on Price” to be plotted directly on the price chart. This allows for visual comparison of the HMA against the price movements within the same chart.

This example is useful for traders or analysts who want to utilize a more responsive moving average in their technical analysis, particularly in a multi-time frame context.

Related Post

Check out this related content for more information:

https://www.prorealcode.com/topic/timeframe-3/#post-95572

Visit Link
What is a Snippet? A snippet is a small, reusable chunk of code designed to solve specific tasks quickly. Think of it as a shortcut that helps you achieve your coding goals without reinventing the wheel. How to Use: Simply copy the snippet and paste it into your project where needed. Don't forget to tweak it to fit your context. Snippets are not just time-savers; they're also learning tools to help you become a more efficient coder.
robertogozzi Master
Roberto https://www.ots-onlinetradingsoftware.com
Author’s Profile

Comments

Search Snippets

Showing some results...
Sorry, no result found!

Snippets Categories

global
35
indicator
133
strategy
171

Recent Snippets

How to Create a Simple MTF Trend Dashboard with EMA and SMA
indicator
This indicator builds a compact multi-timeframe (MTF) dashboard that shows whether price is trading above or below a [...]
How to Display Per-Bar Volume Accumulation in Real Time (Intrabar Updates)
global
This snippet tracks and displays the current bar’s accumulated volume while the bar is still forming, instead of only [...]
Ticks Counter: Count Tick Updates Per Bar on Tick or Time Charts
global
This snippet counts how many tick updates have occurred for the current bar by incrementing a per-bar counter on each [...]
How to Build a Step-Based Trailing Stop That Moves to Break-Even First
strategy
This snippet implements a step trailing stop that advances in fixed increments once price reaches predefined profit [...]
Utilizing Arrays to Track and Compare Indicator Values Within the Same Bar in ProBuilder
indicator
This ProBuilder code snippet demonstrates how to use arrays to compare the values of an indicator (RSI in this case) [...]
Logo Logo
Loading...