Пример #1
0
        public void SetParameters(params IndParameter[] parameters)
        {
            if (parameters[0] == "Timeframe")
            {
                if (m_timeframe != parameters[0])
                {
                    Unsubscribe();
                    m_timeframe     = parameters[0];
                    m_nexttimeframe = 0;
                }
            }

            if (parameters[0] == "Start")
            {
                IndParameter priorityParamater = parameters.FirstOrDefault(p => p == "Priority");

                if (priorityParamater.Value != null)
                {
                    m_unsubscriber = m_manager.AddTemporalObserver(this, m_token, null, priorityParamater);
                }
                else
                {
                    m_unsubscriber = m_manager.AddTemporalObserver(this, m_token);
                }
            }
        }
Пример #2
0
        public void SetParameters(params IndParameter[] parameters)
        {
            if (parameters[0] == "Tokens" && parameters.Length > 1)
            {
                Unsubscribe();
                m_outTokens = new string[0];
                m_values    = new TemporalValue[0];
                m_columns   = parameters;
                ApplyColumnParameters(parameters[0]);
            }

            if (parameters[0] == "Start")
            {
                if (apply == null || m_columns.Length < 2)
                {
                    throw new NullReferenceException();
                }

                if (parameters.Length >= 2 && parameters[1] == "Priority")
                {
                    m_unsubscriber = m_manager.AddTemporalObserver(this, new[] { m_token }, true, parameters[1])[0];
                }
                else
                {
                    m_unsubscriber = m_manager.AddTemporalObserver(this, new[] { m_token })[0];
                }
            }
        }
Пример #3
0
 public void SetParameters(params IndParameter[] parameters)
 {
     if (parameters[0] == "Start" && parameters[1] == "KeepValues")
     {
         if (parameters.Length >= 3 && parameters[2] == "Priority")
         {
             m_unsubscriber = m_manager.AddTemporalObserver(this, new[] { m_token_in }, parameters[1], parameters[2])[0];
         }
         else
         {
             m_unsubscriber = m_manager.AddTemporalObserver(this, new[] { m_token_in }, parameters[1])[0];
         }
     }
 }
Пример #4
0
        public void SetParameters(params IndParameter[] parameters)
        {
            if (parameters[0] == "Period")
            {
                if (m_period != parameters[0])
                {
                    Unsubscribe();
                    m_wma       = 0;
                    m_period    = parameters[0];
                    m_sumWeight = 0; for (int i = 1; i <= m_period; i++)
                    {
                        m_sumWeight += i;
                    }
                    m_window = new SortedSet <TemporalValue <double> >(new TemporalValueComparer <double>());
                }
            }

            if (parameters[0] == "Start")
            {
                IndParameter indexParamater    = parameters.FirstOrDefault(p => p == "Index");
                IndParameter priorityParamater = parameters.FirstOrDefault(p => p == "Priority");

                if (indexParamater.Value != null)
                {
                    m_index = indexParamater;
                    if (priorityParamater.Value != null)
                    {
                        m_unsubscriber = m_manager.AddTemporalObserver <double[]>(this, m_token, priorityParamater);
                    }
                    else
                    {
                        m_unsubscriber = m_manager.AddTemporalObserver <double[]>(this, m_token);
                    }
                }
                else
                {
                    if (priorityParamater.Value != null)
                    {
                        m_unsubscriber = m_manager.AddTemporalObserver <double>(this, m_token, null, priorityParamater);
                    }
                    else
                    {
                        m_unsubscriber = m_manager.AddTemporalObserver <double>(this, m_token);
                    }
                }
            }
        }
Пример #5
0
        public void SetParameters(params IndParameter[] parameters)
        {
            if (parameters[0] == "Period")
            {
                if (m_period != parameters[0])
                {
                    Unsubscribe();

                    m_ema    = 0;
                    m_period = parameters[0];
                    m_KC     = (double)2 / (m_period + 1);
                    m_KE     = 1 - m_KC;
                }
            }

            if (parameters[0] == "Start")
            {
                IndParameter indexParamater    = parameters.FirstOrDefault(p => p == "Index");
                IndParameter priorityParamater = parameters.FirstOrDefault(p => p == "Priority");

                if (indexParamater.Value != null)
                {
                    m_index = indexParamater;
                    if (priorityParamater.Value != null)
                    {
                        m_unsubscriber = m_manager.AddTemporalObserver <double[]>(this, m_token, priorityParamater);
                    }
                    else
                    {
                        m_unsubscriber = m_manager.AddTemporalObserver <double[]>(this, m_token);
                    }
                }
                else
                {
                    if (priorityParamater.Value != null)
                    {
                        m_unsubscriber = m_manager.AddTemporalObserver <double>(this, m_token, null, priorityParamater);
                    }
                    else
                    {
                        m_unsubscriber = m_manager.AddTemporalObserver <double>(this, m_token);
                    }
                }
            }
        }
