OPEN-SOURCE SCRIPT

Normalized Hull Moving Average Oscillator w/ Configurations

This indicator uniquely uses normalization techniques applied to the Hull Moving Average (HMA) and allows the user to choose between a number of different types of normalization, each with their own advantages. This indicator is one in a series of experiments I've been working on in looking at different methods of transforming data. In particular, this is a more usable example of the power of data transformation, as it takes the Hull Moving Average of Alan Hull and turns it into a powerful oscillating indicator.

The indicator offers multiple types of normalization, each with its own set of benefits and drawbacks. My personal favorites are the Mean Normalization, which turns the data series into one centered around 0, and the Quantile Transformation, which converts the data into a data set that is normally distributed.

I've also included the option of showing the mean, median, and mode of the data over the period specified by the length of normalization. Using this will allow you to gather additional insights into how these transformations affect the distribution of the data series.

Types of Normalization:
1. Z-Score
  • Overview: Standardizes the data by subtracting the mean and dividing by the standard deviation.
  • Benefits: Centers the data around 0 with a standard deviation of 1, reducing the impact of outliers.
  • Disadvantages: Works best on data that is normally distributed
  • Notes: Best used with a mid-longer length of transformation.


2. Min-Max
  • Overview: Scales the data to fit within a specified range, typically 0 to 1.
  • Benefits: Simple and fast to compute, preserves the relationships among data points.
  • Disadvantages: Sensitive to outliers, which can skew the normalization.
  • Notes: Best used with mid-longer length of transformation.


3. Mean Normalization
  • Overview: Subtracts the mean and divides by the range (max - min).
  • Benefits: Centers data around 0, making it easier to compare different datasets.
  • Disadvantages: Can be affected by outliers, which influence the range.
  • Notes: Best used with a mid-longer length of transformation.


4. Max Abs Scaler
  • Overview: Scales each feature by its maximum absolute value.
  • Benefits: Retains sparsity and is robust to large outliers.
  • Disadvantages: Only shifts data to the range [-1, 1], which might not always be desirable.
  • Notes: Best used with a mid-longer length of transformation.


5. Robust Scaler
  • Overview: Uses the median and the interquartile range for scaling.
  • Benefits: Robust to outliers, does not shift data as much as other methods.
  • Disadvantages: May not perform well with small datasets.
  • Notes: Best used with a longer length of transformation.


6. Feature Scaling to Unit Norm
  • Overview: Scales data such that the norm (magnitude) of each feature is 1.
  • Benefits: Useful for models that rely on the magnitude of feature vectors.
  • Disadvantages: Sensitive to outliers, which can disproportionately affect the norm. Not normally used in this context, though it provides some interesting transformations.
  • Notes: Best used with a shorter length of transformation.


7. Logistic Function
  • Overview: Applies the logistic function to squash data into the range [0, 1].
  • Benefits: Smoothly compresses extreme values, handling skewed distributions well.
  • Disadvantages: May not preserve the relative distances between data points as effectively.
  • Notes: Best used with a shorter length of transformation. This feature is actually two layered, we first put it through the mean normalization to ensure that it's generally centered around 0.


8. Quantile Transformation
  • Overview: Maps data to a uniform or normal distribution using quantiles.
  • Benefits: Makes data follow a specified distribution, useful for non-linear scaling.
  • Disadvantages: Can distort relationships between features, computationally expensive.
  • Notes: Best used with a very long length of transformation.


Conclusion
This indicator is a powerful example into how normalization can alter and improve the usability of a data series. Each method offers unique insights and benefits, making this indicator a useful tool for any trader. Try it out, and don't hesitate to reach out if you notice any glaring flaws in the script, room for improvement, or if you just have questions.
Hull Moving Average (HMA)hullmovingaveragenormalizationnormalizedOscillatorstradingTrend Analysistrendfollowing

오픈 소스 스크립트

진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

차트에 이 스크립트를 사용하시겠습니까?

면책사항