当前位置: 首页>>代码示例>>C#>>正文


C# commonClass.DataSeries类代码示例

本文整理汇总了C#中commonClass.DataSeries的典型用法代码示例。如果您正苦于以下问题:C# DataSeries类的具体用法?C# DataSeries怎么用?C# DataSeries使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DataSeries类属于commonClass命名空间,在下文中一共展示了DataSeries类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: baseSMA

 protected baseSMA(DataSeries ds, Types type, double period, string name): base(ds, name)
 {
     int begin = 0, length = 0;
     Core.RetCode retCode = Core.RetCode.UnknownErr;
     double[] output = new double[ds.Count];
     switch (type)
     {
         case Types.SMA:
             retCode = Core.Sma(0, ds.Count - 1, ds.Values,(int)period, out begin, out length, output); break;
         case Types.EMA:
             retCode = Core.Ema(0, ds.Count - 1, ds.Values, (int)period, out begin, out length, output); break;
         case Types.WMA:
             retCode = Core.Wma(0, ds.Count - 1, ds.Values, (int)period, out begin, out length, output); break;
         case Types.RSI:
             retCode = Core.Rsi(0, ds.Count - 1, ds.Values, (int)period, out begin, out length, output); break;
     }
     if (retCode != Core.RetCode.Success) return;
     //Assign first bar that contains indicator data
     if (length <= 0)
         FirstValidValue = begin + output.Length + 1;
     else
         FirstValidValue = begin;
     this.Name = name;
     for (int i = begin, j = 0; j < length; i++, j++) this[i] = output[j];
 }
开发者ID:oghenez,项目名称:trade-software,代码行数:25,代码来源:indicators.cs

示例2: HT_PHASOR

        /// <summary>
        /// Calculation of Average True Range indicators
        /// </summary>
        /// <param name="ds">data to calculate HT_PHASOR</param>
        /// <param name="period">the period</param>
        /// <param name="name"></param>
        public HT_PHASOR(DataBars ds, string name)
            : base(ds, name)
        {
            int begin = 0, length = 0;
            Core.RetCode retCode = Core.RetCode.UnknownErr;

            double[] output = new double[ds.Count];
            double[] quadrature = new double[ds.Count];

            retCode = Core.HtPhasor(0, ds.Count - 1, ds.High.Values, out begin, out length, output, quadrature);

            if (retCode != Core.RetCode.Success) return;
            //Assign first bar that contains indicator data
            DataSeries quadratureSeries= new DataSeries(ds, name + "-quadrature");
            if (length <= 0)
                FirstValidValue = begin + output.Length + 1;
            else
                FirstValidValue = begin;
            quadratureSeries.FirstValidValue = FirstValidValue;

            this.Name = name;
            for (int i = begin, j = 0; j < length; i++, j++)
            {
                quadratureSeries.Values[i] = quadrature[j];
                this[i] = output[j];
            }
            this.Cache.Add(quadratureSeries.Name, quadratureSeries);
        }
开发者ID:oghenez,项目名称:trade-software,代码行数:34,代码来源:HT_PHASOR.cs

示例3: MINMAX

        /// <summary>
        /// Calculation of MINMAX indicators
        /// </summary>
        /// <param name="db">data to calculate MINMAX</param>        
        /// <param name="period">period to calculate</param>
        /// <param name="name"></param>
        public MINMAX(DataSeries db, double period, string name)
            : base(db, name)
        {
            int begin = 0, length = 0;
            Core.RetCode retCode = Core.RetCode.UnknownErr;

            double[] outmin = new double[db.Count];
            double[] outmax = new double[db.Count];


            retCode = Core.MinMax(0, db.Count - 1, db.Values, (int)period, out begin, out length, outmin, outmax);
            
            if (retCode != Core.RetCode.Success) return;
            //Assign first bar that contains indicator data
            if (length <= 0)
                FirstValidValue = begin + outmin.Length + 1;
            else
                FirstValidValue = begin;
            this.Name = name;
            DataSeries maxSeries = new DataSeries(db,name + "-max");
            maxSeries.FirstValidValue = FirstValidValue;

            for (int i = begin, j = 0; j < length; i++, j++)
            {
                this[i] = outmin[j];
                maxSeries[i] = outmax[j];
            }
            this.Cache.Add(maxSeries.Name, maxSeries);
        }
开发者ID:oghenez,项目名称:trade-software,代码行数:35,代码来源:MINMAX.cs

示例4: HTSINE

        /// <summary>
        /// Calculation of HTSINE indicators
        /// </summary>
        /// <param name="ds">data to calculate HTSINE</param>        
        /// <param name="period">period to calculate</param>
        /// <param name="name"></param>
        public HTSINE(DataSeries ds, string name)
            : base(ds, name)
        {
            int begin = 0, length = 0;
            Core.RetCode retCode = Core.RetCode.UnknownErr;

            double[] outsine = new double[ds.Count];
            double[] outleadsine = new double[ds.Count];


            retCode = Core.HtSine(0, ds.Count - 1, ds.Values, out begin, out length, outsine,outleadsine);
            
            if (retCode != Core.RetCode.Success) return;
            DataSeries leadSineSeries = new DataSeries(ds, name + "-leadSine");

            //Assign first bar that contains indicator data
            if (length <= 0)
                FirstValidValue = begin + outsine.Length + 1;
            else
                FirstValidValue = begin;

            this.Name = name;
            leadSineSeries.FirstValidValue = FirstValidValue;

            for (int i = begin, j = 0; j < length; i++, j++)
            {
                this[i] = outsine[j];
                leadSineSeries[i] = outleadsine[j];
            }
            //Cache Series
            this.Cache.Add(leadSineSeries.Name, leadSineSeries);
        }
开发者ID:oghenez,项目名称:trade-software,代码行数:38,代码来源:HTSINE.cs

示例5: findAverage

        /* Get average of a list for 0 to position
         */
        public static double findAverage(DataSeries list, int position, int number_Periods)
        {
            if (list.Count == 0 || position - number_Periods < 0) return 0;

            double average = 0;
            for (int i = position; i > position - number_Periods; i--)
                average += list[i];
            return average / number_Periods;
        }
开发者ID:oghenez,项目名称:trade-software,代码行数:11,代码来源:strategyLib.cs

示例6: isCummulativeDown

 /// <summary>
 /// Detect if there is "days" cummulative down in close price
 /// </summary>
 /// <param name="closePrice"></param>
 /// <param name="idx"></param>
 /// <param name="days"></param>
 /// <returns></returns>
 static public bool isCummulativeDown(DataSeries closePrice, int idx, int days)
 {
     for (int i = idx; i > idx - days; i--)
     {
         if (closePrice[i] > closePrice[i - 1])
             return false;
     }
     return true;
 }
开发者ID:oghenez,项目名称:trade-software,代码行数:16,代码来源:strategyLib.cs

示例7: findResistance

        /* Find the maximum value of a list, from position back to number_Periods period
         */
        public static double findResistance(DataSeries list, int position, int number_Periods)
        {
            if (list.Count == 0 || position - number_Periods < 0) return -1;

            double max = double.MinValue;
            for (int i = position; i > position - number_Periods; i--)
                if (max < list[i])
                    max = list[i];

            return max;
        }
开发者ID:oghenez,项目名称:trade-software,代码行数:13,代码来源:strategyLib.cs

示例8: findSupport

        /* Find the minimum value of a list, from position back to number_Periods period
         */
        public static double findSupport(DataSeries list, int position, int number_Periods)
        {
            if (list.Count == 0 || position - number_Periods < 0) return -1;

            double min = double.MaxValue;
            for (int i = position; i > position - number_Periods; i--)
                if (min > list[i])
                    min = list[i];    
                
            return min;
        }
开发者ID:oghenez,项目名称:trade-software,代码行数:13,代码来源:strategyLib.cs

示例9: Series

        public static SRChannel Series(DataSeries ds, double period, string name)
        {
            //Build description
            string description = "(" + name + "," + period.ToString() + ")";
            //See if it exists in the cache
            object obj = ds.Cache.Find(description);
            if (obj != null) return (SRChannel)obj;

            SRChannel indicator = new SRChannel(ds, period, description);
            ds.Cache.Add(description, indicator);
            return indicator;
        }
开发者ID:oghenez,项目名称:trade-software,代码行数:12,代码来源:SRChannel.cs

