Category Oscilators  Published on 08/09/2022

InSync Index indicator

Description

Insync Index, by Norm North, is a consensus indicator. It uses RSI, MACD, MFI, DPO, ROC, Stoch, CCI and %B to calculate a composite signal. Basically, this index shows that when a majority of underlying indicators is in sync, a turning point is near.

There are couple of ways to use this indicator.
- Buy when crossing up 5, sell when crossing down 95.
- Market is typically bullish when index is above 50, bearish when below 50. This can be a great confirmation signal for price action + trend lines .

Also, since this is typical oscillator, look for divergences between price and index.

Levels 75/25 are early warning levels. Note that, index > 75 (and less than 95) should be considered very bullish and index below 25 (but above 5) as very bearish . Levels 95/5 are equivalent to traditional OB/OS levels.

The various values of the underlying components can be tuned via options page. I have also provided an option to color bars based on the index value.

More info: The Insync Index by Norm North, TASC Jan 1995



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

namespace cAlgo
{
    [Levels(25, 75, 5, 95)]
    [Cloud("LimitUp1", "LimitDn1", FirstColor = "Red", Opacity = 0.1, SecondColor = "Red")]
    [Cloud("LimitUp2", "LimitDn2", FirstColor = "Green", Opacity = 0.1, SecondColor = "Aqua")]
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class mInsync : Indicator
    {
        [Parameter("Period CCI (14):", DefaultValue = 14)]
        public int prmPeriodCCI { get; set; }
        [Parameter("Period Bollinger (20):", DefaultValue = 20)]
        public int prmPeriodBollinger { get; set; }
        [Parameter("Deviation Bollinger (2):", DefaultValue = 2.0)]
        public double prmDeviationBollinger { get; set; }
        [Parameter("Period RSI (14):", DefaultValue = 14)]
        public int prmPeriodRSI { get; set; }
        [Parameter("Period Stoch (14):", DefaultValue = 14)]
        public int prmPeriodStoch { get; set; }
        [Parameter("Period Stoch D (3):", DefaultValue = 3)]
        public int prmPeriodStochD { get; set; }
        [Parameter("Period Stoch K (1):", DefaultValue = 1)]
        public int prmPeriodStochK { get; set; }
        [Parameter("Period MFI (14):", DefaultValue = 20)]
        public int prmPeriodMFI { get; set; }
        [Parameter("Period EOM (10):", DefaultValue = 10)]
        public int prmPeriodEOM { get; set; }
        [Parameter("Period ROC (10):", DefaultValue = 10)]
        public int prmPeriodROC { get; set; }
        [Parameter("Period DPO (18):", DefaultValue = 18)]
        public int prmPeriodDPO { get; set; }
        [Parameter("Period MACD Fast (12):", DefaultValue = 12)]
        public int prmPeriodMACDFast { get; set; }
        [Parameter("Period MACD Slow (26):", DefaultValue = 26)]
        public int prmPeriodMACDSlow { get; set; }
        [Parameter("Period MACD Signal (9):", DefaultValue = 9)]
        public int prmPeriodMACDSignal { get; set; }

        [Output("Main", LineColor = "Black", PlotType = PlotType.Line, LineStyle = LineStyle.Solid, Thickness = 1)]
        public IndicatorDataSeries outInSync { get; set; }
        [Output("LimitUp1", LineColor = "Transparent", PlotType = PlotType.Line, LineStyle = LineStyle.Solid, Thickness = 1)]
        public IndicatorDataSeries LimitUp1 { get; set; }
        [Output("LimitDn1", LineColor = "Transparent", PlotType = PlotType.Line, LineStyle = LineStyle.Solid, Thickness = 1)]
        public IndicatorDataSeries LimitDn1 { get; set; }
        [Output("LimitUp2", LineColor = "Transparent", PlotType = PlotType.Line, LineStyle = LineStyle.Solid, Thickness = 1)]
        public IndicatorDataSeries LimitUp2 { get; set; }
        [Output("LimitDn2", LineColor = "Transparent", PlotType = PlotType.Line, LineStyle = LineStyle.Solid, Thickness = 1)]
        public IndicatorDataSeries LimitDn2 { get; set; }

        private CommodityChannelIndex _cci;
        private BollingerBands _bb;
        private RelativeStrengthIndex _rsi;
        private StochasticOscillator _stoc;
        private MoneyFlowIndex _mfi;
        private EaseOfMovement _eom;
        private PriceROC _roc;
        private DetrendedPriceOscillator _dpo;
        private MacdCrossOver _macd;
        private IndicatorDataSeries _cci_res;
        private IndicatorDataSeries _bbres;
        private IndicatorDataSeries _bb_res;
        private IndicatorDataSeries _rsi_res;
        private IndicatorDataSeries _stoc_res;
        private IndicatorDataSeries _mfi_res;
        private IndicatorDataSeries _eom_res;
        public IndicatorDataSeries _roc_res;
        public IndicatorDataSeries _dpo_res;
        public IndicatorDataSeries _macd_res;


        protected override void Initialize()
        {
            _cci = Indicators.CommodityChannelIndex(prmPeriodCCI);
            _bb = Indicators.BollingerBands(Bars.ClosePrices, prmPeriodBollinger, prmDeviationBollinger, MovingAverageType.Simple);
            _rsi = Indicators.RelativeStrengthIndex(Bars.ClosePrices, prmPeriodRSI);
            _stoc = Indicators.StochasticOscillator(prmPeriodStoch, prmPeriodStochD, prmPeriodStochK, MovingAverageType.Simple);
            _mfi = Indicators.MoneyFlowIndex(prmPeriodMFI);
            _eom = Indicators.EaseOfMovement(prmPeriodEOM, MovingAverageType.Simple);
            _roc = Indicators.PriceROC(Bars.ClosePrices, prmPeriodROC);
            _dpo = Indicators.DetrendedPriceOscillator(Bars.ClosePrices, 18, MovingAverageType.Simple);
            _macd = Indicators.MacdCrossOver(prmPeriodMACDSlow, prmPeriodMACDFast, prmPeriodMACDSignal);

            _cci_res = CreateDataSeries();
            _bbres = CreateDataSeries();
            _bb_res = CreateDataSeries();
            _rsi_res = CreateDataSeries();
            _stoc_res = CreateDataSeries();
            _mfi_res = CreateDataSeries();
            _eom_res = CreateDataSeries();
            _roc_res = CreateDataSeries();
            _dpo_res = CreateDataSeries();
            _macd_res = CreateDataSeries();
        }

        public override void Calculate(int index)
        {
            if (index < 3)
            {
                LimitUp1[index] = 95;
                LimitDn1[index] = 50;
                LimitUp2[index] = 50;
                LimitDn2[index] = 5;
                outInSync[index] = 50;
                return;
            }
            _cci_res[index] = (_cci.Result[index] > 100.0 ? +5.0 : (_cci.Result[index] < -100.0 ? -5.0 : 0.0));
            _bbres[index] = (Bars.ClosePrices[index] - _bb.Bottom[index]) / (_bb.Top[index] - _bb.Bottom[index]);
            _bb_res[index] = (_bbres[index] < 0.05 ? -5 : (_bbres[index] > 0.95 ? +5 : 0));
            _rsi_res[index] = (_rsi.Result[index] > 70 ? 5 : (_rsi.Result[index] < 30 ? -5 : 0));
            _stoc_res[index] = (_stoc.PercentD[index] > 80 ? 5 : (_stoc.PercentD[index] < 20 ? -5 : 0)) + (_stoc.PercentK[index] > 80 ? 5 : (_stoc.PercentK[index] < 20 ? -5 : 0));
            _mfi_res[index] = (_mfi.Result[index] > 80 ? 5 : (_mfi.Result[index] < 20 ? -5 : 0));
            _eom_res[index] = (_eom.Result[index] > 0 && _eom.Result[index] > _eom.Result[index - 1] ? 5 : (_eom.Result[index] < 0 && _eom.Result[index] < _eom.Result[index - 1] ? -5 : 0));
            _roc_res[index] = (_roc.Result[index] > 0 && _roc.Result[index] > _roc.Result[index - 1] ? 5 : (_roc.Result[index] < 0 && _roc.Result[index] < _roc.Result[index - 1] ? -5 : 0));
            _dpo_res[index] = (_dpo.Result[index] > 0 && _dpo.Result[index] > _dpo.Result[index - 1] ? 5 : (_dpo.Result[index] < 0 && _dpo.Result[index] < _dpo.Result[index - 1] ? -5 : 0));
            _macd_res[index] = (_macd.MACD[index] > 0 && _macd.MACD[index] > _macd.MACD[index - 1] ? 5 : (_macd.MACD[index] < 0 && _macd.MACD[index] < _macd.MACD[index - 1] ? -5 : 0));

            outInSync[index] = 50 + _cci_res[index] + _bb_res[index] + _rsi_res[index] + _stoc_res[index] + _mfi_res[index] + _eom_res[index] + _roc_res[index] + _dpo_res[index];

            LimitUp1[index] = 95;
            LimitDn1[index] = 50;
            LimitUp2[index] = 50;
            LimitDn2[index] = 5;
        }
    }
}


mfejza's avatar
mfejza

Joined on 25.01.2022

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: mInsync.algo
  • Rating: 5
  • Installs: 721
Comments
Log in to add a comment.
RO
rothypnotic · 1 year ago

The various values of the underlying components can be adjusted via the options page. I've also included the option to color bars based on the index value. basket random