TradingView
LuxAlgo
Jul 27, 2023 2:44 PM

HyperTrend [LuxAlgo]Β 

S&P 500SP

Description

β‹…
The HyperTrend indicator aims to provide a real-time estimate of an underlying linear trend in the price. Support and resistance extremities are constructed from this estimate which can provide trade opportunities within the overall trend.

Most tools that return lines on a chart are either subject to backpainting or repainting. We aimed to provide a reliable real-time method to estimate linear trends in the price, enhancing traders' decision making processes when it comes to trading trends in price, hence the term 'HyperTrend'.

πŸ”Ά USAGE



Users can use the HyperTrend to easily determine the trend direction in the price, with an average sloping upward indicating an uptrend, and an average sloping downward indicating a downtrend.



The channels upper extremity can act as a resistance, while the lower extremity can act as a support. Contact with candle wicks can signal timely reversals/retracements.



Using a higher "Multiplicative Factor" value will return less frequent new channels, and is suitable to analyze longer-term trends. The slope settings on the other end allow us to control the slope of the returned channels, with higher values returning flatter results (similar to our previously posted predictive ranges).

πŸ”Ή Channel Average

The channel average can return an estimate of the current (and future) trend in the price, the chart below shows an interval where a linear regression is displayed alongside the channel average:



Unlike the linear regression, the average does not have any lookahead bias, this of course comes at the price of accuracy in most cases.



Users can also use this average as a support or resistance. The breakout of a TC average that has been tested multiple times can be considered more significant in suggesting a trend reversal.

πŸ”Ά SETTINGS

  • Multiplicative Factor: Control the allowed degree of deviation of the price from the average line. Higher values will return less frequent new channels.
  • Slope: Controls the steepness of the returned lines. Higher values will return flatter results.
  • Width %: Width percentage of the channel. Lower results will return narrower channels.

Release Notes

β‹…
- Minor styling changes
Comments
Orph5781
β‹…
I tested different values for the three variables and found Hypertrend very inaccurate to detect ranges. It invents fictitious uptrends or downtrends for longtime ranging seasons. I don’t enjoy it
alexgrover
β‹…
@Orph5781, Thats kind of its goal...You can check this one for an usage more suited for ranging markets tradingview.com/script/lIdNGLiV-Predictive-Ranges-LuxAlgo/
Orph5781
β‹…
@alexgrover, thanks for your view. May be it should be needed to use both at the same time to have wider perspective.
hymano
β‹…
No arrow for high and low turning points ( peak or vally)
LuxAlgo
β‹…
@hymano, The arrows were added just for within the description to show how the indicator can be used for support/resistance :)
stock20
β‹…
// Add alerts for buying and selling signals
buySignal = crossover(avg, upper)
sellSignal = crossunder(avg, lower)

alertcondition(buySignal, title="Buy Signal", message="Buy signal detected!")
alertcondition(sellSignal, title="Sell Signal", message="Sell signal detected!")

//OR

// Add alerts for trend up and trend down
trendUp = os == 1
trendDown = os == -1

alertcondition(trendUp, title="Trend Up", message="The trend is going up!")
alertcondition(trendDown, title="Trend Down", message="The trend is going down!")
HomelessToRich
β‹…
@stock20, Thank you but test your alerts with plotshapes you will realize that you will have a lot of alerts. I tested this it's not exactly what I want but at least it warns me of the change in trend

buy = ta.change(hold) > 0
sell = ta.change(hold) < 0
plotchar(buy, text='TrendChange', char='', color=color.new(color.white, 0), location=location.belowbar)
plotchar(sell, text='TrendChange', char='', color=color.new(color.white, 0), location=location.abovebar)
if buy
alert("TrendChange", alert.freq_once_per_bar)
if sell
alert("TrendChange", alert.freq_once_per_bar)
makerup
β‹…
ahhhhh YES, my friend the Hyper Trend
abhigrow3949
β‹…
@makerup, hows this
kroaton
β‹…
Need to test urgently!
More