Category Trend  Published on 04/10/2021

Rob Booker ADX Breakout

Description

This is the Rob Booker ADX Breakout indicator implementation for cTrader.

It uses the popular ADX indicator on the background to find breakout trade setups.

When market is consolidating or when ADX is less than a specific threshold it shows a breakout box based on previous bars highs and lows.

If ADx goes above specified threshold again and broke the box from either side then its considered a breakout trade setup.

Github: spotware/Rob-Booker-ADX-Breakout: This is the Rob Booker ADX Breakout indicator implementation for cTrader (github.com)


using cAlgo.API;
using cAlgo.API.Indicators;
using System.Linq;

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class RobBookerAdxBreakout : Indicator
    {
        private DirectionalMovementSystem _adx;

        [Parameter("ADX Periods", DefaultValue = 14)]
        public int AdxPeriods { get; set; }

        [Parameter("ADX Threshold", DefaultValue = 18)]
        public double AdxThreshold { get; set; }

        [Parameter("Box Periods", DefaultValue = 20)]
        public int BoxPeriods { get; set; }

        [Output("Box High", LineColor = "Green", PlotType = PlotType.DiscontinuousLine)]
        public IndicatorDataSeries BoxHigh { get; set; }

        [Output("Box Low", LineColor = "Red", PlotType = PlotType.DiscontinuousLine)]
        public IndicatorDataSeries BoxLow { get; set; }

        protected override void Initialize()
        {
            _adx = Indicators.DirectionalMovementSystem(AdxPeriods);
        }

        public override void Calculate(int index)
        {
            if (_adx.ADX[index] > AdxThreshold)
            {
                BoxHigh[index] = double.NaN;
                BoxLow[index] = double.NaN;

                return;
            }

            var boxBars = Bars.Skip(Bars.Count - BoxPeriods).ToArray();

            var boxHigh = boxBars.Max(bar => bar.High);
            var boxLow = boxBars.Min(bar => bar.Low);

            for (int barIndex = index; barIndex > index - BoxPeriods; barIndex--)
            {
                BoxHigh[barIndex] = boxHigh;
                BoxLow[barIndex] = boxLow;
            }
        }
    }
}

Spotware's avatar
Spotware

Joined on 23.09.2013

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: Rob Booker ADX Breakout.algo
  • Rating: 0
  • Installs: 1605
  • Modified: 13/10/2021 09:55
Comments
Log in to add a comment.
No comments found.