当前位置: 首页>>代码示例>>C#>>正文


C# Candles.CandleSeries类代码示例

本文整理汇总了C#中StockSharp.Algo.Candles.CandleSeries的典型用法代码示例。如果您正苦于以下问题:C# CandleSeries类的具体用法?C# CandleSeries怎么用?C# CandleSeries使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CandleSeries类属于StockSharp.Algo.Candles命名空间,在下文中一共展示了CandleSeries类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ChartWindow

		public ChartWindow(CandleSeries candleSeries, DateTime from, DateTime to)
		{
			InitializeComponent();

			if (candleSeries == null)
				throw new ArgumentNullException("candleSeries");

			_candleSeries = candleSeries;
			_trader = MainWindow.Instance.Trader;

			Chart.ChartTheme = "ExpressionDark";

			var area = new ChartArea();
			Chart.Areas.Add(area);

			_candleElem = new ChartCandleElement
			{
				Antialiasing = false, 
				UpFillColor = Colors.White,
				UpBorderColor = Colors.Black,
				DownFillColor = Colors.Black,
				DownBorderColor = Colors.Black,
			};

			area.Elements.Add(_candleElem);

			_trader.NewCandles += ProcessNewCandles;
			_trader.SubscribeCandles(_candleSeries, from, to);
		}
开发者ID:hbwjz,项目名称:StockSharp,代码行数:29,代码来源:ChartWindow.xaml.cs

示例2: OnChartPanelSubscribeCandleElement

		private void OnChartPanelSubscribeCandleElement(ChartCandleElement element, CandleSeries candleSeries)
		{
			_drawTimer.Cancel();

			_elements.Add(new RefPair<IChartElement, int>(element, 0));
			_drawTimer.Activate();
		}
开发者ID:hbwjz,项目名称:StockSharp,代码行数:7,代码来源:ChartPane.xaml.cs

示例3: ChartWindow

		public ChartWindow(CandleSeries candleSeries)
		{
			InitializeComponent();

			if (candleSeries.IsNull())
				throw new ArgumentNullException("candleSeries");

			_candleSeries = candleSeries;
			_trader = MainWindow.Instance.Trader;

			Chart.ChartTheme = "ExpressionDark";

			var area = new ChartArea();
			Chart.Areas.Add(area);

			_candleElem = new ChartCandleElement
			{
				Antialiasing = false, 
				UpFillColor = Colors.White,
				UpBorderColor = Colors.Black,
				DownFillColor = Colors.Black,
				DownBorderColor = Colors.Black,
			};

			area.Elements.Add(_candleElem);

			_trader.NewCandles += ProcessNewCandles;
			_trader.SubscribeCandles(_candleSeries, DateTime.Today - TimeSpan.FromTicks(((TimeSpan)candleSeries.Arg).Ticks * 100), DateTimeOffset.MaxValue);
		}
开发者ID:reddream,项目名称:StockSharp,代码行数:29,代码来源:ChartWindow.xaml.cs

示例4: SubscribeCandles

		/// <summary>
		/// Subscribe to receive new candles.
		/// </summary>
		/// <param name="series">Candles series.</param>
		/// <param name="from">The initial date from which you need to get data.</param>
		/// <param name="to">The final date by which you need to get data.</param>
		public void SubscribeCandles(CandleSeries series, DateTimeOffset from, DateTimeOffset to)
		{
			if (series == null)
				throw new ArgumentNullException("series");

			if (series.CandleType != typeof(TimeFrameCandle))
				throw new ArgumentException(LocalizedStrings.NotSupportCandle.Put("OANDA", series.CandleType), "series");

			if (!(series.Arg is TimeSpan))
				throw new ArgumentException(LocalizedStrings.WrongCandleArg.Put(series.Arg), "series");

			var transactionId = TransactionIdGenerator.GetNextId();

			_series.Add(transactionId, series);

			SendInMessage(new MarketDataMessage
			{
				TransactionId = transactionId,
				DataType = MarketDataTypes.CandleTimeFrame,
				//SecurityId = GetSecurityId(series.Security),
				Arg = series.Arg,
				IsSubscribe = true,
				From = from,
				To = to,
			}.FillSecurityInfo(this, series.Security));
		}
开发者ID:EricGarrison,项目名称:StockSharp,代码行数:32,代码来源:OandaTrader.cs

示例5: UnsubscribeCandles

		public void UnsubscribeCandles(CandleSeries series)
		{
			var key = new SubscriptionKey(series.Security.Id, (TimeSpan) series.Arg);
			var subscription = _candleSubscriptions.TryGetValue(key);
			if(subscription == null)
				return;

			subscription.RemoveSubscriber(series);
			if(subscription.NumSubscribers > 0)
				return;

			subscription.CandleBuilder.Candle -= CandleBuilderOnCandle;
			_candleSubscriptions.Remove(key);

			var msg = new MarketDataMessage().FillSecurityInfo(this, series.Security);
			msg.TransactionId = TransactionIdGenerator.GetNextId();
			msg.OriginalTransactionId = subscription.SubscribeTransactionId;
			msg.SecurityId = GetSecurityId(series.Security);
			msg.DataType = MarketDataTypes.CandleTimeFrame;
			msg.IsSubscribe = false;
			msg.From = subscription.From;
			msg.Arg = subscription.TimeFrame;

			SendInMessage(msg);

			UnSubscribeMarketData(series.Security, MarketDataTypes.CandleTimeFrame);
		}
开发者ID:RakotVT,项目名称:StockSharp,代码行数:27,代码来源:TerminalConnector.cs

