示例#1
0
 public TSSuperTrend TSSuperTrend(ISeries <double> input, SuperTrendMode stMode, MovingAverageType maType, int length, double multiplier, int smooth, bool showIndicator, bool showArrows, bool colorBars, bool playAlert)
 {
     if (cacheTSSuperTrend != null)
     {
         for (int idx = 0; idx < cacheTSSuperTrend.Length; idx++)
         {
             if (cacheTSSuperTrend[idx] != null && cacheTSSuperTrend[idx].StMode == stMode && cacheTSSuperTrend[idx].MaType == maType && cacheTSSuperTrend[idx].Length == length && cacheTSSuperTrend[idx].Multiplier == multiplier && cacheTSSuperTrend[idx].Smooth == smooth && cacheTSSuperTrend[idx].ShowIndicator == showIndicator && cacheTSSuperTrend[idx].ShowArrows == showArrows && cacheTSSuperTrend[idx].ColorBars == colorBars && cacheTSSuperTrend[idx].PlayAlert == playAlert && cacheTSSuperTrend[idx].EqualsInput(input))
             {
                 return(cacheTSSuperTrend[idx]);
             }
         }
     }
     return(CacheIndicator <TSSuperTrend>(new TSSuperTrend()
     {
         StMode = stMode, MaType = maType, Length = length, Multiplier = multiplier, Smooth = smooth, ShowIndicator = showIndicator, ShowArrows = showArrows, ColorBars = colorBars, PlayAlert = playAlert
     }, input, ref cacheTSSuperTrend));
 }
示例#2
0
        /// <summary>
        /// TSSuperTrend Indicator developed by TradingStudies.com (Version 2.5)
        /// </summary>
        /// <returns></returns>
        public Indicator.TSSuperTrend TSSuperTrend(Data.IDataSeries input, int length, MovingAverageType maType, double multiplier, int smooth, SuperTrendMode stMode)
        {
            if (InInitialize && input == null)
                throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");

            return _indicator.TSSuperTrend(input, length, maType, multiplier, smooth, stMode);
        }
示例#3
0
 public Indicator.TSSuperTrend TSSuperTrend(int length, MovingAverageType maType, double multiplier, int smooth, SuperTrendMode stMode)
 {
     return _indicator.TSSuperTrend(Input, length, maType, multiplier, smooth, stMode);
 }
示例#4
0
        /// <summary>
        /// TSSuperTrend Indicator developed by TradingStudies.com (Version 2.5)
        /// </summary>
        /// <returns></returns>
        public TSSuperTrend TSSuperTrend(Data.IDataSeries input, int length, MovingAverageType maType, double multiplier, int smooth, SuperTrendMode stMode)
        {
            if (cacheTSSuperTrend != null)
                for (int idx = 0; idx < cacheTSSuperTrend.Length; idx++)
                    if (cacheTSSuperTrend[idx].Length == length && cacheTSSuperTrend[idx].MaType == maType && Math.Abs(cacheTSSuperTrend[idx].Multiplier - multiplier) <= double.Epsilon && cacheTSSuperTrend[idx].Smooth == smooth && cacheTSSuperTrend[idx].StMode == stMode && cacheTSSuperTrend[idx].EqualsInput(input))
                        return cacheTSSuperTrend[idx];

            lock (checkTSSuperTrend)
            {
                checkTSSuperTrend.Length = length;
                length = checkTSSuperTrend.Length;
                checkTSSuperTrend.MaType = maType;
                maType = checkTSSuperTrend.MaType;
                checkTSSuperTrend.Multiplier = multiplier;
                multiplier = checkTSSuperTrend.Multiplier;
                checkTSSuperTrend.Smooth = smooth;
                smooth = checkTSSuperTrend.Smooth;
                checkTSSuperTrend.StMode = stMode;
                stMode = checkTSSuperTrend.StMode;

                if (cacheTSSuperTrend != null)
                    for (int idx = 0; idx < cacheTSSuperTrend.Length; idx++)
                        if (cacheTSSuperTrend[idx].Length == length && cacheTSSuperTrend[idx].MaType == maType && Math.Abs(cacheTSSuperTrend[idx].Multiplier - multiplier) <= double.Epsilon && cacheTSSuperTrend[idx].Smooth == smooth && cacheTSSuperTrend[idx].StMode == stMode && cacheTSSuperTrend[idx].EqualsInput(input))
                            return cacheTSSuperTrend[idx];

                TSSuperTrend indicator = new TSSuperTrend();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.Length = length;
                indicator.MaType = maType;
                indicator.Multiplier = multiplier;
                indicator.Smooth = smooth;
                indicator.StMode = stMode;
                Indicators.Add(indicator);
                indicator.SetUp();

                TSSuperTrend[] tmp = new TSSuperTrend[cacheTSSuperTrend == null ? 1 : cacheTSSuperTrend.Length + 1];
                if (cacheTSSuperTrend != null)
                    cacheTSSuperTrend.CopyTo(tmp, 0);
                tmp[tmp.Length - 1] = indicator;
                cacheTSSuperTrend = tmp;
                return indicator;
            }
        }
