예제 #1
0
        protected override void OnStartUp()
        {
            var period = 2 * strength + 1;

            mx = MAX(High, period);
            mn = MIN(Low, period);
        }
예제 #2
0
 protected override void OnStartUp()
 {
     DYNRSI    = RSI(Input, RSIPeriod, 1);
     DYNPrice  = SMA(DYNRSI, PricePeriod);
     DYNSignal = SMA(DYNRSI, SignalPeriod);
     // added the following Aug 19 2014 zondor
     emaEMAhls = EMA(EMA(hls, EMAPeriod1), EMAPeriod2);
     emaEMAsms = (EMA(EMA(sms, EMAPeriod1), EMAPeriod2));
     emaSMI    = EMA(smis, SMIEMAPeriod);
     MaxHI     = MAX(High, range);
     MinLO     = MIN(Low, range);
 }
예제 #3
0
        /// <summary>
        /// The Maximum shows the maximum of the last n bars.
        /// </summary>
        /// <returns></returns>
        public MAX MAX(Data.IDataSeries input, int period)
        {
            if (cacheMAX != null)
            {
                for (int idx = 0; idx < cacheMAX.Length; idx++)
                {
                    if (cacheMAX[idx].Period == period && cacheMAX[idx].EqualsInput(input))
                    {
                        return(cacheMAX[idx]);
                    }
                }
            }

            lock (checkMAX)
            {
                checkMAX.Period = period;
                period          = checkMAX.Period;

                if (cacheMAX != null)
                {
                    for (int idx = 0; idx < cacheMAX.Length; idx++)
                    {
                        if (cacheMAX[idx].Period == period && cacheMAX[idx].EqualsInput(input))
                        {
                            return(cacheMAX[idx]);
                        }
                    }
                }

                MAX indicator = new MAX();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input  = input;
                indicator.Period = period;
                Indicators.Add(indicator);
                indicator.SetUp();

                MAX[] tmp = new MAX[cacheMAX == null ? 1 : cacheMAX.Length + 1];
                if (cacheMAX != null)
                {
                    cacheMAX.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheMAX            = tmp;
                return(indicator);
            }
        }
예제 #4
0
        /// <summary>
        /// The Maximum shows the maximum of the last n bars.
        /// </summary>
        /// <returns></returns>
        public MAX MAX(Data.IDataSeries input, int period)
        {
            if (cacheMAX != null)
                for (int idx = 0; idx < cacheMAX.Length; idx++)
                    if (cacheMAX[idx].Period == period && cacheMAX[idx].EqualsInput(input))
                        return cacheMAX[idx];

            lock (checkMAX)
            {
                checkMAX.Period = period;
                period = checkMAX.Period;

                if (cacheMAX != null)
                    for (int idx = 0; idx < cacheMAX.Length; idx++)
                        if (cacheMAX[idx].Period == period && cacheMAX[idx].EqualsInput(input))
                            return cacheMAX[idx];

                MAX indicator = new MAX();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.Period = period;
                Indicators.Add(indicator);
                indicator.SetUp();

                MAX[] tmp = new MAX[cacheMAX == null ? 1 : cacheMAX.Length + 1];
                if (cacheMAX != null)
                    cacheMAX.CopyTo(tmp, 0);
                tmp[tmp.Length - 1] = indicator;
                cacheMAX = tmp;
                return indicator;
            }
        }