Exemple #1
0
        private void MergeStochastics(StochasticsInfo stochasticsInfo, int period)
        {
            for (int i = 0; i < stochasticsInfo.EndIndex; i++)
            {
                switch (period)
                {
                case 14:
                    this.Quotes[stochasticsInfo.StartIndex + i].Stochastics14505 = stochasticsInfo.StochasticsSlowsK[i];
                    Debug.WriteLine($"ApplyIsStochastics14 {stochasticsInfo.StochasticsSlowsK[i]} -- {this.Quotes[stochasticsInfo.StartIndex + i].TimeStampDateTime}");
                    break;

                case 10:
                    this.Quotes[stochasticsInfo.StartIndex + i].Stochastics101 = stochasticsInfo.StochasticsSlowsK[i];
                    Debug.WriteLine($"ApplyIsStochastics10 {stochasticsInfo.StochasticsSlowsK[i]} -- {this.Quotes[stochasticsInfo.StartIndex + i].TimeStampDateTime}");
                    break;
                }
            }
        }
Exemple #2
0
        public override void ApplyStochatics101()
        {
            var closePrices = this.QuoteCandles.Select(x => Convert.ToSingle(x.Close)).ToArray();
            var highPrices  = this.QuoteCandles.Select(x => Convert.ToSingle(x.High)).ToArray();
            var lowPrices   = this.QuoteCandles.Select(x => Convert.ToSingle(x.Low)).ToArray();
            var slowKs      = new double[closePrices.Length];
            var slowDs      = new double[closePrices.Length];

            TicTacTec.TA.Library.Core.Stoch(0, closePrices.Length - 1, highPrices,
                                            lowPrices, closePrices, 10, 1, 0, 1, Core.MAType.Ema, out var outBegIndex, out var outNbElement, slowKs, slowDs);

            var stochastics = new StochasticsInfo
            {
                StartIndex        = outBegIndex,
                EndIndex          = outNbElement,
                StochasticsSlowsK = slowKs.Select(d => Convert.ToDecimal(d)).ToArray()
            };

            MergeStochastics(stochastics, 10);
        }