• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# commonClass.DataSeries类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Fibonnanci

        public Fibonnanci(DataBars ds, double period, string name)
            : base(ds, name)
        {
            this.Name = name;

            //138.2%, 161.8%, 200% and 261.8%

            DataSeries min = Indicators.MIN.Series(ds.Low, period, "min");
            DataSeries fibo100 = Indicators.MAX.Series(ds.High, period, "max");
            DataSeries fibo23pc = new DataSeries(min, "fibo 23pc");
            DataSeries fibo38pc = new DataSeries(min, "fibo 38pc");
            DataSeries fibo50pc = new DataSeries(min, "fibo 50pc");
            DataSeries fibo62pc = new DataSeries(min, "fibo 62pc");
            DataSeries fibo138pc = new DataSeries(min, "fibo 138pc");

            fibo23pc.Name = name + "-fibo 23pc";
            fibo38pc.Name = name + "-fibo 38pc";
            fibo50pc.Name = name + "-fibo 50pc";
            fibo62pc.Name = name + "-fibo 62pc";
            fibo138pc.Name = name + "-fibo 138pc";

            fibo100.Name = name + "-fibo100";

            FirstValidValue = (int)Math.Max(0,min.Count-period-1);;
            fibo100.FirstValidValue=FirstValidValue;
            fibo23pc.FirstValidValue = FirstValidValue;
            fibo38pc.FirstValidValue=FirstValidValue;
            fibo50pc.FirstValidValue = FirstValidValue;
            fibo62pc.FirstValidValue = FirstValidValue;
            fibo138pc.FirstValidValue = FirstValidValue;

            this.Name = name;

            for (int i = FirstValidValue; i < min.Count; i++)
            {
                this[i] = min[min.Count - 1];
                fibo100[i] = fibo100[fibo100.Count - 1];
                fibo23pc[i] = min[min.Count - 1] + (fibo100[fibo100.Count - 1] - min[min.Count - 1]) * 23.6 / 100;
                fibo38pc[i] = min[min.Count - 1] + (fibo100[fibo100.Count - 1] - min[min.Count - 1])*38.2/100;
                fibo50pc[i] = min[min.Count - 1] + (fibo100[fibo100.Count - 1] - min[min.Count - 1]) * 50 / 100;
                fibo62pc[i] = min[min.Count - 1] + (fibo100[fibo100.Count - 1] - min[min.Count - 1]) * 61.8 / 100;
                fibo138pc[i] = min[min.Count - 1] + (fibo100[fibo100.Count - 1] - min[min.Count - 1]) * 138.2 / 100;
            }
            this.Cache.Add(fibo100.Name, fibo100);
            this.Cache.Add(fibo23pc.Name, fibo38pc);
            this.Cache.Add(fibo38pc.Name, fibo38pc);
            this.Cache.Add(fibo50pc.Name, fibo50pc);
            this.Cache.Add(fibo62pc.Name, fibo62pc);
            this.Cache.Add(fibo138pc.Name, fibo138pc);
        }
开发者ID:oghenez,项目名称:trade-software,代码行数:50,代码来源:Fibonnanci.cs


示例17: 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 RiskReward 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 (RiskReward)obj;

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


示例18: Series

        /// <summary>
        /// Static method to create APO DataSeries
        /// </summary>
        /// <param name="ds"></param>
        /// <param name="period"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public static APO Series(DataSeries ds, double fastperiod, double slowperiod, double matype, string name)
        {
            //Build description
            string description = "(" + name + fastperiod.ToString()+","+slowperiod.ToString()+","+matype.ToString() + ")";

            //See if it exists in the cache
            object obj = ds.Cache.Find(description);
            if (obj != null) return (APO)obj;

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


示例19: 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 LINEARREG_INTERCEPT 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 (LINEARREG_INTERCEPT)obj;

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


示例20: APO

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

            double[] output = new double[db.Count];

            switch ((int)matype)
            {
                case 0:
                    retCode = Core.Apo(0, db.Count - 1, db.Values, (int)fastperiod, (int)slowperiod, Core.MAType.Dema, out begin, out length, output);
                    break;
                case 1:
                    retCode = Core.Apo(0, db.Count - 1, db.Values, (int)fastperiod, (int)slowperiod, Core.MAType.Ema, out begin, out length, output);
                    break;
                case 2:
                    retCode = Core.Apo(0, db.Count - 1, db.Values, (int)fastperiod, (int)slowperiod, Core.MAType.Kama, out begin, out length, output);
                    break;
                case 3:
                    retCode = Core.Apo(0, db.Count - 1, db.Values, (int)fastperiod, (int)slowperiod, Core.MAType.Mama, out begin, out length, output);
                    break;
                case 4:
                    retCode = Core.Apo(0, db.Count - 1, db.Values, (int)fastperiod, (int)slowperiod, Core.MAType.Sma, out begin, out length, output);
                    break;
                case 5:
                    retCode = Core.Apo(0, db.Count - 1, db.Values, (int)fastperiod, (int)slowperiod, Core.MAType.T3, out begin, out length, output);
                    break;
                case 6:
                    retCode = Core.Apo(0, db.Count - 1, db.Values, (int)fastperiod, (int)slowperiod, Core.MAType.Tema, out begin, out length, output);
                    break;
                case 7:
                    retCode = Core.Apo(0, db.Count - 1, db.Values, (int)fastperiod, (int)slowperiod, Core.MAType.Trima, out begin, out length, output);
                    break;
                case 8:
                    retCode = Core.Apo(0, db.Count - 1, db.Values, (int)fastperiod, (int)slowperiod, Core.MAType.Wma, 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,代码行数:55,代码来源:APO.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# cs_unittest.VowpalWabbitExampleValidator类代码示例发布时间:2022-05-26
下一篇:
C# ximpleware.VTDNav类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap