﻿<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type='text/css' href='https://stocksharp.ru/css/style.css'?>
<?xml-stylesheet type='text/css' href='https://stocksharp.ru/css/bbeditor.css'?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title type="html">Charting Candles (received from Quik)</title>
  <id>~/topic/4429/charting-candles-(received-from-quik)/</id>
  <rights type="text">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  <updated>2026-06-10T10:18:11Z</updated>
  <logo>https://stocksharp.ru/images/logo.png</logo>
  <link href="https://stocksharp.ru/handlers/atom.ashx?category=topic&amp;id=4429" rel="self" type="application/rss+xml" />
  <entry>
    <id>https://stocksharp.ru/posts/m/30144/</id>
    <title type="text">Thanks Mihail, It works on Windows 7, but we have some issues on Windows 8 (still not able to receiv...</title>
    <published>2014-03-30T08:41:49Z</published>
    <updated>2014-03-30T08:41:49Z</updated>
    <author>
      <name>sunrising</name>
      <uri>https://stocksharp.ru/users/50864/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <content type="html">&lt;p&gt;Thanks Mihail,&lt;/p&gt;
&lt;p&gt;It works on Windows 7, but we have some issues on Windows 8 (still not able to receive and draw candles from Quik). Source code and setting are the same. It isn't a big issue, cause we can always forget about Windows 8.&lt;/p&gt;
&lt;p&gt;We start looking at Stock# Studio. Complements, it seems to be really well done and complete for developing and testing common algorithms.&lt;/p&gt;
&lt;p&gt;I wonder if you plan to make an English version ? It would be cool.&lt;/p&gt;
</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.ru/posts/m/30091/</id>
    <title type="text">sunrising: _candleManager.Processing event never fires, so we don&amp;apos;t get real time data Check the tab...</title>
    <published>2014-03-23T21:27:29Z</published>
    <updated>2014-03-23T21:27:29Z</updated>
    <author>
      <name>Mikhail Sukhov</name>
      <uri>https://stocksharp.ru/users/201/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <content type="html">&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href="@message(30090)" rel="nofollow" target="_blank"&gt;sunrising&lt;/a&gt;:&lt;/strong&gt;
_candleManager.Processing event never fires, so we don't get real time data&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Check the table &amp;quot;Все сделки&amp;quot;. This table should be filled by tick data (historical and realtime).&lt;/p&gt;
</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.ru/posts/m/30090/</id>
    <title type="text">Thanks. For sure, ProcessCandles source code is the following one: private void ProcessCandle(Candle...</title>
    <published>2014-03-23T20:38:37Z</published>
    <updated>2014-03-23T20:38:37Z</updated>
    <author>
      <name>sunrising</name>
      <uri>https://stocksharp.ru/users/50864/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <content type="html">&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;For sure, ProcessCandles source code is the following one:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-csharp"&gt;
        private void ProcessCandle(Candle candle)
        {
            var longValue = candle.State == CandleStates.Finished ? new ChartIndicatorValue(_strategy.LongSma, _strategy.LongSma.Process(candle)) : null;
            var shortValue = candle.State == CandleStates.Finished ? new ChartIndicatorValue(_strategy.ShortSma, _strategy.ShortSma.Process(candle)) : null;

            //_chart.ProcessCandle(_candlesElem, candle);

            _chart.ProcessValues(candle.OpenTime, new Dictionary&amp;lt;IChartElement, object&amp;gt;
			{
				{ _candlesElem, candle },
				{ _longMaElem, longValue },
				{ _shortMaElem, shortValue },
			});
        }

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The problem consists of impossibility to draw candles from quik.&lt;/p&gt;
&lt;p&gt;It seams that:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;_candleManager.Container.GetCandles doesn't fill &amp;quot;candles&amp;quot; variable (maybe some issues with quik integration ?)&lt;/li&gt;
&lt;li&gt;_candleManager.Processing event never fires, so we don't get real time data&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Regarding your question, we use a lot google translate and we have a russian trader in our team.&lt;/p&gt;
&lt;p&gt;Thank you again for your help. Really appreciated.&lt;/p&gt;
</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.ru/posts/m/30084/</id>
    <title type="text">sunrising: but not the current one received from quik.(we report only a peace of code related to can...</title>
    <published>2014-03-23T13:38:55Z</published>
    <updated>2014-03-23T13:38:55Z</updated>
    <author>
      <name>Mikhail Sukhov</name>
      <uri>https://stocksharp.ru/users/201/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <content type="html">&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href="@message(30083)" rel="nofollow" target="_blank"&gt;sunrising&lt;/a&gt;:&lt;/strong&gt;
but not the current one received from quik.(we report only a peace of code related to candle drawing, in case you need more information please tell us about it),&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;First of all what kind of problem did you find? Also you didn't provided the source code of ProcessCandle&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href="@message(30083)" rel="nofollow" target="_blank"&gt;sunrising&lt;/a&gt;:&lt;/strong&gt;
Please might you suggest us where the error could be? (We have already set up permissions to administrator for both quik and C# project)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Good expirience for those who do not speak Russian. How did you know that?&lt;/p&gt;
</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.ru/posts/m/30083/</id>
    <title type="text">Dear Stock# community, We tried to lunch Sample SMA example with some minor personalization. The mai...</title>
    <published>2014-03-23T11:44:07Z</published>
    <updated>2014-03-23T11:44:07Z</updated>
    <author>
      <name>sunrising</name>
      <uri>https://stocksharp.ru/users/50864/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <content type="html">&lt;p&gt;Dear Stock# community,&lt;/p&gt;
&lt;p&gt;We tried to lunch Sample SMA example with some minor personalization.&lt;/p&gt;
&lt;p&gt;The main problem we have is related to drawing candles received from quik real time.&lt;/p&gt;
&lt;p&gt;The code reported below is able to draw correctly history data but not the current one received from quik.(we report only a peace of code related to candle drawing, in case you need more information please tell us about it),&lt;/p&gt;
&lt;p&gt;Please might you suggest us where the error could be? (We have already set up permissions to administrator for both quik and C# project)&lt;/p&gt;
&lt;p&gt;Thank you very much for your help.&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-csharp"&gt;// Trader creation
_trader = new QuikTrader(this.Path.Text);


// CONNECTION
_trader.Connected += () =&amp;gt;
{
	_candleManager = new CandleManager(_trader);
	
	//WHEN A NEW CANDLE IS RECEIVED
	_candleManager.Processing += (series, candle) =&amp;gt;
	{
		if (candle.State == CandleStates.Finished)
			this.GuiAsync(() =&amp;gt; ProcessCandle(candle));
	};
	
	_trader.Connect();
}



private void Start_Click(object sender, RoutedEventArgs e)
{
	if (_strategy == null)
	{
		// register our security and timeframe
		var series = new CandleSeries(typeof(TimeFrameCandle), _lkoh, _timeFrame);

		/*CREATION OF CANDLES FROM HISTORY *.txt*/
		IEnumerable&amp;lt;Candle&amp;gt; candles = File.ReadAllLines(&amp;quot;LKOH_history.txt&amp;quot;).Select(line =&amp;gt;
		{
			var parts = line.Split(',');
			//Returns a string array that contains the substrings that are delimited by ','.
			var time = (parts[0] + parts[1]).ToDateTime(&amp;quot;yyyyMMddHHmmss&amp;quot;);

			return (Candle)new TimeFrameCandle
			{
				OpenPrice = parts[2].To&amp;lt;decimal&amp;gt;(), //To&amp;lt;decimal&amp;gt;() is converter from string to decimal
				HighPrice = parts[3].To&amp;lt;decimal&amp;gt;(),
				LowPrice = parts[4].To&amp;lt;decimal&amp;gt;(),
				ClosePrice = parts[5].To&amp;lt;decimal&amp;gt;(),
				TimeFrame = _timeFrame,
				OpenTime = time,
				TotalVolume = parts[6].To&amp;lt;int&amp;gt;(),
				Security = _lkoh,
				State = CandleStates.Finished,
			};
		});

		var lastCandleTime = default(DateTime);
		
		// History candles drawing
		foreach (var candle in candles)
		{
			ProcessCandle(candle);
			lastCandleTime = candle.OpenTime;
		}
		
		/* now we try to get current data from quik */
		
		_candleManager.Start(series);

		// Calculation of time intervals of current candle
		var bounds = _timeFrame.GetCandleBounds(series.Security);

		// get candles from when quik started to the latest one
		candles = _candleManager.Container.GetCandles(series, new Range&amp;lt;DateTime&amp;gt;(lastCandleTime + _timeFrame, bounds.Min));

		// draw candles received from quik
		foreach (var candle in candles)
		{
			ProcessCandle(candle);
		}
	}
}
&lt;/code&gt;&lt;/pre&gt;
</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
</feed>