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

C# IDataSet类代码示例

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

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



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

示例1: Calculate

        public override void Calculate(IDataSet dataSet)
        {
            DataSet = dataSet;

            // Calculation
            var adClosePrice = new double[Bars];

            for (int bar = 1; bar < Bars; bar++)
                if (Time[bar - 1].Day != Time[bar].Day)
                    adClosePrice[bar - 1] = Close[bar - 1];

            // Check the last bar
            TimeSpan tsBarClosing = Time[Bars - 1].TimeOfDay.Add(new TimeSpan(0, (int) Period, 0));
            var tsDayClosing = new TimeSpan(24, 0, 0);
            if (tsBarClosing == tsDayClosing)
                adClosePrice[Bars - 1] = Close[Bars - 1];

            // Saving the components
            Component = new IndicatorComp[1];

            Component[0] = new IndicatorComp
                {
                    CompName = "Closing price of the day",
                    DataType = IndComponentType.ClosePrice,
                    ChartType = IndChartType.NoChart,
                    FirstBar = 2,
                    Value = adClosePrice
                };
        }
开发者ID:kevinegstorf,项目名称:Forex-Strategy-Builder,代码行数:29,代码来源:DayClosing.cs


示例2: Create

 // single layer network
 public static NeuralNetwork<Vector> Create(IDataSet<Vector, Vector> dataSet, IActivator activator)
 {
     var workLayer = new FullyConnectedLayer(dataSet.FirstInput.Size, dataSet.FirstOutput.Size, activator);
     var outputLayer = new OutputLayer<Vector>();
     var layers = new CompositeLayer<Vector, Vector, Vector>(workLayer, outputLayer);
     return new NeuralNetwork<Vector>(layers);
 }
开发者ID:pxqr,项目名称:nanon,代码行数:8,代码来源:NetworkBuilder.cs


示例3: Calculate

        public override void Calculate(IDataSet dataSet)
        {
            DataSet = dataSet;

            // Reading the parameters
            var price = (BasePrice) IndParam.ListParam[1].Index;
            double margin = IndParam.NumParam[0].Value*Point;
            int prvs = IndParam.CheckParam[0].Checked ? 1 : 0;

            // TimeExecution
            if (price == BasePrice.Open && Math.Abs(margin - 0) < Epsilon)
                IndParam.ExecutionTime = ExecutionTime.AtBarOpening;
            else if (price == BasePrice.Close && Math.Abs(margin - 0) < Epsilon)
                IndParam.ExecutionTime = ExecutionTime.AtBarClosing;

            // Calculation
            double[] adBasePr = Price(price);
            var adUpBand = new double[Bars];
            var adDnBand = new double[Bars];

            int firstBar = 1 + prvs;

            for (int iBar = firstBar; iBar < Bars; iBar++)
            {
                adUpBand[iBar] = adBasePr[iBar - prvs] + margin;
                adDnBand[iBar] = adBasePr[iBar - prvs] - margin;
            }

            // Saving the components
            Component = new IndicatorComp[2];

            Component[0] = new IndicatorComp
                {
                    CompName = "Up Price",
                    ChartType = IndChartType.NoChart,
                    FirstBar = firstBar,
                    Value = adUpBand
                };

            Component[1] = new IndicatorComp
                {
                    CompName = "Down Price",
                    ChartType = IndChartType.NoChart,
                    FirstBar = firstBar,
                    Value = adDnBand
                };

            switch (IndParam.ListParam[0].Text)
            {
                case "Enter long after an upward move":
                    Component[0].DataType = IndComponentType.OpenLongPrice;
                    Component[1].DataType = IndComponentType.OpenShortPrice;
                    break;

                case "Enter long after a downward move":
                    Component[0].DataType = IndComponentType.OpenShortPrice;
                    Component[1].DataType = IndComponentType.OpenLongPrice;
                    break;
            }
        }
开发者ID:edisonh,项目名称:Forex-Strategy-Trader,代码行数:60,代码来源:PriceMove.cs


