Category Trend  Published on 21/08/2020

Smoothed High And Low Remora 2

Description

Well, exploring the relationships between the highs and the lows and their bands. (looking for the formula to turn the poor into rich and the rich into poor)
This time I dedicate the indicator to Bloomberg. There is news that moves the market and there are those who try to move the market with news
Greetings from Spain

 

 


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

namespace cAlgo
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class SmoothedHighAndLowRemora2 : Indicator
    {
        [Parameter("Periods", DefaultValue = 20)]
        public int Periods { get; set; }

        [Output("Result1", LineColor = "Red")]
        public IndicatorDataSeries Result1 { get; set; }

        [Output("Result2", LineColor = "Green")]
        public IndicatorDataSeries Result2 { get; set; }

        [Output("Result3", LineColor = "Blue")]
        public IndicatorDataSeries Result3 { get; set; }

        private IndicatorDataSeries max, min;
        private double hmax, lmax;
        private double hmin, lmin;

        private IndicatorDataSeries remora;
        private double hremora, lremora;

        protected override void Initialize()
        {
            max = CreateDataSeries();
            min = CreateDataSeries();
            remora = CreateDataSeries();
        }

        public override void Calculate(int index)
        {

            max[index] = 0;
            min[index] = 0;
            for (int i = 1; i <= Periods; i++)
            {
                max[index] += Bars.HighPrices.Maximum(i);
                min[index] += Bars.LowPrices.Minimum(i);
            }
            max[index] = max[index] / Periods;
            min[index] = min[index] / Periods;

            hmax = 0;
            lmax = 0;
            hmin = 0;
            lmin = 0;
            for (int i = 1; i <= Periods; i++)
            {
                hmax += max.Maximum(i);
                lmax += max.Minimum(i);
                hmin += min.Maximum(i);
                lmin += min.Minimum(i);
            }
            hmax = hmax / Periods;
            lmax = lmax / Periods;
            hmin = hmin / Periods;
            lmin = lmin / Periods;

            remora[index] = (min[index] - hmin) + (max[index] - lmax);

            hremora = 0;
            lremora = 0;
            for (int i = 1; i <= Periods; i++)
            {
                hremora += remora.Maximum(i);
                lremora += remora.Minimum(i);
            }
            hremora = hremora / Periods;
            lremora = lremora / Periods;

            Result1[index] = hremora;
            Result2[index] = lremora;
            //Result3[index] = hremora + lremora;
            Result3[index] = remora[index];
        }
    }
}


srm_bcn's avatar
srm_bcn

Joined on 01.09.2019

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