示例#5
0
        /// <summary>
        /// TSSuperTrend Indicator developed by TradingStudies.com (Vertsion 2.3)
        /// </summary>
        /// <returns></returns>
        public Indicator.TSSuperTrend TSSuperTrend(Data.IDataSeries input, int length, MovingAverageType maType, double multiplier, int smooth, SuperTrendMode stMode)
        {
            if (InInitialize && input == null)
                throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");

            return _indicator.TSSuperTrend(input, length, maType, multiplier, smooth, stMode);
        }
示例#6
0
 public Indicator.TSSuperTrend TSSuperTrend(int length, MovingAverageType maType, double multiplier, int smooth, SuperTrendMode stMode)
 {
     return _indicator.TSSuperTrend(Input, length, maType, multiplier, smooth, stMode);
 }
示例#7
0
        /// <summary>
        /// TSSuperTrend Indicator developed by TradingStudies.com (Vertsion 2.3)
        /// </summary>
        /// <returns></returns>
        public TSSuperTrend TSSuperTrend(Data.IDataSeries input, int length, MovingAverageType maType, double multiplier, int smooth, SuperTrendMode stMode)
        {
            if (cacheTSSuperTrend != null)
                for (int idx = 0; idx < cacheTSSuperTrend.Length; idx++)
                    if (cacheTSSuperTrend[idx].Length == length && cacheTSSuperTrend[idx].MaType == maType && Math.Abs(cacheTSSuperTrend[idx].Multiplier - multiplier) <= double.Epsilon && cacheTSSuperTrend[idx].Smooth == smooth && cacheTSSuperTrend[idx].StMode == stMode && cacheTSSuperTrend[idx].EqualsInput(input))
                        return cacheTSSuperTrend[idx];

            lock (checkTSSuperTrend)
            {
                checkTSSuperTrend.Length = length;
                length = checkTSSuperTrend.Length;
                checkTSSuperTrend.MaType = maType;
                maType = checkTSSuperTrend.MaType;
                checkTSSuperTrend.Multiplier = multiplier;
                multiplier = checkTSSuperTrend.Multiplier;
                checkTSSuperTrend.Smooth = smooth;
                smooth = checkTSSuperTrend.Smooth;
                checkTSSuperTrend.StMode = stMode;
                stMode = checkTSSuperTrend.StMode;

                if (cacheTSSuperTrend != null)
                    for (int idx = 0; idx < cacheTSSuperTrend.Length; idx++)
                        if (cacheTSSuperTrend[idx].Length == length && cacheTSSuperTrend[idx].MaType == maType && Math.Abs(cacheTSSuperTrend[idx].Multiplier - multiplier) <= double.Epsilon && cacheTSSuperTrend[idx].Smooth == smooth && cacheTSSuperTrend[idx].StMode == stMode && cacheTSSuperTrend[idx].EqualsInput(input))
                            return cacheTSSuperTrend[idx];

                TSSuperTrend indicator = new TSSuperTrend();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.Length = length;
                indicator.MaType = maType;
                indicator.Multiplier = multiplier;
                indicator.Smooth = smooth;
                indicator.StMode = stMode;
                Indicators.Add(indicator);
                indicator.SetUp();

                TSSuperTrend[] tmp = new TSSuperTrend[cacheTSSuperTrend == null ? 1 : cacheTSSuperTrend.Length + 1];
                if (cacheTSSuperTrend != null)
                    cacheTSSuperTrend.CopyTo(tmp, 0);
                tmp[tmp.Length - 1] = indicator;
                cacheTSSuperTrend = tmp;
                return indicator;
            }
        }
示例#8
0
 public Indicators.TSSuperTrend TSSuperTrend(ISeries <double> input, SuperTrendMode stMode, MovingAverageType maType, int length, double multiplier, int smooth, bool showIndicator, bool showArrows, bool colorBars, bool playAlert)
 {
     return(indicator.TSSuperTrend(input, stMode, maType, length, multiplier, smooth, showIndicator, showArrows, colorBars, playAlert));
 }