*mod note:*

@mashume's Hull has a lag because it waits for future bars to close before it REPAINTS the perfect signal. For us, longer-term swing traders, the lag is not a barrier to using @mashume's excellent study. But for scalpers, day traders, and short-swingers, @mashume's Hull might not be an optimal choice.

**@Mashume's Hull Moving Average Turning Points and Concavity (2nd Derivatives)**

The upper study plots Hull Moving Average with the addition of colored segments representing concavity and turning points: maxima, minima and inflection.

The lower study is a plot of the calculation used in finding the turning points (which is roughly the second derivative of the HMA function), where zero crosses are the inflection points.

Upper Study (version 4): https://usethinkscript.com/threads/...nd-concavity-2nd-derivatives.1803/#post-16566

Scan For Turning Points (upper study): https://usethinkscript.com/threads/...avity-2nd-derivatives.1803/page-21#post-66454

Scan For Divergences (lower study): https://usethinkscript.com/threads/...avity-2nd-derivatives.1803/page-22#post-70440

Alerts For Turning Points: https://usethinkscript.com/threads/...avity-2nd-derivatives.1803/page-18#post-35731

######################################################https://usethinkscript.com/threads/hull-turning-points-concavity-questions.7847/#post-80172

# New Code To Add Alerts For When Bar Colors Go From

# Red -> Dark Green -> Green (LONG) And When They Go

# Green -> Orange -> Red (SHORT).

######################################################

__Upper HMA colors__:

- Green: Concave Up but HMA decreasing. The 'mood' has changed and the declining trend of the HMA is slowing. Long trades were entered at the turning point
- Light Green: Concave up and HMA increasing. Price is increasing, and since the curve is still concave up, it is accelerating upward.
- Orange: Concavity is now downward, and though price is still increasing, the rate has slowed, perhaps the mood has become less enthusiastic. We EXIT the trade (long) when this phase starts. Very little additional upward price movement is likely.
- Red: Concave down and HMA decreasing. Not good for long trades, but get ready for a turning point to enter long on again.

__Upper Label Colors__:

these are useful for getting ready to enter a trade, or exit a trade and serve as warnings that a turning point may be reached soon

- Green: Concave up and divergence (the distance from the expected HMA value to the actual HMA value is increasing). That is, we're moving away from a 2nd derivative zero crossover.
- Yellow: Concave up but the divergence is decreasing (heading toward a 2nd derivative zero crossover); it may soon be time to exit the trade.
- Red: Concave down and the absolute value of the divergence is increasing (moving away from crossover)
- Pink: Concave down but approaching a zero crossover from below (remember that that is the entry signal, so pink means 'get ready').

__Lower Study__:

plot of the divergence from expected HMA values; analogous to the second derivative in that the zero crossovers are of interest, as is the slope of the line. The further from zero, the stronger the curve of the concavity, and the more likely to reach a local minima or maxima in short order.

The lower can give you a preview of when things might be approaching a concavity shift, and how quickly or perhaps decisively they are crossing.

Last edited: