Category Trend  Published on 11/09/2023

Gann HiLo Activator

An update for this algorithm is currently pending moderation. Please revisit this page shortly to access the algorithm's latest version.
Description

The Gann HiLo Activator is a custom indicator that helps traders identify trends and potential entry and exit points in the market. It's based on the work of W.D. Gann, a legendary trader who developed various technical analysis tools. The Gann HiLo Activator consists of a moving average and a trendline, and it can be used in various ways, including trend following and trend reversal strategies.

Here's how to use the Gann HiLo Activator indicator in your trading:

1. Understanding the Gann HiLo Activator Components:

  • Trendline: The Gann HiLo Activator consists of a trendline that changes color based on the direction of the trend. When the price is above the trendline, it's considered in an uptrend, and the line usually appears green. When the price is below the trendline, it's considered in a downtrend, and the line usually appears red.
  • Moving Average: The Gann HiLo Activator also includes a simple moving average (SMA). This moving average smooths out price data and can be used to confirm the trend direction.

2. Trading with Gann HiLo Activator:

Trend Following: When the trendline of the Gann HiLo Activator is green (above the price), it indicates an uptrend. Traders often look for opportunities to buy in an uptrend. You might consider entering long positions (buying) when the price crosses above the Gann HiLo Activator trendline.

Trend Reversal: When the trendline of the Gann HiLo Activator is red (below the price), it indicates a downtrend. Traders look for opportunities to sell in a downtrend. You might consider entering short positions (selling) when the price crosses below the Gann HiLo Activator trendline.

Confirmation with the Moving Average: Some traders use the SMA in the Gann HiLo Activator as a confirmation tool. For example, in an uptrend (green trendline), they might wait for the price to be above the SMA before entering a long trade. Conversely, in a downtrend (red trendline), they might wait for the price to be below the SMA before entering a short trade.

3. Setting Stop Loss and Take Profit:

  • Always use risk management techniques such as setting stop-loss orders to limit potential losses and take-profit orders to lock in profits. These levels can be based on your risk tolerance and the characteristics of the specific trade.

4. Practice and Backtesting:

  • Before using the Gann HiLo Activator indicator in live trading, it's advisable to practice and backtest your strategy on historical data. This helps you gain confidence in the indicator and your trading approach.

5. Combine with Other Analysis:

  • Many traders use the Gann HiLo Activator in combination with other technical indicators, candlestick patterns, or fundamental analysis to make more informed trading decisions.

Remember that no single indicator guarantees success in trading. It's essential to have a well-thought-out trading plan, manage risk effectively, and continuously monitor and adapt your strategy as market conditions change. Additionally, consider using the Gann HiLo Activator as part of a broader trading strategy rather than relying solely on it.

using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class mGHLA : Indicator
    {
        [Parameter("Range Period (10)", DefaultValue = 10, MinValue = 1)]
        public int inpRangePeriod { get; set; }

        [Output("Gann HiLo Activator", LineColor = "Black", PlotType = PlotType.Line, LineStyle = LineStyle.Solid, Thickness = 1)]
        public IndicatorDataSeries outGHLA { get; set; }
        [Output("Gann HiLo Activator Bullish", LineColor = "Green", PlotType = PlotType.DiscontinuousLine, LineStyle = LineStyle.Solid, Thickness = 2)]
        public IndicatorDataSeries outGHLAbull { get; set; }
        [Output("Gann HiLo Activator Bearish", LineColor = "Red", PlotType = PlotType.DiscontinuousLine, LineStyle = LineStyle.Solid, Thickness = 2)]
        public IndicatorDataSeries outGHLAbear { get; set; }
        
        private MovingAverage _ragehigh, _ragelow;
        private IndicatorDataSeries _trend, _ghla, _bulls, _bears;


        protected override void Initialize()
        {
            _ragehigh = Indicators.MovingAverage(Bars.HighPrices, inpRangePeriod, MovingAverageType.Simple);
            _ragelow = Indicators.MovingAverage(Bars.LowPrices, inpRangePeriod, MovingAverageType.Simple);
            _ghla = CreateDataSeries();
            _trend = CreateDataSeries();
            _bulls = CreateDataSeries();
            _bears = CreateDataSeries();
        }

        public override void Calculate(int i)
        {
            _trend[i] = Bars.ClosePrices[i] > _ragehigh.Result[i] ? +1 : Bars.ClosePrices[i] < _ragelow.Result[i] ? -1 : (i>1 ? _trend[i-1] : +1);
            _ghla[i] = _trend[i] < 0 ? _ragehigh.Result[i] : _ragelow.Result[i];
            _bulls[i] = _trend[i] < 0 ? double.NaN : _ragelow.Result[i];
            _bears[i] = _trend[i] < 0 ? _ragehigh.Result[i] : double.NaN; 
            
            outGHLA[i] = _ghla[i];
            outGHLAbull[i] = _bulls[i];
            outGHLAbear[i] = _bears[i]; 
        }
    }
}



mfejza's avatar
mfejza

Joined on 25.01.2022

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: mGHLA.algo
  • Rating: 5
  • Installs: 506
Comments
Log in to add a comment.
No comments found.