示例6: SmaStrategy

		public SmaStrategy(CandleSeries series, SimpleMovingAverage longSma, SimpleMovingAverage shortSma)
		{
			_series = series;

			LongSma = longSma;
			ShortSma = shortSma;
		}
开发者ID:reddream,项目名称:StockSharp,代码行数:7,代码来源:SmaStrategy.cs

示例7: CandleSettingsEditorOnClosed

		private void CandleSettingsEditorOnClosed(object sender, RoutedEventArgs routedEventArgs)
		{
			if (_tempCandleSeries == CandleSettingsEditor.Settings || _candleSeries == null)
				return;

			_tempCandleSeries = CandleSettingsEditor.Settings.Clone();
			SecurityPicker_OnSecuritySelected(SecurityPicker.SelectedSecurity);
		}
开发者ID:knoppixmeister,项目名称:StockSharp,代码行数:8,代码来源:MainWindow.xaml.cs

示例8: SmaStrategy

		public SmaStrategy(ICandleManager candleManager, CandleSeries series, SimpleMovingAverage longSma, SimpleMovingAverage shortSma)
		{
			_candleManager = candleManager;
			_series = series;

			LongSma = longSma;
			ShortSma = shortSma;
		}
开发者ID:RakotVT,项目名称:StockSharp,代码行数:8,代码来源:SmaStrategy.cs

示例9: CandleSeriesIndicatorSource

		/// <summary>
		/// Создать <see cref="CandleManagerIndicatorSource"/>.
		/// </summary>
		/// <param name="series">Серия свечек.</param>
		public CandleSeriesIndicatorSource(CandleSeries series)
		{
			if (series == null)
				throw new ArgumentNullException("series");

			_series = series;
			_series.ProcessCandle += OnProcessCandle;
		}
开发者ID:RakotVT,项目名称:StockSharp,代码行数:12,代码来源:CandleSeriesIndicatorSource.cs

示例10: OnChartPanelSubscribeIndicatorElement

		private void OnChartPanelSubscribeIndicatorElement(ChartIndicatorElement element, CandleSeries candleSeries, IIndicator indicator)
		{
			_drawTimer.Cancel();

			_elements.Add(new RefPair<IChartElement, int>(element, 0));
			_indicators.Add(element, indicator);
			_drawTimer.Activate();
		}
开发者ID:hbwjz,项目名称:StockSharp,代码行数:8,代码来源:ChartPane.xaml.cs

示例11: ProcessNewCandles

		private void ProcessNewCandles(CandleSeries series, IEnumerable<Candle> candles)
		{
			if (series != _candleSeries)
				return;

			foreach (var timeFrameCandle in candles)
			{
				Chart.Draw(_candleElem, timeFrameCandle);
			}
		}
开发者ID:hbwjz,项目名称:StockSharp,代码行数:10,代码来源:ChartWindow.xaml.cs

示例12:

		IEnumerable<Range<DateTimeOffset>> IExternalCandleSource.GetSupportedRanges(CandleSeries series)
		{
			if (series.CandleType != typeof(TimeFrameCandle) || !(series.Arg is TimeSpan))
				yield break;

			var tf = (TimeSpan)series.Arg;

			if (OandaMessageAdapter.TimeFrames.Contains(tf))
				yield return new Range<DateTimeOffset>(DateTimeOffset.MinValue, CurrentTime);
		}
开发者ID:EricGarrison,项目名称:StockSharp,代码行数:10,代码来源:OandaTrader.cs

示例13: SmaStrategy

		public SmaStrategy(CandleSeries series, SimpleMovingAverage longSma, SimpleMovingAverage shortSma)
		{
			_series = series;

			LongSma = longSma;
			ShortSma = shortSma;

			_longSmaPeriod = this.Param("LongSmaPeriod", longSma.Length);
			_shortSmaPeriod = this.Param("ShortSmaPeriod", shortSma.Length);
		}
开发者ID:reddream,项目名称:StockSharp,代码行数:10,代码来源:SmaStrategy.cs

示例14: Main

        static void Main(string[] args)
        {
            _candleManager = new CandleManager();

            if (!GetSetings())
                return;

            var storageRegistry = new StorageRegistry();
            ((LocalMarketDataDrive)storageRegistry.DefaultDrive).Path = _historyPath;

            var cbs = new TradeStorageCandleBuilderSource { StorageRegistry = storageRegistry };
            _candleManager.Sources.OfType<TimeFrameCandleBuilder>().Single().Sources.Add(cbs);


            

            _candleManager.Processing += GetCandles;


            foreach (var Sec in listOfName)
            {
                foreach (var timeFrame in listOfTimeFrame)
                {
                  
                   

                _series = new CandleSeries(typeof(TimeFrameCandle), Sec, timeFrame);

                LisfStreamWriters.Add(_series.ToString(), new StreamWriter(GetFileName(_series), false));


                _candleManager.Start(_series, _startTime, _endTime);

                


 
    }

            }

     

            Console.ReadKey();

            // Закроем все потоки которые мы записывали

            foreach (var strim in LisfStreamWriters)
            {
                strim.Value.Close();   
            }

        

        }
开发者ID:draco777,项目名称:GetHydraData,代码行数:55,代码来源:Program.cs

示例15: SubscribeCandleElementCommand

		public SubscribeCandleElementCommand(ChartCandleElement element, CandleSeries candleSeries)
		{
			if (element == null)
				throw new ArgumentNullException(nameof(element));

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

			Element = element;
			CandleSeries = candleSeries;
		}
开发者ID:RakotVT,项目名称:StockSharp,代码行数:11,代码来源:RequestMarketDataCommand.cs


注:本文中的StockSharp.Algo.Candles.CandleSeries类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。