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


C# Entities.IndicatorComp类代码示例

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


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

示例1: 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:jagatfx,项目名称:Forex-Strategy-Trader,代码行数:32,代码来源:EntryHour.cs

示例2: 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

示例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: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: Calculate

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

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

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

示例10: 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

示例11: 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

示例12: Calculate

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

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

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

            Component[1] = new IndicatorComp
                {
                    CompName = "Is short entry allowed",
                    DataType = IndComponentType.AllowOpenShort,
                    ChartType = IndChartType.NoChart,
                    FirstBar = 0,
                    Value = new double[Bars]
                };

            // Calculation of the logic
            switch (IndParam.ListParam[0].Text)
            {
                case "Open long positions only":
                    for (int i = 0; i < Bars; i++)
                    {
                        Component[0].Value[i] = 1;
                        Component[1].Value[i] = 0;
                    }
                    break;

                case "Open short positions only":
                    for (int i = 0; i < Bars; i++)
                    {
                        Component[0].Value[i] = 0;
                        Component[1].Value[i] = 1;
                    }
                    break;
            }
        }
开发者ID:jorgealvarado212,项目名称:Forex-Strategy-Builder,代码行数:45,代码来源:LongOrShort.cs

示例13: Calculate

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

            // Reading the parameters
            int hour = (int) IndParam.NumParam[0].Value;
            int minute = (int) IndParam.NumParam[1].Value;

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

            // Calculation of the logic
            for (int bar = firstBar; bar < Bars; bar++)
            {
                DateTime closeTime = Time[bar].AddMinutes((int) Period);
                if (closeTime.Hour == hour && closeTime.Minute == minute)
                    signal[bar] = 1;
            }

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

            Component[0] = new IndicatorComp
            {
                CompName = "Close out long position",
                DataType = IndComponentType.ForceCloseLong,
                ChartType = IndChartType.NoChart,
                ShowInDynInfo = true,
                FirstBar = firstBar,
                Value = signal
            };

            Component[1] = new IndicatorComp
            {
                CompName = "Close out short position",
                DataType = IndComponentType.ForceCloseShort,
                ChartType = IndChartType.NoChart,
                ShowInDynInfo = true,
                FirstBar = firstBar,
                Value = signal
            };
        }
开发者ID:dsimba,项目名称:FSB_Pro_Indicators,代码行数:43,代码来源:ExitTime.cs

示例14: Calculate

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

            // Reading the parameters
            var exitHour = (int) IndParam.NumParam[0].Value;
            var tsExitHour = new TimeSpan(exitHour, 0, 0);

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

            // Calculation of the logic
            for (int bar = firstBar; bar < Bars; bar++)
            {
                if (Time[bar - 1].DayOfYear == Time[bar].DayOfYear &&
                    Time[bar - 1].TimeOfDay < tsExitHour &&
                    Time[bar].TimeOfDay >= tsExitHour)
                    adBars[bar - 1] = Close[bar - 1];
                else if (Time[bar - 1].DayOfYear != Time[bar].DayOfYear &&
                         Time[bar - 1].TimeOfDay < tsExitHour)
                    adBars[bar - 1] = Close[bar - 1];
                else
                    adBars[bar] = 0;
            }

            // Check the last bar
            if (Time[Bars - 1].TimeOfDay.Add(new TimeSpan(0, (int) Period, 0)) == tsExitHour)
                adBars[Bars - 1] = Close[Bars - 1];

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

            Component[0] = new IndicatorComp
                {
                    CompName = "Exit hour",
                    DataType = IndComponentType.ClosePrice,
                    ChartType = IndChartType.NoChart,
                    ShowInDynInfo = false,
                    FirstBar = firstBar,
                    Value = adBars
                };
        }
开发者ID:jagatfx,项目名称:Forex-Strategy-Trader,代码行数:43,代码来源:ExitHour.cs

示例15: Calculate

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

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

            for (int iBar = 1; iBar < Bars; iBar++)
                if (Time[iBar - 1].Day != Time[iBar].Day)
                    adOpenPrice[iBar] = Open[iBar];

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

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


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