示例4: RowIndex

 public RowIndex(int index, IDataSet mainContainer = null, IRowIndex parent = null)
 {
     Index = index;
     Parent = parent;
     MainContainer = mainContainer;
     Weight = 1.0;
 }
开发者ID:romotchka,项目名称:BabelMeta,代码行数:7,代码来源:RowIndex.cs


示例5: TestIndicator

        private void TestIndicator(IIndicator indicator, SlotTypes slotType, IDataSet dataSet, Random random)
        {
            indicator.Initialize(slotType);

            // List parameters
            foreach (ListParam list in indicator.IndParam.ListParam)
                if (list.Enabled)
                {
                    list.Index = random.Next(list.ItemList.Length);
                    list.Text = list.ItemList[list.Index];
                }

            // Numeric parameters
            foreach (NumericParam num in indicator.IndParam.NumParam)
                if (num.Enabled)
                {
                    double step = Math.Pow(10, -num.Point);
                    double minimum = num.Min;
                    double maximum = num.Max;
                    double value = minimum + step * random.Next((int)((maximum - minimum) / step));
                    num.Value = Math.Round(value, num.Point);
                }

            indicator.Calculate(dataSet);
        }
开发者ID:dsimba,项目名称:FSB_Pro_Indicators,代码行数:25,代码来源:IndicatorTester.cs


示例6: LogisticRegressionClassifierTraining

        public LogisticRegressionClassifierTraining(int featuresCount, double regularizationParameter, IDataSet<bool, double> dataSet)
        {
            if (featuresCount <= 0)
            {
                throw new ArgumentOutOfRangeException("featuresCount", featuresCount, "Features count must be positive number.");
            }

            if (regularizationParameter < 0)
            {
                throw new ArgumentOutOfRangeException("regularizationParameter", regularizationParameter, "Regularization parameter must be non negative number.");
            }

            if (dataSet == null)
            {
                throw new ArgumentNullException("dataSet");
            }

            this.featuresCount = featuresCount;
            this.regularizationParameter = regularizationParameter;
            this.dataSet = dataSet;
            this.samplesCount = dataSet.GetTrainingSamplesCount();
            if (this.samplesCount <= 0)
            {
                throw new ArgumentOutOfRangeException("dataSet.GetTrainingSamplesCount()", this.samplesCount, "Samples count must be positive integer.");
            }
        }
开发者ID:yonglehou,项目名称:MachineLearning.NET,代码行数:26,代码来源:LogisticRegressionClassifierTraining.cs


示例7: Calculate

        public override void Calculate(IDataSet dataSet)
        {
            DataSet = dataSet;

            // Calculation
            const int firstBar = 2;
            var adIb = new double[Bars];

            for (int iBar = 2; iBar < Bars; iBar++)
            {
                adIb[iBar] = ((High[iBar - 1] < High[iBar - 2]) && (Low[iBar - 1] > Low[iBar - 2])) ? 1 : 0;
            }

            // Saving the components
            Component = new IndicatorComp[2];

            Component[0] = new IndicatorComp
                {
                    CompName = "Allow long entry",
                    DataType = IndComponentType.AllowOpenLong,
                    ChartType = IndChartType.NoChart,
                    FirstBar = firstBar,
                    Value = adIb
                };

            Component[1] = new IndicatorComp
                {
                    CompName = "Allow short entry",
                    DataType = IndComponentType.AllowOpenShort,
                    ChartType = IndChartType.NoChart,
                    FirstBar = firstBar,
                    Value = adIb
                };
        }
开发者ID:kevinegstorf,项目名称:Forex-Strategy-Builder,代码行数:34,代码来源:InsideBar.cs


