Esempio n. 1
0
        /// <summary>
        /// Save settings.
        /// </summary>
        /// <param name="settings">Settings storage.</param>
        public override void Save(SettingsStorage settings)
        {
            base.Save(settings);

            settings.SetValue("LongMa", LongMa.Save());
            settings.SetValue("ShortMa", ShortMa.Save());
            settings.SetValue("MedianPrice", MedianPrice.Save());
        }
Esempio n. 2
0
        /// <summary>
        /// Load settings.
        /// </summary>
        /// <param name="settings">Settings storage.</param>
        public override void Load(SettingsStorage settings)
        {
            base.Load(settings);

            LongMa.LoadNotNull(settings, "LongMa");
            ShortMa.LoadNotNull(settings, "ShortMa");
            MedianPrice.LoadNotNull(settings, "MedianPrice");
        }
Esempio n. 3
0
        /// <summary>
        /// To handle the input value.
        /// </summary>
        /// <param name="input">The input value.</param>
        /// <returns>The resulting value.</returns>
        protected override IIndicatorValue OnProcess(IIndicatorValue input)
        {
            var mpValue = MedianPrice.Process(input);

            var sValue = ShortMa.Process(mpValue).GetValue <decimal>();
            var lValue = LongMa.Process(mpValue).GetValue <decimal>();

            return(new DecimalIndicatorValue(this, sValue - lValue));
        }
Esempio n. 4
0
		/// <summary>
		/// Initializes a new instance of the <see cref="AwesomeOscillator"/>.
		/// </summary>
		/// <param name="longSma">Long moving average.</param>
		/// <param name="shortSma">Short moving average.</param>
		public AwesomeOscillator(SimpleMovingAverage longSma, SimpleMovingAverage shortSma)
		{
			if (longSma == null)
				throw new ArgumentNullException(nameof(longSma));

			if (shortSma == null)
				throw new ArgumentNullException(nameof(shortSma));

			ShortMa = shortSma;
			LongMa = longSma;
			MedianPrice = new MedianPrice();
		}
Esempio n. 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AwesomeOscillator"/>.
        /// </summary>
        /// <param name="longSma">Long moving average.</param>
        /// <param name="shortSma">Short moving average.</param>
        public AwesomeOscillator(SimpleMovingAverage longSma, SimpleMovingAverage shortSma)
        {
            if (longSma == null)
            {
                throw new ArgumentNullException(nameof(longSma));
            }

            if (shortSma == null)
            {
                throw new ArgumentNullException(nameof(shortSma));
            }

            ShortMa     = shortSma;
            LongMa      = longSma;
            MedianPrice = new MedianPrice();
        }
Esempio n. 6
0
        //private readonly SimpleMovingAverage _sma;

        /// <summary>
        /// Initializes a new instance of the <see cref="AlligatorLine"/>.
        /// </summary>
        public AlligatorLine()
        {
            _medianPrice = new MedianPrice();
            _sma         = new SmoothedMovingAverage();
            //_sma = new SimpleMovingAverage();
        }
Esempio n. 7
0
 /// <summary>
 /// Возможно ли обработать входное значение.
 /// </summary>
 /// <param name="input">Входное значение.</param>
 /// <returns><see langword="true"/>, если возможно, иначе, <see langword="false"/>.</returns>
 public override bool CanProcess(IIndicatorValue input)
 {
     return(MedianPrice.CanProcess(input));
 }