﻿<?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">Проблема преобразования TimeSpan - AlfaTimeFrames</title>
  <id>~/topic/3570/problema-preobrazovaniya-timespan---alfatimeframes/</id>
  <rights type="text">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  <updated>2026-06-10T11:36:44Z</updated>
  <logo>https://stocksharp.ru/images/logo.png</logo>
  <link href="https://stocksharp.ru/handlers/atom.ashx?category=topic&amp;id=3570" rel="self" type="application/rss+xml" />
  <entry>
    <id>https://stocksharp.ru/posts/m/25280/</id>
    <title type="text">Напишите мне в скайп, который в профиле. </title>
    <published>2013-04-11T11:42:55Z</published>
    <updated>2013-04-11T11:42:55Z</updated>
    <author>
      <name>esper</name>
      <uri>https://stocksharp.ru/users/5990/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <content type="html">&lt;p&gt;Напишите мне в скайп, который в профиле.&lt;/p&gt;
</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.ru/posts/m/25277/</id>
    <title type="text">к удивлению код: TimeSpan span = TimeSpan.FromMinutes(5); StockSharp.AlfaDirect.AlfaTimeFrames frame...</title>
    <published>2013-04-11T11:18:47Z</published>
    <updated>2013-04-11T11:18:47Z</updated>
    <author>
      <name>zhuravl</name>
      <uri>https://stocksharp.ru/users/38994/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <content type="html">&lt;p&gt;к удивлению код:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;TimeSpan span = TimeSpan.FromMinutes(5);
StockSharp.AlfaDirect.AlfaTimeFrames frame = (AlfaTimeFrames)span;
TimeSpan span2 = (TimeSpan)frame;&lt;/p&gt;
&lt;p&gt;Console.WriteLine(span);
Console.WriteLine(frame);
Console.WriteLine(span2);
работает нормально&lt;/p&gt;
&lt;/blockquote&gt;
</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.ru/posts/m/25275/</id>
    <title type="text">В этом случае выдается Unhandled Exception: System.ArgumentException: Параметр свечки 00:05:00 не пр...</title>
    <published>2013-04-11T10:27:02Z</published>
    <updated>2013-04-11T10:27:02Z</updated>
    <author>
      <name>zhuravl</name>
      <uri>https://stocksharp.ru/users/38994/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <content type="html">&lt;p&gt;В этом случае выдается&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Unhandled Exception: System.ArgumentException: Параметр свечки 00:05:00 не правильный.&lt;/p&gt;
&lt;/blockquote&gt;
</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.ru/posts/m/25273/</id>
    <title type="text">Чтобы указать таймфрейм для альфы, необходимо использовать AlfaTimeFrames. </title>
    <published>2013-04-11T09:38:46Z</published>
    <updated>2013-04-11T09:38:46Z</updated>
    <author>
      <name>esper</name>
      <uri>https://stocksharp.ru/users/5990/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <content type="html">&lt;p&gt;Чтобы указать таймфрейм для альфы, необходимо использовать AlfaTimeFrames.&lt;/p&gt;
</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.ru/posts/m/25272/</id>
    <title type="text">Программный код: public void Test() { CandleManager candleManager = new CandleManager(trader); // 5 ...</title>
    <published>2013-04-11T09:13:52Z</published>
    <updated>2013-04-11T09:13:52Z</updated>
    <author>
      <name>zhuravl</name>
      <uri>https://stocksharp.ru/users/38994/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <content type="html">&lt;p&gt;Программный код:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;public void Test()
{
CandleManager candleManager = new CandleManager(trader);&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;        // 5 minute candles
        CandleSeries series = new CandleSeries(typeof(TimeFrameCandle), security, TimeSpan.FromMinutes(5));
        series.ProcessCandle += series_ProcessCandle;
        candleManager.Processing += candleManager_Processing;

        candleManager.Start(series);
    }

    void series_ProcessCandle(Candle obj)
    {
        Logger.WriteLine(&amp;quot;Process candle&amp;quot;);
    }

    void candleManager_Processing(CandleSeries arg1, Candle arg2)
    {
        Logger.WriteLine(&amp;quot;Received Processing event&amp;quot;);
    }
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;Код ошибки:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Unhandled Exception: System.InvalidCastException: Unable to cast object of type 'System.TimeSpan' to type 'StockSharp.AlfaDirect.AlfaTimeFrames'.
at StockSharp.AlfaDirect.AlfaTrader.#=qjbXuGHh73XvrWZicy6gOKXr2Dom0efIFR9MSjpJMLe0=(SynchronizedDictionary&lt;code&gt;2 #=qA5mbLCf6AEYY2ZjSKZfmqw==) at Ecng.Collections.CollectionHelper.SyncDo[TCollection](TCollection collection, Action&lt;/code&gt;1 action)
at StockSharp.AlfaDirect.AlfaTrader.#=qC5NNrqRcgxVSSeVdRzYPn46I7MwkMp1XS5d1hUpptZw=()
at Ecng.Common.ThreadingHelper.&amp;lt;&amp;gt;c__DisplayClass1.&lt;Timer&gt;b__0(Object s)
at System.Threading.TimerQueueTimer.CallCallbackInContext(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserv
eSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx
)
at System.Threading.TimerQueueTimer.CallCallback()
at System.Threading.TimerQueueTimer.Fire()
at System.Threading.TimerQueue.FireNextTimers()
at System.Threading.TimerQueue.AppDomainTimerCallback()&lt;/p&gt;
&lt;/blockquote&gt;
</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
</feed>