示例8: Calculate

        public override void Calculate(IDataSet dataSet)
        {
            DataSet = dataSet;

            if (!IsBacktester)
            {
                // FST sends the N bars for exit to the expert. Expert watches the position and closes it.
                return;
            }

            var nExit = (int) IndParam.NumParam[0].Value;

            // Saving the components
            Component = new IndicatorComp[1];

            Component[0] = new IndicatorComp
                {
                    CompName = "N Bars Exit (" + nExit.ToString(CultureInfo.InvariantCulture) + ")",
                    DataType = IndComponentType.ForceClose,
                    ChartType = IndChartType.NoChart,
                    ShowInDynInfo = true,
                    FirstBar = 1,
                    Value = new double[Bars]
                };
        }
开发者ID:edisonh,项目名称:Forex-Strategy-Trader,代码行数:25,代码来源:NBarsExit.cs


示例9: Calculate

        public override void Calculate(IDataSet dataSet)
        {
            DataSet = dataSet;

            // Reading the parameters
            var entryHour = (int) IndParam.NumParam[0].Value;
            var entryMinute = (int) IndParam.NumParam[1].Value;
            var entryTime = new TimeSpan(entryHour, entryMinute, 0);

            // Calculation
            const int firstBar = 1;
            var adBars = new double[Bars];

            // Calculation of the logic
            for (int bar = firstBar; bar < Bars; bar++)
            {
                adBars[bar] = Time[bar].TimeOfDay == entryTime ? Open[bar] : 0;
            }

            // Saving the components
            Component = new IndicatorComp[1];

            Component[0] = new IndicatorComp
                {
                    CompName = "Entry hour",
                    DataType = IndComponentType.OpenPrice,
                    ChartType = IndChartType.NoChart,
                    ShowInDynInfo = false,
                    FirstBar = firstBar,
                    Value = adBars
                };
        }
开发者ID:kevinegstorf,项目名称:Forex-Strategy-Builder,代码行数:32,代码来源:EntryHour.cs


示例10: NormalizeComponents

 /// <summary>
 ///     Converts indicator components to strategy data set time.
 /// </summary>
 public void NormalizeComponents(IDataSet strategyDataSet)
 {
     foreach (IndicatorComp indicatorComp in Component)
     {
         indicatorComp.Value = NormalizeComponentValue(indicatorComp.Value, strategyDataSet.Time);
         indicatorComp.FirstBar = NormalizeComponentFirstBar(indicatorComp.FirstBar, strategyDataSet.Time);
     }
 }
开发者ID:dsimba,项目名称:FSB_Pro_Indicators,代码行数:11,代码来源:IndicatorBaseCalc.cs


示例11: Calculate

        public override void Calculate(IDataSet dataSet)
        {
            DataSet = dataSet;

            if (IsBacktester)
                CalculateForBacktester();
            else
                CalculateForTrader();
        }
开发者ID:jorgealvarado212,项目名称:Forex-Strategy-Builder,代码行数:9,代码来源:DayClosing2.cs


示例12: RemoveRatings

		///
		public virtual void RemoveRatings(IDataSet ratings_to_delete)
		{
			for (int i = 0; i < ratings_to_delete.Count; i++)
			{
				int index;
				if (Ratings.TryGetIndex(ratings_to_delete.Users[i], ratings_to_delete.Items[i], out index))
					Ratings.RemoveAt(index);
			}
		}
开发者ID:WisonHuang,项目名称:MyMediaLite,代码行数:10,代码来源:IncrementalRatingPredictor.cs


