Category Other  Published on 31/08/2022

HighLow Index indicator

Description

The High-Low Index is a breadth custom indicator based on the Record High Percent, which relies on new n-days highs and new n-days lows. 

Use this indicator for a long zone when the indicator values are above the zero level. Also, use this indicator for a short zone when the indicator values are below the zero level.

For more information about short-term and long-term price momentum pressure, this indicator is used in five periods (for example, 10, 20, 50, 100, 200; fig.2). Confluence in all different periods shows the exact direction of price movement in the near future. This method has been tested and used by my mentor, Iba.


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

namespace cAlgo
{
    [Levels(0)]
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class mHighLowIndex : Indicator
    {
        [Parameter("Periods (9)", DefaultValue = 9, MinValue = 2)]
        public int inpPeriods { get; set; }
        [Parameter("Smooth Type (sma)", DefaultValue = MovingAverageType.Simple)]
        public MovingAverageType inpSmoothType { get; set; }
        
        [Output("HighLowIndex avg", LineColor = "Black", LineStyle = LineStyle.Solid, Thickness = 1)]
        public IndicatorDataSeries outHHLLavg { get; set; }

        private IndicatorDataSeries _longdata, _shortdata;
        private MovingAverage _longsmooth, _mashort;


        protected override void Initialize()
        {
            _longdata = CreateDataSeries();
            _shortdata = CreateDataSeries();
            _longsmooth = Indicators.MovingAverage(_longdata, inpPeriods, inpSmoothType);
            _mashort = Indicators.MovingAverage(_shortdata, inpPeriods, inpSmoothType);
        }

        public override void Calculate(int i)
        {
            _longdata[i] = (Bars.ClosePrices[i] / (Bars.ClosePrices[i] + Bars.LowPrices[i])) * 100;
            _shortdata[i] = (Bars.ClosePrices[i] / (Bars.ClosePrices[i] + Bars.HighPrices[i])) * 100;

            outHHLLavg[i] = (((_longsmooth.Result[i] + _mashort.Result[i]) / 2) - 50) / Symbol.PipSize;
        }
    }
}


mfejza's avatar
mfejza

Joined on 25.01.2022

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