Charting Candles (received from Quik)~/topic/4429/charting-candles-(received-from-quik)/Copyright @ StockSharp Platform LLC 2010 - 20242024-03-29T13:57:27Zhttps://stocksharp.com/images/logo.pnghttps://stocksharp.com/posts/m/30144/Thanks Mihail, It works on Windows 7, but we have some issues on Windows 8 (still not able to receiv...2014-03-30T08:41:49Z2014-03-30T08:41:49Zsunrisinghttps://stocksharp.com/users/50864/info@stocksharp.comThanks Mihail,<br /><br />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.<br /><br />We start looking at Stock# Studio. Complements, it seems to be really well done and complete for developing and testing common algorithms. <br /><br />I wonder if you plan to make an English version ? It would be cool.<br /><br /><br /> Copyright @ StockSharp Platform LLC 2010 - 2024https://stocksharp.com/posts/m/30091/ _candleManager.Processing event never fires, so we don't get real time data Check the table "Все сд...2014-03-23T21:27:29Z2014-03-23T21:27:29ZMikhail Sukhovhttps://stocksharp.com/users/201/info@stocksharp.com<div class="quote"><span class="quotetitle">sunrising <a href="https://stocksharp.com/posts/m/30090/"><img src="https://stocksharp.com/images/icon_latest_reply.gif" title="Go to" alt="Go to" /></a></span><div class="innerquote"><br />_candleManager.Processing event never fires, so we don't get real time data<br /></div></div><br /><br />Check the table "Все сделки". This table should be filled by tick data (historical and realtime).Copyright @ StockSharp Platform LLC 2010 - 2024https://stocksharp.com/posts/m/30090/Thanks. For sure, ProcessCandles source code is the following one: private void ProcessCandle(Candle...2014-03-23T20:38:37Z2014-03-23T20:38:37Zsunrisinghttps://stocksharp.com/users/50864/info@stocksharp.comThanks.<br /><br />For sure, ProcessCandles source code is the following one:<br /><br /><div class="code"><strong>Code</strong><div class="innercode"><pre class="brush:csharp">
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<IChartElement, object>
{
{ _candlesElem, candle },
{ _longMaElem, longValue },
{ _shortMaElem, shortValue },
});
}
</pre>
</div></div><br /><br />The problem consists of impossibility to draw candles from quik. <br /><br />It seams that: <br /><ul><li>_candleManager.Container.GetCandles doesn't fill "candles" variable (maybe some issues with quik integration ?)<br /><li>_candleManager.Processing event never fires, so we don't get real time data<br /></ul><br /><br />Regarding your question, we use a lot google translate and we have a russian trader in our team.<br /><br />Thank you again for your help. Really appreciated. <br />Copyright @ StockSharp Platform LLC 2010 - 2024https://stocksharp.com/posts/m/30084/ but not the current one received from quik.(we report only a peace of code related to candle drawin...2014-03-23T13:38:55Z2014-03-23T13:38:55ZMikhail Sukhovhttps://stocksharp.com/users/201/info@stocksharp.com<div class="quote"><span class="quotetitle">sunrising <a href="https://stocksharp.com/posts/m/30083/"><img src="https://stocksharp.com/images/icon_latest_reply.gif" title="Go to" alt="Go to" /></a></span><div class="innerquote"><br />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),<br /></div></div><br /><br />First of all what kind of problem did you find? Also you didn't provided the source code of ProcessCandle<br /><br /><div class="quote"><span class="quotetitle">sunrising <a href="https://stocksharp.com/posts/m/30083/"><img src="https://stocksharp.com/images/icon_latest_reply.gif" title="Go to" alt="Go to" /></a></span><div class="innerquote"><br />Please might you suggest us where the error could be? (We have already set up permissions to administrator for both quik and C# project) <br /></div></div><br /><br />Good expirience for those who do not speak Russian. How did you know that?Copyright @ StockSharp Platform LLC 2010 - 2024https://stocksharp.com/posts/m/30083/Dear Stock# community, We tried to lunch Sample SMA example with some minor personalization. The mai...2014-03-23T11:44:07Z2014-03-23T11:44:07Zsunrisinghttps://stocksharp.com/users/50864/info@stocksharp.comDear Stock# community,<br /><br />We tried to lunch Sample SMA example with some minor personalization.<br /><br />The main problem we have is related to drawing candles received from quik real time.<br /><br />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),<br /><br />Please might you suggest us where the error could be? (We have already set up permissions to administrator for both quik and C# project) <br /><br />Thank you very much for your help.<br /><br />Kind regards,<br /><br /><br /><div class="code"><strong>Code</strong><div class="innercode"><pre class="brush:csharp">
// Trader creation
_trader = new QuikTrader(this.Path.Text);
// CONNECTION
_trader.Connected += () =>
{
_candleManager = new CandleManager(_trader);
//WHEN A NEW CANDLE IS RECEIVED
_candleManager.Processing += (series, candle) =>
{
if (candle.State == CandleStates.Finished)
this.GuiAsync(() => 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<Candle> candles = File.ReadAllLines("LKOH_history.txt").Select(line =>
{
var parts = line.Split(',');
//Returns a string array that contains the substrings that are delimited by ','.
var time = (parts[0] + parts[1]).ToDateTime("yyyyMMddHHmmss");
return (Candle)new TimeFrameCandle
{
OpenPrice = parts[2].To<decimal>(), //To<decimal>() is converter from string to decimal
HighPrice = parts[3].To<decimal>(),
LowPrice = parts[4].To<decimal>(),
ClosePrice = parts[5].To<decimal>(),
TimeFrame = _timeFrame,
OpenTime = time,
TotalVolume = parts[6].To<int>(),
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<DateTime>(lastCandleTime + _timeFrame, bounds.Min));
// draw candles received from quik
foreach (var candle in candles)
{
ProcessCandle(candle);
}
}
}</pre>
</div></div>Copyright @ StockSharp Platform LLC 2010 - 2024