示例13: Calculate

        public override void Calculate(IDataSet dataSet)
        {
            DataSet = dataSet;

            // Reading the parameters
            var fromHour = (int) IndParam.NumParam[0].Value;
            var fromMin = (int) IndParam.NumParam[1].Value;
            var untilHour = (int) IndParam.NumParam[2].Value;
            var untilMin = (int) IndParam.NumParam[3].Value;
            var fromTime = new TimeSpan(fromHour, fromMin, 0);
            var untilTime = new TimeSpan(untilHour, untilMin, 0);

            // Calculation
            const int firstBar = 1;
            var adBars = new double[Bars];

            // Calculation of the logic
            for (int bar = firstBar; bar < Bars; bar++)
            {
                if (fromTime < untilTime)
                    adBars[bar] = Time[bar].TimeOfDay >= fromTime &&
                                  Time[bar].TimeOfDay < untilTime
                                      ? 1
                                      : 0;
                else if (fromTime > untilTime)
                    adBars[bar] = Time[bar].TimeOfDay >= fromTime ||
                                  Time[bar].TimeOfDay < untilTime
                                      ? 1
                                      : 0;
                else
                    adBars[bar] = 1;
            }

            // Saving the components
            Component = new IndicatorComp[2];

            Component[0] = new IndicatorComp
                {
                    CompName = "Is long entry allowed",
                    DataType = IndComponentType.AllowOpenLong,
                    ChartType = IndChartType.NoChart,
                    ShowInDynInfo = false,
                    FirstBar = firstBar,
                    Value = adBars
                };

            Component[1] = new IndicatorComp
                {
                    CompName = "Is short entry allowed",
                    DataType = IndComponentType.AllowOpenShort,
                    ChartType = IndChartType.NoChart,
                    ShowInDynInfo = false,
                    FirstBar = firstBar,
                    Value = adBars
                };
        }
开发者ID:edisonh,项目名称:Forex-Strategy-Trader,代码行数:56,代码来源:EntryTime.cs


