public IndLine(TemporalContextManager manager, string token, int fastPeriod, int slowPeriod, int index) { m_manager = manager; m_unsubscribers = new IDisposable[2]; m_indFastEMA = new IndEMA(m_manager, token); m_indFastEMA.SetParameters(new IndParameter("Period", fastPeriod)); m_indSlowEMA = new IndEMA(m_manager, token); m_indSlowEMA.SetParameters(new IndParameter("Period", slowPeriod)); m_token = TemporalContextManager.GetTokenName(); m_indFastEMA.SetParameters( new IndParameter("Start", true), new IndParameter("Priority", TemporalContextManager.InternalIndicatorPriority + 6), new IndParameter((index == -1) ? "nIndex" : "Index", index)); m_indSlowEMA.SetParameters( new IndParameter("Start", true), new IndParameter("Priority", TemporalContextManager.InternalIndicatorPriority + 7), new IndParameter((index == -1) ? "nIndex" : "Index", index)); m_unsubscribers[0] = m_manager.AddTemporalQueueObserver <double>(this, m_indFastEMA.Token, "FastEMA", TemporalContextManager.InternalIndicatorPriority + 4); m_unsubscribers[1] = m_manager.AddTemporalQueueObserver <double>(this, m_indSlowEMA.Token, "SlowEMA", TemporalContextManager.InternalIndicatorPriority + 5); }
void Unsubscribe() { if (m_unsubscribers != null) { foreach (var uns in m_unsubscribers) { uns.Dispose(); } m_unsubscribers = null; } if (m_indSignalEMA != null) { m_indSignalEMA.Dispose(); m_indSignalEMA = null; } }
public IndSignal(TemporalContextManager manager, string token, int signalPeriod) { m_manager = manager; m_unsubscribers = new IDisposable[2]; m_token = TemporalContextManager.GetTokenName(); m_indSignalEMA = new IndEMA(m_manager, token); m_indSignalEMA.SetParameters(new IndParameter("Period", signalPeriod)); m_unsubscribers[0] = m_manager.AddTemporalQueueObserver <double>(this, m_indSignalEMA.Token, "SignalEMA", TemporalContextManager.InternalIndicatorPriority + 3); m_unsubscribers[1] = m_manager.AddTemporalQueueObserver <double>(this, token, "Line", TemporalContextManager.InternalIndicatorPriority + 2); m_manager.AddTemporalQueue <double[]>(m_token, "Line&Signal"); m_indSignalEMA.SetParameters( new IndParameter("Start", true), new IndParameter("Priority", TemporalContextManager.InternalIndicatorPriority + 1)); }