HalfTrend Indicator
The HalfTrend indicator is a trend-following tool that dynamically plots potential support and resistance levels, aiming to give a cleaner, less noisy read on trend direction than a plain moving average.
What is the HalfTrend Indicator?​
HalfTrend is a relatively modern technical analysis tool, built to identify trends and potential reversal points while filtering out market noise. It's used primarily in forex but applies equally to equities, commodities, and index derivatives. It uses an amplitude parameter to control sensitivity: how closely the line tracks price.
How to Read HalfTrend​
- Line below price, arrow pointing up: bullish trend
- Line above price, arrow pointing down: bearish trend
- The amplitude setting adjusts sensitivity: higher amplitude filters out more minor price changes, reducing false signals at the cost of slower reaction
Best Use Cases​
- Trend Identification: HalfTrend's primary strength: aligning trades with the prevailing direction.
- Entry and Exit Timing: the clear visual flip (arrow direction change) marks potential entry and exit points.
- Combining with Other Indicators: pairing with RSI or MACD can confirm the strength behind a HalfTrend signal.
HalfTrend PineScript for TradingView​
Here's a ready-to-use HalfTrend-style strategy template, using a moving-average-based trend flip as a simplified approximation. Paste it into the Pine Editor, adjust the moving average length, target, and stop loss to your preference, and backtest it.
To learn how to add this pinescript in TradingView, click here.
This strategy is for demonstration purposes only and is not intended for actual trading. AlgoTest is not responsible for any profit or loss arising from the use of this sample strategy.
//@version=5
strategy("Half Trend Strategy", overlay=true)
// Input parameters
ma_length = input.int(20, title="Moving Average Length")
target_points = input.int(100, title="Target Points")
stop_loss_points = input.int(50, title="Stop Loss Points")
// Calculate Moving Average
ma = ta.sma(close, ma_length)
// Determine trend
trend_up = close > ma
trend_down = close < ma
// Strategy logic
long_condition = trend_up and trend_up[1] == false
short_condition = trend_down and trend_down[1] == false
// Plot Moving Average
plot(ma, color=color.blue, title="Moving Average")
// Strategy entry
if long_condition
strategy.entry("Long", strategy.long)
if short_condition
strategy.entry("Short", strategy.short)
// Calculate target and stop loss levels
long_target = strategy.position_avg_price + target_points
long_stop_loss = strategy.position_avg_price - stop_loss_points
short_target = strategy.position_avg_price - target_points
short_stop_loss = strategy.position_avg_price + stop_loss_points
// Strategy exit
strategy.exit("Long Exit", "Long", limit=long_target, stop=long_stop_loss)
strategy.exit("Short Exit", "Short", limit=short_target, stop=short_stop_loss)
Once you've backtested it, you can connect the alert to AlgoTest to automate live execution without manually watching the chart.
FAQ​
What is the HalfTrend indicator?​
The HalfTrend indicator is a technical analysis tool used to determine market trends and forecast future price movements by dynamically plotting support and resistance levels.
How do you use a trend indicator?​
A trend indicator can be used by looking for periods where the indicator suggests a strong upward or downward trend. Traders may decide to enter trades in the direction of the trend when the indicator provides a clear signal.
What is amplitude in the HalfTrend indicator?​
Amplitude refers to the sensitivity setting that determines how closely the indicator tracks price movements. Adjusting the amplitude can help reduce false signals by making the indicator less responsive to minor price changes.
What is the Trend Magic indicator?​
While not directly related to HalfTrend, the Trend Magic indicator is another tool used to identify a trend's direction and strength. It combines CCI and ATR values to provide a dynamic trend line.
For more insights and detailed analysis tools, visit AlgoTest Signals.