當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。