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


C# StockSerie.GetSerie方法代码示例

本文整理汇总了C#中StockSerie.GetSerie方法的典型用法代码示例。如果您正苦于以下问题:C# StockSerie.GetSerie方法的具体用法?C# StockSerie.GetSerie怎么用?C# StockSerie.GetSerie使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StockSerie的用法示例。


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

示例1: Initialise

 public void Initialise(StockSerie serie)
 {
     this.stockSerie = serie;
     this.lowSerie = stockSerie.GetSerie(StockDataType.LOW);
     this.highSerie = stockSerie.GetSerie(StockDataType.HIGH);
     this.closeSerie = stockSerie.GetSerie(StockDataType.CLOSE);
 }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:7,代码来源:StockMoneyManagementBase.cs

示例2: ApplyTo

        public override void ApplyTo(StockSerie stockSerie)
        {
            this.CreateEventSeries(stockSerie.Count);

             FloatSerie closeSerie = stockSerie.GetSerie(StockDataType.CLOSE).CalculateEMA((int)this.parameters[1]);
             FloatSerie highSerie = stockSerie.GetSerie(StockDataType.HIGH);
             FloatSerie lowSerie = stockSerie.GetSerie(StockDataType.LOW);
             FloatSerie hlSerie= new FloatSerie(stockSerie.Count, this.SerieNames[0]);
             this.Series[0] = hlSerie;

             int period = (int)this.parameters[0];

             float min, max;
             for (int i = 0; i < period; i++)
             {
            min = lowSerie.GetMin(0, i);
            max = highSerie.GetMax(0, i);
            hlSerie[i] = (min + max)/2f;
             }
             for (int i = period; i < stockSerie.Count; i++)
             {
            min = lowSerie.GetMin(i-period, i);
            max = highSerie.GetMax(i - period, i);
            hlSerie[i] = (min + max)/2f;
             }

             // Detecting events
             this.CreateEventSeries(stockSerie.Count);
             for (int i = 2; i < hlSerie.Count; i++)
             {
            this.eventSeries[0][i] = (hlSerie[i - 2] > hlSerie[i - 1] && hlSerie[i - 1] < hlSerie[i]);
            this.eventSeries[1][i] = (hlSerie[i - 2] < hlSerie[i - 1] && hlSerie[i - 1] > hlSerie[i]);
            this.eventSeries[2][i] = closeSerie[i - 1] < hlSerie[i - 1] && closeSerie[i] > hlSerie[i];
            this.eventSeries[3][i] = closeSerie[i - 1] > hlSerie[i - 1] && closeSerie[i] < hlSerie[i];
            this.eventSeries[4][i] = lowSerie[i] > hlSerie[i] && lowSerie[i - 1] < hlSerie[i - 1];
            this.eventSeries[5][i] = highSerie[i] < hlSerie[i] && highSerie[i - 1] > hlSerie[i - 1];
            this.eventSeries[6][i] = lowSerie[i] > hlSerie[i] && closeSerie[i - 1] < closeSerie[i];
            this.eventSeries[7][i] = highSerie[i] < hlSerie[i] && closeSerie[i - 1] > closeSerie[i];
            if (this.eventSeries[8][i - 1])
            {
               // Check if BullRun Persists
               this.eventSeries[8][i] = !this.eventSeries[5][i];
            }
            else
            {
               // Check if BullRun Starts
               this.eventSeries[8][i] = this.eventSeries[4][i];
            }
            if (this.eventSeries[9][i - 1])
            {
               // Check if BearRun Persists
               this.eventSeries[9][i] = !this.eventSeries[4][i];
            }
            else
            {
               // Check if BearRun Starts
               this.eventSeries[9][i] = this.eventSeries[5][i];
            }
             }
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:60,代码来源:StockIndicator_HLAVG.cs

示例3: ApplyTo

        public override void ApplyTo(StockSerie stockSerie)
        {
            FloatSerie closeSerie = stockSerie.GetSerie(StockDataType.CLOSE);
             FloatSerie highSerie = stockSerie.GetSerie(StockDataType.HIGH);
             FloatSerie lowSerie = stockSerie.GetSerie(StockDataType.LOW);
             int fastPeriod = (int)this.parameters[0];
             int slowPeriod = (int)this.parameters[1];
             FloatSerie maSerie = closeSerie.CalculateKEMA(fastPeriod, slowPeriod);
             this.series[0] = maSerie;
             this.series[0].Name = this.Name;

             // Detecting events
             this.CreateEventSeries(stockSerie.Count);
             for (int i = 2; i < maSerie.Count; i++)
             {
            this.eventSeries[0][i] = (maSerie[i - 2] > maSerie[i - 1] && maSerie[i - 1] < maSerie[i]);
            this.eventSeries[1][i] = (maSerie[i - 2] < maSerie[i - 1] && maSerie[i - 1] > maSerie[i]);
            this.eventSeries[2][i] = closeSerie[i-1] < maSerie[i-1] && closeSerie[i] > maSerie[i];
            this.eventSeries[3][i] = closeSerie[i-1] > maSerie[i-1] && closeSerie[i] < maSerie[i];
            this.eventSeries[4][i] = lowSerie[i] > maSerie[i] && lowSerie[i - 1] < maSerie[i - 1];
            this.eventSeries[5][i] = highSerie[i] < maSerie[i] && highSerie[i - 1] > maSerie[i - 1];
            this.eventSeries[6][i] = lowSerie[i] > maSerie[i] && closeSerie[i - 1] < closeSerie[i];
            this.eventSeries[7][i] = highSerie[i] < maSerie[i] && closeSerie[i - 1] > closeSerie[i];
             }
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:25,代码来源:StockIndicator_KEMA.cs

示例4: ApplyTo

        public override void ApplyTo(StockSerie stockSerie)
        {
            FloatSerie lowEMASerie = stockSerie.GetIndicator(this.SerieNames[0]).Series[0];
            FloatSerie highEMASerie = stockSerie.GetIndicator(this.SerieNames[1]).Series[0];

            FloatSerie closeSerie = stockSerie.GetSerie(StockDataType.CLOSE);
            FloatSerie highSerie = stockSerie.GetSerie(StockDataType.HIGH);
            FloatSerie lowSerie = stockSerie.GetSerie(StockDataType.LOW);

            this.Series[0] = lowEMASerie;
            this.Series[1] = highEMASerie;

            // Detecting events
            this.CreateEventSeries(stockSerie.Count);

            for (int i = (int)this.parameters[0]; i < stockSerie.Count; i++)
            {
                if (lowSerie[i] > highEMASerie[i])
                {
                    this.Events[0][i] = true;
                    if (!this.Events[0][i-1])
                        this.Events[2][i] = true;
                }
                else if (highSerie[i] < lowEMASerie[i])
                {
                    this.Events[1][i] = true;
                    if (!this.Events[1][i - 1])
                        this.Events[3][i] = true;
                }
                else
                {
                    this.Events[4][i] = true;
                }
            }
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:35,代码来源:StockIndicator_EMAHL.cs

示例5: Initialise

        public override void Initialise(StockSerie stockSerie, StockOrder lastBuyOrder, bool supportShortSelling)
        {
            base.Initialise(stockSerie, lastBuyOrder, supportShortSelling);

             IStockIndicator indicator = TriggerIndicator as IStockIndicator;
             middleUpBandSerie = indicator.Series[1];
             middleBandSerie = indicator.Series[2];
             middleDownBandSerie = indicator.Series[3];

             lowSerie = stockSerie.GetSerie(StockDataType.LOW);
             highSerie = stockSerie.GetSerie(StockDataType.HIGH);
             closeSerie = stockSerie.GetSerie(StockDataType.CLOSE);
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:13,代码来源:DONCHIANStrategy.cs

示例6: ApplyTo

        public override void ApplyTo(StockSerie stockSerie)
        {
            FloatSerie emaSerie = stockSerie.GetSerie(StockDataType.CLOSE).CalculateEMA((int)this.Parameters[0]);
             FloatSerie indexSerie = new FloatSerie(stockSerie.Count);

             for (int i = 1; i < stockSerie.Count; i++)
             {
            int count = 0;
            for (int j = i - 1; j >= 0; j--)
            {
               if (emaSerie[i] > emaSerie[j])
               {
                  count++;
               }
               else
               {
                  break;
               }
            }
            indexSerie[i] = count;
             }

             this.series[0] = indexSerie;
             this.Series[0].Name = this.Name;
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:25,代码来源:StockIndicator_HIGHEST.cs

示例7: ApplyTo

        public override void ApplyTo(StockSerie stockSerie)
        {
            FloatSerie highSerie = stockSerie.GetSerie(StockDataType.HIGH).CalculateEMA((int)this.Parameters[1]);
             FloatSerie lowSerie = stockSerie.GetSerie(StockDataType.LOW).CalculateEMA((int)this.Parameters[1]);
             FloatSerie closeSerie = stockSerie.GetSerie(StockDataType.CLOSE).CalculateEMA((int)this.Parameters[1]);

             FloatSerie atrSerie = new FloatSerie(stockSerie.Count);

             for (int i = 1; i < stockSerie.Count; i++)
             {
            atrSerie[i] = 100f*(highSerie[i] - lowSerie[i]) / closeSerie[i - 1];
             }

             this.series[0] = atrSerie.CalculateEMA((int)this.Parameters[0]);
             this.Series[0].Name = this.Name;
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:16,代码来源:StockIndicator_ATRPERCENT.cs

示例8: ApplyTo

        public override void ApplyTo(StockSerie stockSerie)
        {
            FloatSerie atrSerie = stockSerie.GetSerie(StockDataType.ATR).CalculateEMA((int)this.Parameters[0]);
             FloatSerie lowCloseSerie = new FloatSerie(stockSerie.Count);
             int i = 0;
             foreach (StockDailyValue dailyValue in stockSerie.Values)
             {
            lowCloseSerie[i++] = dailyValue.CLOSE - dailyValue.LOW;
             }
             lowCloseSerie = lowCloseSerie.CalculateEMA((int)this.Parameters[0]);
             lowCloseSerie = lowCloseSerie / atrSerie;
             lowCloseSerie = (lowCloseSerie * 100.0f) - 50.0f;

             this.series[0] = lowCloseSerie.CalculateEMA((int)this.Parameters[0] / 4);
             this.Series[0].Name = this.Name;
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:16,代码来源:StockIndicator_LW.cs

示例9: ApplyTo

        public override void ApplyTo(StockSerie stockSerie)
        {
            FloatSerie closeSerie = stockSerie.GetSerie(StockDataType.CLOSE);
             int period = (int)this.parameters[0];
             int iteration = (int)this.parameters[1];

             FloatSerie memaSerie = closeSerie;
             for (int i = 0; i < iteration; i++)
             {
            memaSerie = memaSerie.CalculateEMA(period);
             }
            this.series[0] = memaSerie;
             this.series[0].Name = this.Name;

             // Detecting events
             this.CreateEventSeries(stockSerie.Count);
             for (int i = 2; i < memaSerie.Count; i++)
             {
            this.eventSeries[0][i] = (memaSerie[i - 2] > memaSerie[i - 1] && memaSerie[i - 1] < memaSerie[i]);
            this.eventSeries[1][i] = (memaSerie[i - 2] < memaSerie[i - 1] && memaSerie[i - 1] > memaSerie[i]);
            this.eventSeries[2][i] = closeSerie[i] > memaSerie[i];
            this.eventSeries[3][i] = closeSerie[i] < memaSerie[i];
             }
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:24,代码来源:StockIndicator_MEMA.cs

示例10: ApplyTo

        public override void ApplyTo(StockSerie stockSerie)
        {
            FloatSerie closeSerie = stockSerie.GetSerie(StockDataType.CLOSE);
             FloatSerie rsiSerie;
             if (closeSerie.Min <= 0.0f)
             {
            rsiSerie = closeSerie.CalculateRSI((int)this.parameters[0], false);
             }
             else
             {
            rsiSerie = closeSerie.CalculateRSI((int)this.parameters[0], true);
             }
             rsiSerie = rsiSerie.CalculateEMA((int)this.parameters[1]);

             FloatSerie trailSerie = rsiSerie.CalculateHLTrail((int)this.parameters[2]);

             this.series[0] = rsiSerie;
             this.series[0].Name = this.SerieNames[0];
             this.series[1] = trailSerie;
             this.series[1].Name = this.SerieNames[1];

             // Detecting events
             this.CreateEventSeries(stockSerie.Count);

             float overbought = (float)this.parameters[3];
             float oversold = (float)this.parameters[4];

             bool isOverSold = false;
             bool isOverBought = false;

             for (int i = 1; i < rsiSerie.Count; i++)
             {
            int j = 0;
            this.eventSeries[j++][i] = rsiSerie[i] > trailSerie[i];
            this.eventSeries[j++][i] = rsiSerie[i] < trailSerie[i];
            this.eventSeries[j++][i] = (rsiSerie[i - 1] < trailSerie[i - 1] && rsiSerie[i] > trailSerie[i]);
            this.eventSeries[j++][i] = (rsiSerie[i - 1] > trailSerie[i - 1] && rsiSerie[i] < trailSerie[i]);
            isOverSold = rsiSerie[i] <= oversold;
            isOverBought = rsiSerie[i] >= overbought;
            this.eventSeries[j++][i] = isOverBought;
            this.eventSeries[j++][i] = isOverSold;
            this.eventSeries[j++][i] = (!isOverSold) && this.eventSeries[j - 2][i - 1];
            this.eventSeries[j++][i] = (!isOverBought) && this.eventSeries[j - 4][i - 1];
            this.eventSeries[j++][i] = rsiSerie[i] >= 50;
            this.eventSeries[j++][i] = rsiSerie[i] < 50;
             }
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:47,代码来源:StockIndicator_QQE.cs

示例11: ApplyTo

        public override void ApplyTo(StockSerie stockSerie)
        {
            FloatSerie longStopSerie;
             FloatSerie shortStopSerie;
             FloatSerie highSerie = stockSerie.GetSerie(StockDataType.HIGH);
             FloatSerie lowSerie = stockSerie.GetSerie(StockDataType.LOW);

             float indicatorMax = (float)this.Parameters[2];
             float indicatorCenter = (float)this.Parameters[3];
             float indicatorWeight = (float)this.Parameters[4];

             stockSerie.CalculateVarTrailStop((int)this.Parameters[0], ((string)this.Parameters[1]).Replace('_', ','), indicatorMax, indicatorCenter, indicatorWeight, out longStopSerie, out shortStopSerie);
             this.Series[0] = longStopSerie;
             this.Series[1] = shortStopSerie;

             // Detecting events
             this.CreateEventSeries(stockSerie.Count);

             for (int i = (int)this.Parameters[0]; i < stockSerie.Count; i++)
             {
            this.Events[0][i] = !float.IsNaN(longStopSerie[i]);
            this.Events[1][i] = !float.IsNaN(shortStopSerie[i]);
            this.Events[2][i] = float.IsNaN(longStopSerie[i - 1]) && !float.IsNaN(longStopSerie[i]);
            this.Events[3][i] = float.IsNaN(shortStopSerie[i - 1]) && !float.IsNaN(shortStopSerie[i]);
            this.Events[4][i] = !float.IsNaN(longStopSerie[i - 1]) && !float.IsNaN(longStopSerie[i]) && longStopSerie[i - 1] < longStopSerie[i];
            this.Events[5][i] = !float.IsNaN(shortStopSerie[i - 1]) && !float.IsNaN(shortStopSerie[i]) && shortStopSerie[i - 1] > shortStopSerie[i];
            this.Events[6][i] = !float.IsNaN(longStopSerie[i]) && !float.IsNaN(longStopSerie[i - 1]) && lowSerie[i] > longStopSerie[i] && lowSerie[i - 1] <= longStopSerie[i - 1];
            this.Events[7][i] = !float.IsNaN(shortStopSerie[i]) && !float.IsNaN(shortStopSerie[i - 1]) && highSerie[i] < shortStopSerie[i] && highSerie[i - 1] >= shortStopSerie[i - 1];
             }
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:30,代码来源:StockTrailStop_TRAILVAR.cs

示例12: ApplyTo

        public override void ApplyTo(StockSerie stockSerie)
        {
            FloatSerie closeSerie = stockSerie.GetSerie(StockDataType.CLOSE).CalculateEMA((int)this.parameters[3]);
            FloatSerie volumeSerie = stockSerie.GetSerie(StockDataType.VOLUME);
            FloatSerie mfiSerie = new FloatSerie(stockSerie.Count);

            int period = (int)this.parameters[0];

            for (int i = period + 1; i < stockSerie.Count; i++)
            {
                float upFlow = 0f, downFlow = 0f;
                for (int j = 0; j < period; j++)
                {
                    if (closeSerie[i - j - 1] < closeSerie[i - j])
                    {
                        upFlow += volumeSerie[i - j] * closeSerie[i - j];
                    }
                    else
                    {
                        downFlow += volumeSerie[i - j] * closeSerie[i - j];
                    }
                }
                if (downFlow == 0)
                {
                    mfiSerie[i] = 100f;
                }
                else
                {
                    float ratio = upFlow / downFlow;
                    mfiSerie[i] = 100f - 100f / (1f + ratio);
                }
            }

            this.series[0] = mfiSerie;
            this.series[0].Name = this.Name;

            // Detecting events
            this.CreateEventSeries(stockSerie.Count);

            float overbought = (float)this.parameters[1];
            float oversold = (float)this.parameters[2];

            for (int i = 2; i < mfiSerie.Count; i++)
            {
                this.eventSeries[0][i] = (mfiSerie[i - 2] < mfiSerie[i - 1] && mfiSerie[i - 1] > mfiSerie[i]);
                this.eventSeries[1][i] = (mfiSerie[i - 2] > mfiSerie[i - 1] && mfiSerie[i - 1] < mfiSerie[i]);
                this.eventSeries[2][i] = mfiSerie[i] >= overbought;
                this.eventSeries[3][i] = mfiSerie[i] <= oversold;
                this.eventSeries[4][i] = this.eventSeries[2][i - 1] && !this.eventSeries[2][i];
                this.eventSeries[5][i] = this.eventSeries[3][i - 1] && !this.eventSeries[3][i];
            }
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:52,代码来源:StockIndicator_MFI.cs

示例13: ApplyTo

        public override void ApplyTo(StockSerie stockSerie)
        {
            FloatSerie longStopSerie;
             FloatSerie shortStopSerie;

             FloatSerie lowSerie = stockSerie.GetSerie(StockDataType.LOW);
             FloatSerie HighSerie = stockSerie.GetSerie(StockDataType.HIGH);

             IStockIndicator bbIndicator = stockSerie.GetIndicator(this.Name.Replace("TRAIL", ""));
             stockSerie.CalculateBBTrailStop(bbIndicator.Series[1], bbIndicator.Series[0], out longStopSerie, out shortStopSerie);
             this.Series[0] = longStopSerie;
             this.Series[1] = shortStopSerie;

             // Detecting events
             this.CreateEventSeries(stockSerie.Count);

             for (int i = 5; i < stockSerie.Count; i++)
             {
            bool upTrend;
            this.Events[0][i] = upTrend = float.IsNaN(shortStopSerie[i]);
            this.Events[1][i] = !upTrend;
            this.Events[2][i] = upTrend && !this.Events[0][i - 1];
            this.Events[3][i] = !upTrend && !this.Events[1][i - 1];
            this.Events[4][i] = upTrend && this.Events[0][i - 1] && lowSerie[i - 1] <= longStopSerie[i - 1] && lowSerie[i] > longStopSerie[i];
            this.Events[5][i] = !upTrend && this.Events[1][i - 1] && HighSerie[i - 1] >= shortStopSerie[i - 1] && HighSerie[i] < shortStopSerie[i]; ;
             }
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:27,代码来源:StockTrailStop_TRAILBB.cs

示例14: ApplyTo

        public override void ApplyTo(StockSerie stockSerie)
        {
            Queue<float> resistanceQueue = new Queue<float>(new float[] { float.MinValue, float.MinValue });
            Queue<float> supportQueue = new Queue<float>(new float[] { float.MaxValue, float.MaxValue });

            FloatSerie lowSerie = stockSerie.GetSerie(StockDataType.LOW);
            FloatSerie highSerie = stockSerie.GetSerie(StockDataType.HIGH);
            FloatSerie closeSerie = stockSerie.GetSerie(StockDataType.CLOSE);
            int period = (int)this.Parameters[0];

            IStockTrailStop trailStop = stockSerie.GetTrailStop("TRAILHL(" + period + ")");

            FloatSerie longStopSerie = trailStop.Series[0];
            FloatSerie shortStopSerie = trailStop.Series[1];

            BoolSerie brokenUpSerie = trailStop.Events[2];
            BoolSerie brokenDownSerie = trailStop.Events[3];

            FloatSerie supportSerie = new FloatSerie(stockSerie.Count, "TRAILHL.S"); supportSerie.Reset(float.NaN);
            FloatSerie resistanceSerie = new FloatSerie(stockSerie.Count, "TRAILHL.R"); resistanceSerie.Reset(float.NaN);

            this.Series[0] = supportSerie;
            this.Series[1] = resistanceSerie;

            // Detecting events
            this.CreateEventSeries(stockSerie.Count);
            this.Events[0] = brokenUpSerie;
            this.Events[1] = brokenDownSerie;

            // Begin Sequence

            // Calculate Support/Resistance
            float extremum = lowSerie[0];
            bool waitingForEndOfTrend = false;
            int i = 0;
            for (; i < stockSerie.Count && (!brokenUpSerie[i] && !brokenDownSerie[i]); i++)
            {
                //if (float.IsNaN(longStopSerie[i]))
                //{
                //    this.UpDownState[i] = StockSerie.Trend.DownTrend; // Down trend
                //    supportSerie[i] = float.NaN;
                //    resistanceSerie[i] = highSerie.GetMax(0, i);
                //    resistanceQueue.Dequeue();
                //    resistanceQueue.Enqueue(resistanceSerie[i]);
                //    extremum = highSerie.GetMax(0, i);
                //}
                //else
                //{
                //    this.UpDownState[i] = StockSerie.Trend.UpTrend; // Up trend

                //    supportSerie[i] = lowSerie.GetMin(0, i);
                //    supportQueue.Dequeue();
                //    supportQueue.Enqueue(supportSerie[i]);
                //    resistanceSerie[i] = float.NaN;
                //    extremum = lowSerie.GetMin(0, i);
                //}
            }
            if (i < stockSerie.Count)
            {
                if (brokenUpSerie[i])
                {
                    this.UpDownState[i] = StockSerie.Trend.UpTrend;
                    extremum = lowSerie.GetMin(0, i);
                }
                if (brokenDownSerie[i])
                {
                    this.UpDownState[i] = StockSerie.Trend.DownTrend;
                    extremum = highSerie.GetMax(0, i);
                }
            }

            for (; i < stockSerie.Count; i++)
            {
                bool upSwing = float.IsNaN(shortStopSerie[i]);
                this.UpDownState[i] = StockUpDownIndicatorBase.BoolToTrend(upSwing);

                this.Events[8][i] = upSwing;
                this.Events[9][i] = !upSwing;

                if (brokenUpSerie[i])
                {
                    supportSerie[i] = extremum;
                    supportQueue.Dequeue();
                    supportQueue.Enqueue(extremum);
                    resistanceSerie[i] = float.NaN;

                    if (waitingForEndOfTrend)
                    {// Detect EndOfUptrend
                        waitingForEndOfTrend = false;
                        this.Events[3][i] = true;
                    }
                    else if (extremum > resistanceQueue.ElementAt(0))
                    {// Detect if pullback in uptrend
                        this.Events[2][i] = true;
                        waitingForEndOfTrend = true;
                    }

                    if (extremum > supportQueue.ElementAt(0))
                    {
                        // Higher Low detected
//.........这里部分代码省略.........
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:101,代码来源:StockIndicator_TRAILHLSR.cs

示例15: ApplyTo

        public override void ApplyTo(StockSerie stockSerie)
        {
            // Calculate Bands
             int period = (int)this.parameters[0];
             FloatSerie ema = stockSerie.GetIndicator("EMA(" + period + ")").Series[0];
             FloatSerie atr = stockSerie.GetIndicator("ATR(" + period + ")").Series[0];

             float upCoef = (float)this.parameters[1];
             float downCoef = (float)this.parameters[2];

             FloatSerie upperKeltnerBand = ema + atr * upCoef;
             this.series[0] = upperKeltnerBand;
             this.Series[0].Name = this.SerieNames[0];

             FloatSerie lowerKeltnerBand = ema + atr * downCoef;
             this.series[1] = lowerKeltnerBand;
             this.Series[1].Name = this.SerieNames[1];

             // Detecting events
             this.CreateEventSeries(stockSerie.Count);

             FloatSerie closeSerie = stockSerie.GetSerie(StockDataType.CLOSE);
             FloatSerie lowSerie = stockSerie.GetSerie(StockDataType.LOW);
             FloatSerie highSerie = stockSerie.GetSerie(StockDataType.HIGH);

             for (int i = 1; i < upperKeltnerBand.Count; i++)
             {
            this.eventSeries[0][i] = closeSerie[i] > upperKeltnerBand[i];
            this.eventSeries[1][i] = closeSerie[i] < lowerKeltnerBand[i];
            this.eventSeries[2][i] = closeSerie[i] >= lowerKeltnerBand[i] && closeSerie[i] <= upperKeltnerBand[i];
             }
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:32,代码来源:StockIndicator_KeltnerBand.cs


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