Пример #1
0
        /// <summary>
        /// является ли текущая формация нашим паттерном
        /// </summary>
        /// <param name="candles">свечи</param>
        /// <param name="indicators">индикаторы</param>
        /// <param name="numberPattern">индекс по которому мы смотрим паттерн</param>
        public bool ThisIsIt(List <Candle> candles, List <IIndicatorCandle> indicators, int numberPattern)
        {
            if (numberPattern - Length <= 0)
            {
                return(false);
            }

            if (Sequence == null ||
                Sequence.Length == 0)
            {
                return(false);
            }

            PatternVolume researched = new PatternVolume();

            researched.Length = Length;
            researched.Expand = Expand;

            researched.SetFromIndex(candles, null, numberPattern);

            List <Candle> incomPattern = researched.GetInCandle();

            for (int i = 0; i < Sequence.Length; i++)
            {
                if (Sequence[i][0] < incomPattern[i].Volume || Sequence[i][1] > incomPattern[i].Volume)
                {
                    return(false);
                }
            }

            return(true);
        }
Пример #2
0
        void InitializeVolumePatternTab()
        {
            PatternVolume pattern = (PatternVolume)_pattern.GetTempPattern(PatternType.Volume);

            TextBoxVolumePatternLength.Text         = pattern.Length.ToString();
            TextBoxVolumePatternLength.TextChanged += TextBoxVolumePatternLength_TextChanged;
        }
Пример #3
0
        /// <summary>
        /// загрузить отдельный одиночный паттерн из строки
        /// </summary>
        private void LoadPattern(string pat, List <IPattern> array)
        {
            string[] patternInString = pat.Split('^');

            PatternType type;

            Enum.TryParse(patternInString[0], out type);

            if (type == PatternType.Candle)
            {
                PatternCandle pattern = new PatternCandle();
                pattern.Load(pat);
                array.Add(pattern);
            }
            if (type == PatternType.Volume)
            {
                PatternVolume pattern = new PatternVolume();
                pattern.Load(pat);
                array.Add(pattern);
            }
            if (type == PatternType.Indicators)
            {
                PatternIndicators pattern = new PatternIndicators();
                pattern.Load(pat);
                array.Add(pattern);
            }
            if (type == PatternType.Time)
            {
                PatternTime pattern = new PatternTime();
                pattern.Load(pat);
                array.Add(pattern);
            }
        }
Пример #4
0
        /// <summary>
        /// take a copy/взять копию
        /// </summary>
        public IPattern GetCopy()
        {
            PatternVolume pattern = new PatternVolume();

            string save = GetSaveString();

            pattern.Load(save);

            return(pattern);
        }
Пример #5
0
        /// <summary>
        /// взять копию
        /// </summary>
        public IPattern GetCopy()
        {
            PatternVolume pattern = new PatternVolume();

            pattern.Sequence = Sequence;
            pattern.Length   = Length;
            pattern.Expand   = Expand;
            pattern.Weigth   = Weigth;

            return(pattern);
        }
Пример #6
0
        void TextBoxVolumePatternLength_TextChanged(object sender, TextChangedEventArgs e)
        {
            PatternVolume pattern = (PatternVolume)_pattern.GetTempPattern(PatternType.Volume);

            try
            {
                pattern.Length = Convert.ToInt32(TextBoxVolumePatternLength.Text);
            }
            catch (Exception)
            {
                TextBoxVolumePatternLength.Text = pattern.Length.ToString();
            }
            _pattern.Save();
        }