Пример #6
0
        public void SetParameters(params IndParameter[] parameters)
        {
            if (parameters[0] == "N" && parameters[1] == "K")
            {
                if (_n != parameters[0] || _k != parameters[1])
                {
                    Unsubscribe();
                    _n = parameters[0];
                    _k = parameters[1];

                    m_indSMA = new IndSMA(m_manager, m_token);
                    m_indSMA.SetParameters(new IndParameter("Period", _n));
                }
            }

            if (parameters[0] == "Start")
            {
                IndParameter indexParamater    = parameters.FirstOrDefault(p => p == "Index");
                IndParameter priorityParamater = parameters.FirstOrDefault(p => p == "Priority");

                if (indexParamater.Value != null)
                {
                    m_indSMA.SetParameters(
                        new IndParameter("Start", true),
                        new IndParameter("Index", indexParamater),
                        new IndParameter("Priority", TemporalContextManager.InternalIndicatorPriority)
                        );
                }
                else
                {
                    m_indSMA.SetParameters(new IndParameter("Start", true),
                                           new IndParameter("Priority", TemporalContextManager.InternalIndicatorPriority));
                }

                if (priorityParamater.Value != null)
                {
                    m_unsubscriber = m_manager.AddTemporalObserver <double>(this, m_indSMA.Token, null, priorityParamater);
                }
                else
                {
                    m_unsubscriber = m_manager.AddTemporalObserver <double>(this, m_indSMA.Token);
                }
            }
        }
Пример #7
0
 public void SetParameters(params IndParameter[] parameters)
 {
     if (parameters[0].Name == "Period")
     {
         if (_period != (int)parameters[0].Value)
         {
             Unsubscribe();
             _period      = (int)parameters[0].Value;
             _out_token   = Tokens()[0];
             _unsubscribe = _manager.AddTemporalObserver(this, new[] { _token })[0];
         }
     }
 }
Пример #8
0
 public void SetParameters(params IndParameter[] parameters)
 {
     if (parameters[0].Name == "N" && parameters[1].Name == "K")
     {
         if (_n != (int)parameters[0].Value || _k != (double)parameters[1].Value)
         {
             Unsubscribe();
             _n           = (int)parameters[0].Value;
             _k           = (double)parameters[1].Value;
             _out_tokens  = Tokens();
             _unsubscribe = _manager.AddTemporalObserver(this, new[] { _token })[0];
         }
     }
 }
Пример #9
0
 public void SetParameters(params IndParameter[] parameters)
 {
     if (parameters[0].Name == "NS" && parameters[1].Name == "NF")
     {
         if (_ns != (int)parameters[0].Value || _nf != (int)parameters[1].Value)
         {
             Unsubscribe();
             _ns          = (int)parameters[0].Value;
             _nf          = (int)parameters[1].Value;
             _out_token   = Tokens()[0];
             _unsubscribe = _manager.AddTemporalObserver(this, new[] { _token }, (bool)parameters[0].Value)[0];
         }
     }
 }
Пример #10
0
        public void SetParameters(params IndParameter[] parameters)
        {
            if (parameters[0].Name == "S" && parameters[1].Name == "M")
            {
                if (_step != (int)parameters[0].Value || _maxstep != (int)parameters[1].Value)
                {
                    Unsubscribe();
                    _step      = (int)parameters[0].Value;
                    _maxstep   = (int)parameters[1].Value;
                    _out_token = Tokens()[0];

                    _unsubscribe = _manager.AddTemporalObserver(this, new[] { _token })[0];
                }
            }
        }
Пример #11
0
        public void SetParameters(params IndParameter[] parameters)
        {
            if (parameters[0] == "Period")
            {
                if (m_period != parameters[0])
                {
                    Unsubscribe();
                    m_window       = new SortedSet <TemporalValue>(new TemporalValueComparer());
                    m_unsubscriber = m_manager.AddTemporalObserver(this, new[] { m_token })[0];
                }
            }

            if (parameters[0] == "Start" && parameters[1] == "KeepValues")
            {
                if (parameters.Length >= 3 && parameters[2] == "Priority")
                {
                    m_unsubscriber = m_manager.AddTemporalObserver(this, new[] { m_token }, parameters[1], parameters[2])[0];
                }
                else
                {
                    m_unsubscriber = m_manager.AddTemporalObserver(this, new[] { m_token }, parameters[1])[0];
                }
            }
        }
Пример #12
0
 public void SetParameters(params IndParameter[] parameters)
 {
     if (parameters[0].Name == "NK" && parameters[1].Name == "ND" && parameters[2].Name == "NS")
     {
         if (_nk != (int)parameters[0].Value || _nd != (int)parameters[1].Value || _ns != (int)parameters[2].Value)
         {
             Unsubscribe();
             _nk          = (int)parameters[0].Value;
             _nd          = (int)parameters[1].Value;
             _ns          = (int)parameters[2].Value;
             _out_tokens  = Tokens();
             _unsubscribe = _manager.AddTemporalObserver(this, new[] { _token })[0];
         }
     }
 }