﻿<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type='text/css' href='https://stocksharp.com/css/style.css'?>
<?xml-stylesheet type='text/css' href='https://stocksharp.com/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-04-24T23:03:11Z</updated>
  <logo>https://stocksharp.com/images/logo.png</logo>
  <link href="https://stocksharp.com/handlers/atom.ashx?category=topic&amp;id=4429" rel="self" type="application/rss+xml" />
  <entry>
    <id>https://stocksharp.com/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.com/users/50864/</uri>
      <email>info@stocksharp.com</email>
    </author>
    <content type="html">Thanks Mihail,&lt;br /&gt;&lt;br /&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&amp;#39;t a big issue, cause we can always forget about Windows 8.&lt;br /&gt;&lt;br /&gt;We start looking at Stock# Studio. Complements, it seems to be really well done and complete for developing and testing common algorithms. &lt;br /&gt;&lt;br /&gt;I wonder if you plan to make an English version ? It would be cool.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; </content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.com/posts/m/30091/</id>
    <title type="text"> _candleManager.Processing event never fires, so we don&amp;apos;t get real time data Check the table &amp;quot;Все сд...</title>
    <published>2014-03-23T21:27:29Z</published>
    <updated>2014-03-23T21:27:29Z</updated>
    <author>
      <name>Mikhail Sukhov</name>
      <uri>https://stocksharp.com/users/201/</uri>
      <email>info@stocksharp.com</email>
    </author>
    <content type="html">&lt;div class="quote"&gt;&lt;span class="quotetitle"&gt;sunrising &lt;a href="https://stocksharp.com/posts/m/30090/" class="quote_nav"&gt;&lt;/a&gt;&lt;/span&gt;&lt;div class="innerquote"&gt;&lt;br /&gt;_candleManager.Processing event never fires, so we don&amp;#39;t get real time data&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Check the table &amp;quot;Все сделки&amp;quot;. This table should be filled by tick data (historical and realtime).</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.com/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.com/users/50864/</uri>
      <email>info@stocksharp.com</email>
    </author>
    <content type="html">Thanks.&lt;br /&gt;&lt;br /&gt;For sure, ProcessCandles source code is the following one:&lt;br /&gt;&lt;br /&gt;&lt;div class="code"&gt;&lt;strong&gt;Code&lt;/strong&gt;&lt;div class="innercode"&gt;&lt;pre class="brush: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;/pre&gt;
&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The problem consists of impossibility to draw candles from quik. &lt;br /&gt;&lt;br /&gt;It seams that: &lt;br /&gt;&lt;ul&gt;&lt;li&gt;_candleManager.Container.GetCandles doesn&amp;#39;t fill &amp;quot;candles&amp;quot; variable (maybe some issues with quik integration ?)&lt;br /&gt;&lt;li&gt;_candleManager.Processing event never fires, so we don&amp;#39;t get real time data&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;Regarding your question, we use a lot google translate and we have a russian trader in our team.&lt;br /&gt;&lt;br /&gt;Thank you again for your help. Really appreciated. &lt;br /&gt;</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.com/posts/m/30084/</id>
    <title type="text"> but not the current one received from quik.(we report only a peace of code related to candle drawin...</title>
    <published>2014-03-23T13:38:55Z</published>
    <updated>2014-03-23T13:38:55Z</updated>
    <author>
      <name>Mikhail Sukhov</name>
      <uri>https://stocksharp.com/users/201/</uri>
      <email>info@stocksharp.com</email>
    </author>
    <content type="html">&lt;div class="quote"&gt;&lt;span class="quotetitle"&gt;sunrising &lt;a href="https://stocksharp.com/posts/m/30083/" class="quote_nav"&gt;&lt;/a&gt;&lt;/span&gt;&lt;div class="innerquote"&gt;&lt;br /&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;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;First of all what kind of problem did you find? Also you didn&amp;#39;t provided the source code of ProcessCandle&lt;br /&gt;&lt;br /&gt;&lt;div class="quote"&gt;&lt;span class="quotetitle"&gt;sunrising &lt;a href="https://stocksharp.com/posts/m/30083/" class="quote_nav"&gt;&lt;/a&gt;&lt;/span&gt;&lt;div class="innerquote"&gt;&lt;br /&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;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Good expirience for those who do not speak Russian. How did you know that?</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.com/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.com/users/50864/</uri>
      <email>info@stocksharp.com</email>
    </author>
    <content type="html">Dear Stock# community,&lt;br /&gt;&lt;br /&gt;We tried to lunch Sample SMA example with some minor personalization.&lt;br /&gt;&lt;br /&gt;The main problem we have is related to drawing candles received from quik real time.&lt;br /&gt;&lt;br /&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;br /&gt;&lt;br /&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;br /&gt;&lt;br /&gt;Thank you very much for your help.&lt;br /&gt;&lt;br /&gt;Kind regards,&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="code"&gt;&lt;strong&gt;Code&lt;/strong&gt;&lt;div class="innercode"&gt;&lt;pre class="brush: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(&amp;#39;,&amp;#39;);
			//Returns a string array that contains the substrings that are delimited by &amp;#39;,&amp;#39;.
			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;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
</feed>