Exemplo n.º 1
0
 /// <summary>
 ///      Resets this indicator to its initial state
 /// </summary>
 public override void Reset()
 {
     _previous = null;
     _smoother.Reset();
     TrueRange.Reset();
     base.Reset();
 }
Exemplo n.º 2
0
 /// <summary>
 ///      Initializes a new instance of the <see cref="NormalizedAverageTrueRange"/> class using the specified name and period.
 /// </summary>
 /// <param name="name">The name of this indicator</param>
 /// <param name="period">The period of the NATR</param>
 public NormalizedAverageTrueRange(string name, int period) :
     base(name)
 {
     _period = period;
     _tr     = new TrueRange(name + "_TR");
     _atr    = new AverageTrueRange(name + "_ATR", period, MovingAverageType.Simple);
 }
Exemplo n.º 3
0
        /// <summary>
        ///      Computes the next value of this indicator from the given state
        /// </summary>
        /// <param name="time"></param>
        /// <param name="input">The input given to the indicator</param>
        /// <returns>A new value for this indicator</returns>
        protected override DoubleArray Forward(long time, DoubleArray input)
        {
            // compute the true range and then send it to our smoother
            TrueRange.Update(time, input);
            _smoother.Update(time, TrueRange);

            return(_smoother.Current.Value);
        }
Exemplo n.º 4
0
 /// <summary>
 ///      Initializes a new instance of the <see cref="UltimateOscillator"/> class using the specified parameters
 /// </summary>
 /// <param name="name">The name of this indicator</param>
 /// <param name="period1">The first period</param>
 /// <param name="period2">The second period</param>
 /// <param name="period3">The third period</param>
 public UltimateOscillator(string name, int period1, int period2, int period3)
     : base(name)
 {
     _period             = Math.Max(Math.Max(period1, period2), period3);
     _trueRange          = new TrueRange(name + "_TR");
     _sumBuyingPressure1 = new Sum(name + "_BP1", period1);
     _sumBuyingPressure2 = new Sum(name + "_BP2", period2);
     _sumBuyingPressure3 = new Sum(name + "_BP3", period3);
     _sumTrueRange1      = new Sum(name + "_TR1", period1);
     _sumTrueRange2      = new Sum(name + "_TR2", period2);
     _sumTrueRange3      = new Sum(name + "_TR3", period3);
 }