コード例 #1
0
		protected override IIndicatorValue OnProcess(IIndicatorValue input)
		{
			var result = base.OnProcess(input);

			IsBarCrossedOnLastValue = null;
			if (Container.Count > Length)
			{
				var lastValue = result.GetValue<decimal>();
				var prevValue = this.GetCurrentValue();

				if (prevValue < LBar && lastValue > LBar)
				{
					IsBarCrossedOnLastValue = new BarCrossedEventArgs { Side = Sides.Buy, PrevIndicatorValue = prevValue, LastIndicatorValue = lastValue };
					OnBarCrossed(IsBarCrossedOnLastValue);
				}
				else
				{
					if (prevValue > HBar && lastValue < HBar)
					{
						IsBarCrossedOnLastValue = new BarCrossedEventArgs { Side = Sides.Sell, PrevIndicatorValue = prevValue, LastIndicatorValue = lastValue };
						OnBarCrossed(IsBarCrossedOnLastValue);
					}
				}
			}

			return result;
		}
コード例 #2
0
		protected virtual void OnBarCrossed(BarCrossedEventArgs e)
		{
			BarCrossed?.Invoke(this, e);
		}