OPEN-SOURCE SCRIPT

Hull Suite Oscillator - Normalized | IkkeOmar

This script is based off the Hull Suite by @InSilico.

I made this script to provide and calculate the Hull Moving Average (HMA) based on the chosen variation (HMA, TMA, or EMA) and length to then normalize the HMA values to a range of 0 to 100. The normalized values are further smoothed using an exponential moving average (EMA).

The smoothed oscillator is plotted as a line, where values above 80 are colored red, values below 20 are colored green, and values between 20 and 80 are colored blue. Additionally, there are horizontal dashed lines at the levels of 20 and 80 to serve as reference points.

Explanation for the code:
The script uses the close price of the asset as the source for calculations. The modeSwitch parameter allows selecting the type of Hull variation: Hma, Thma, or Ehma. The length parameter determines the calculation period for the Hull moving averages. The lengthMult parameter is used to adjust the length for higher timeframes. The oscSmooth parameter determines the lookback period for smoothing the oscillator.

There are three functions defined for calculating different types of Hull moving averages: HMA, EHMA, and THMA. These functions take the source and length as inputs and return the corresponding Hull moving average.

The Mode function acts as a switch and selects the appropriate Hull variation based on the modeSwitch parameter. It returns the chosen Hull moving average.

The script calculates the Hull moving averages using the selected mode, source, and length. The main Hull moving average is stored in the _hull variable, and aliases are created for the main Hull moving average (HULL), the main Hull value (MHULL), and the secondary Hull value (SHULL).

To create the normalized oscillator values, the script finds the highest and lowest values of the Hull moving average within the specified length. It then normalizes the Hull values to a range of 0 to 100 using a formula. This normalized oscillator represents the strength of the trend.

To smooth out the oscillator values, an exponential moving average is applied using the oscSmooth parameter.

The smoothed oscillator is plotted as a line chart. The line color is determined based on the oscillator value using conditional statements. If the oscillator value is above or equal to 80, the line color is set to red. If it is below or equal to 20, the color is green. Otherwise, it is blue. The linewidth is set to 2.

Additionally, two horizontal reference lines are plotted at levels 20 and 80 for visual reference. They are displayed in gray and dashed style.
hullmovingaveragehullsuiteOscillators

نص برمجي مفتوح المصدر

قام مؤلف هذا النص البرمجي بنشره وجعله مفتوح المصدر، بحيث يمكن للمتداولين فهمه والتحقق منه، وهو الأمر الذي يدخل ضمن قيم TradingView. تحياتنا للمؤلف! يمكنك استخدامه مجانًا، ولكن إعادة استخدام هذا الرمز في المنشور يخضع لقواعد‎‎قوانين الموقع. يمكنك جعله مفضلاً لاستخدامه على الرسم البياني.

هل تريد استخدام هذا النص البرمجي على الرسم البياني؟


Join my community where i share signals and my secret algos:

Telegram:
t.me/ikkeomarfree

I can also pass funded accounts for you!
$50,000 accounts

Just dm my Telegram @IkkeOmar
يعمل أيضًا:

إخلاء المسؤولية