示例14: AddDataSet

        /// <summary>
        /// Adds a data set to the aggregate.
        /// </summary>
        /// <param name="dataSet">The data set to add.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="dataSet"/> is null.</exception>
        /// <exception cref="ArgumentException">Thrown if <paramref name="dataSet"/> is already a member of this aggregate.</exception>
        public virtual void AddDataSet(IDataSet dataSet)
        {
            if (dataSet == null)
                throw new ArgumentNullException("dataSet");

            if (dataSets == null)
                dataSets = new List<IDataSet>();
            else if (dataSets.Contains(dataSet))
                throw new ArgumentException("The data set is already a member of the aggregate.", "dataSet");

            dataSets.Add(dataSet);
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:18,代码来源:AggregateDataSet.cs


示例15: CalculateIndicatorWithRandomParameters

 public void CalculateIndicatorWithRandomParameters(IIndicator indicator, IDataSet dataSet, int testPerSlot)
 {
     Random random = new Random(DateTime.Now.Second);
     var types = (SlotTypes[])Enum.GetValues(typeof(SlotTypes));
     foreach (var type in types)
         if (indicator.TestPossibleSlot(type))
             for (int i = 0; i < testPerSlot; i++)
             {
                 TestIndicator(indicator, type, dataSet, random);
                 ShowResult(indicator);
             }
 }
开发者ID:dsimba,项目名称:FSB_Pro_Indicators,代码行数:12,代码来源:IndicatorTester.cs


示例16: Calculate

        public override void Calculate(IDataSet dataSet)
        {
            DataSet = dataSet;

            // Reading the parameters
            var dowFromDay = (DayOfWeek) IndParam.ListParam[1].Index;
            var dowUntilDay = (DayOfWeek) IndParam.ListParam[2].Index;

            // Calculation
            const int firstBar = 1;
            var signal = new double[Bars];

            // Calculation of the logic
            for (int bar = firstBar; bar < Bars; bar++)
            {
                if (dowFromDay < dowUntilDay)
                    signal[bar] = Time[bar].DayOfWeek >= dowFromDay &&
                                  Time[bar].DayOfWeek < dowUntilDay
                        ? 1
                        : 0;
                else if (dowFromDay > dowUntilDay)
                    signal[bar] = Time[bar].DayOfWeek >= dowFromDay ||
                                  Time[bar].DayOfWeek < dowUntilDay
                        ? 1
                        : 0;
                else
                    signal[bar] = 1;
            }

            // Saving the components
            Component = new IndicatorComp[2];

            Component[0] = new IndicatorComp
            {
                CompName = "Allow long entry",
                DataType = IndComponentType.AllowOpenLong,
                ChartType = IndChartType.NoChart,
                ShowInDynInfo = false,
                FirstBar = firstBar,
                Value = signal
            };

            Component[1] = new IndicatorComp
            {
                CompName = "Allow short entry",
                DataType = IndComponentType.AllowOpenShort,
                ChartType = IndChartType.NoChart,
                ShowInDynInfo = false,
                FirstBar = firstBar,
                Value = signal
            };
        }
开发者ID:dsimba,项目名称:FSB_Pro_Indicators,代码行数:52,代码来源:DaysOfWeek.cs


示例17: TestPivotTableQuery

        private void TestPivotTableQuery(IDataSet dataset, int expected)
        {
            var settings = new QuerySettings();
            var queryParams = new QueryParams()
            {
                filter = new Dictionary<string, string>(),
                valueFields = new List<string>() { "Sales", "Profit" },
                nextPivot = "Province"
            };

            var queryResults = dataset.Query(queryParams, settings);
            Assert.AreEqual(queryResults.Count, expected);
        }
开发者ID:joelhoro,项目名称:JHLib,代码行数:13,代码来源:PivotTableUtilsTests.cs


示例18: Calculate

        public override void Calculate(IDataSet dataSet)
        {
            DataSet = dataSet;

            // Reading the parameters
            var maMethod = (MAMethod) IndParam.ListParam[1].Index;
            var period = (int) IndParam.NumParam[0].Value;
            var multipl = (int) IndParam.NumParam[1].Value;
            int prev = IndParam.CheckParam[0].Checked ? 1 : 0;

            // Calculation
            int firstBar = period + 2;

            var atr = new double[Bars];

            for (int bar = 1; bar < Bars; bar++)
                atr[bar] = Math.Max(High[bar], Close[bar - 1]) - Math.Min(Low[bar], Close[bar - 1]);

            atr = MovingAverage(period, 0, maMethod, atr);

            var atrStop = new double[Bars];
            double pip = (Digits == 5 || Digits == 3) ? 10*Point : Point;
            double minStop = 5*pip;

            for (int bar = firstBar; bar < Bars - prev; bar++)
                atrStop[bar + prev] = Math.Max(atr[bar]*multipl, minStop);

            // Saving the components
            Component = new IndicatorComp[2];

            Component[0] = new IndicatorComp
                {
                    CompName = "ATR Stop margin",
                    DataType = IndComponentType.IndicatorValue,
                    FirstBar = firstBar,
                    ShowInDynInfo = false,
                    Value = atrStop
                };

            Component[1] = new IndicatorComp
                {
                    CompName = "ATR Stop for the transferred position",
                    DataType = IndComponentType.Other,
                    ShowInDynInfo = false,
                    FirstBar = firstBar,
                    Value = new double[Bars]
                };
        }
开发者ID:edisonh,项目名称:Forex-Strategy-Trader,代码行数:48,代码来源:AtrStop.cs


示例19: Calculate

        public override void Calculate(IDataSet dataSet)
        {
            DataSet = dataSet;

            // Saving the components
            Component = new IndicatorComp[1];

            Component[0] = new IndicatorComp
                {
                    CompName = "Opening price of the bar",
                    DataType = IndComponentType.OpenPrice,
                    ChartType = IndChartType.NoChart,
                    FirstBar = 2,
                    Value = Open
                };
        }
开发者ID:edisonh,项目名称:Forex-Strategy-Trader,代码行数:16,代码来源:BarOpening.cs


示例20: Calculate

        public override void Calculate(IDataSet dataSet)
        {
            DataSet = dataSet;

            // Saving the components
            Component = new IndicatorComp[1];

            Component[0] = new IndicatorComp
                {
                    CompName = "Close Price",
                    DataType = (IndParam.SlotType == SlotTypes.Open) ? IndComponentType.OpenPrice : IndComponentType.ClosePrice,
                    ChartType = IndChartType.NoChart,
                    FirstBar = 2,
                    Value = Close
                };
        }
开发者ID:edisonh,项目名称:Forex-Strategy-Trader,代码行数:16,代码来源:BarClosing.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IDataSource类代码示例发布时间:2022-05-24
下一篇:
C# IDataService类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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