示例10: Series

 protected static baseSMA Series(DataSeries ds, Types type, double period, string name)
 {
     //Build description
     string description = "(" + name + "," + period + ")";
     //See if it exists in the cache
     object obj = ds.Cache.Find(description);
     if (obj!=null) return (baseSMA)obj;
     //Create SMA, cache it, return it
     baseSMA sma = new baseSMA(ds, type, period, description);
     ds.Cache.Add(description,sma);
     return sma;
 }
开发者ID:oghenez,项目名称:trade-software,代码行数:12,代码来源:indicators.cs

示例11: Series

        /// <summary>
        /// Static method to create Arron DataSeries
        /// </summary>
        /// <param name="ds"></param>
        /// <param name="period"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public static ROCR100 Series(DataSeries ds, double period, string name)
        {
            //Build description
            string description = "(" + name + period.ToString() + ")";
            //See if it exists in the cache
            object obj = ds.Cache.Find(description);
            if (obj != null) return (ROCR100)obj;

            //Create indicator, cache it, return it
            ROCR100 indicator = new ROCR100(ds, period, description);
            ds.Cache.Add(description, indicator);
            return indicator;  
        }
开发者ID:oghenez,项目名称:trade-software,代码行数:20,代码来源:ROCR100.cs

示例12: Series

        /// <summary>
        /// Static method to create Arron DataSeries
        /// </summary>
        /// <param name="ds"></param>
        /// <param name="period"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public static HT_TRENDLINE Series(DataSeries ds,  string name)
        {
            //Build description
            string description = "(" + name + ")";
            //See if it exists in the cache
            object obj = ds.Cache.Find(description);
            if (obj != null) return (HT_TRENDLINE)obj;

            //Create indicator, cache it, return it
            HT_TRENDLINE indicator = new HT_TRENDLINE(ds, description);
            ds.Cache.Add(description, indicator);
            return indicator;
        }
开发者ID:oghenez,项目名称:trade-software,代码行数:20,代码来源:HT_TRENDLINE.cs

示例13: Series

        /// <summary>
        /// Static method to create Arron DataSeries
        /// </summary>
        /// <param name="ds"></param>
        /// <param name="period"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public static STDDEV Series(DataSeries ds, double period,double optInNbDev, string name)
        {
            //Build description
            string description = "(" + name + period.ToString() + ")";
            //See if it exists in the cache
            object obj = ds.Cache.Find(description);
            if (obj != null) return (STDDEV)obj;

            //Create indicator, cache it, return it
            STDDEV indicator = new STDDEV(ds, period, optInNbDev, description);
            ds.Cache.Add(description, indicator);
            return indicator;
        }
开发者ID:oghenez,项目名称:trade-software,代码行数:20,代码来源:STDDEV.cs

示例14: Series

        /// <summary>
        /// Static method to create Thrust DataSeries
        /// </summary>
        /// <param name="ds"></param>
        /// <param name="period"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public static Market_TRIN Series(DataSeries ds, string name)
        {
            //Build description
            string description = "(" + name + ")";
            //See if it exists in the cache
            object obj = ds.Cache.Find(description);
            if (obj != null) return (Market_TRIN)obj;

            //Create indicator, cache it, return it
            Market_TRIN indicator = new Market_TRIN(ds, description);
            ds.Cache.Add(description, indicator);
            return indicator;
        }
开发者ID:oghenez,项目名称:trade-software,代码行数:20,代码来源:MarketIndicators.cs

示例15: MakeData

 private static commonClass.DataSeries MakeData(databases.tmpDS.marketDataDataTable dataTbl, DataFields type)
 {
     commonClass.DataSeries ds = new commonClass.DataSeries();
     switch (type)
     {
         case DataFields.Count:
             for (int idx = 0; idx < dataTbl.Count; idx++) ds.Add(dataTbl[idx].val0); break;
         case DataFields.Volume:
             for (int idx = 0; idx < dataTbl.Count; idx++) ds.Add(dataTbl[idx].val1); break;
         case DataFields.DateTime:
             for (int idx = 0; idx < dataTbl.Count; idx++) ds.Add(dataTbl[idx].onDate.ToOADate()); break;
     }
     return ds;
 }
开发者ID:oghenez,项目名称:trade-software,代码行数:14,代码来源:dataClass.cs


注:本文中的commonClass.DataSeries类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。