﻿<?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">Ошибка выхода из стратегии</title>
  <id>~/topic/4543/oshibka-vyhoda-iz-strategii/</id>
  <rights type="text">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  <updated>2026-06-11T21:28:20Z</updated>
  <logo>https://stocksharp.com/images/logo.png</logo>
  <link href="https://stocksharp.com/handlers/atom.ashx?category=topic&amp;id=4543" rel="self" type="application/rss+xml" />
  <entry>
    <id>https://stocksharp.com/posts/m/30650/</id>
    <title type="text">Добрый день! написал оболочку для робота, где есть простой коннектор к КВИКу (по сути копия стандарт...</title>
    <published>2014-06-04T10:03:01Z</published>
    <updated>2014-06-04T10:05:30Z</updated>
    <author>
      <name>buker</name>
      <uri>https://stocksharp.com/users/50556/</uri>
      <email>info@stocksharp.com</email>
    </author>
    <content type="html">&lt;p&gt;Добрый день!
написал оболочку для робота, где есть простой коннектор к КВИКу (по сути копия стандартного из примера) и вызов стратегии по кнопке (пока стратегия &amp;quot;пустая&amp;quot;, т.е. по сути там заглушка). Так вот запускается стратегия успешно, а попытка закрыть ее кодом&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-csharp"&gt;_spreadSrategyMain.Stop()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;выдает ошибку&lt;/p&gt;
&lt;details&gt;&lt;summary&gt;2014/06/04 13:37:15.232|Error  |Unhandled Exception|System.InvalidOperationException: Подключение не инициализировано.
в StockSharp.Algo.Strategies.Strategy.#=q4hrz$6YIdirnmDAnvpHhXA8NGpJbvyeNK6Ny49wYh$0=()
в StockSharp.Algo.Strategies.Strategy.#=q6ezYD4hkLnRhGfBuAWGxcsiiCgqZAeVPpl4qa$6YZ04=()
в StockSharp.Algo.Strategies.Strategy.#=qUSpjJWgSBc7ywbSg5YmUcNwnebTr6TY8V9aDKKL0IwA=(ProcessStates #=q8ulus3HTmWh8DMibgZirrw==)
в StockSharp.Algo.Strategies.Strategy.Stop()
в QuikConnectWpfLevels.MainWindow.BtnManuallyTrade_Click(Object sender, RoutedEventArgs e) в d:\Работа\IFF\код\C#(S#)\work\QUIK\Levels\QuikConnectWpfLevels\QuikConnectWpfLevels\MainWindow.xaml.cs:строка 545
в System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
в System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
в System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
в System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
в System.Windows.Controls.Primitives.ButtonBase.OnClick()
в System.Windows.Controls.Button.OnClick()
в System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
в System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
в System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
в System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
в System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
в System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
в System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
в System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
в System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
в System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
в System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
в System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
в System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
в System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
в System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
в System.Windows.Input.InputManager.ProcessStagingArea()
в System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
в System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
в System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
в System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean&amp;amp; handled)
в System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp;amp; handled)
в MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp;amp; handled)
в MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
в System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
в MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
в System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
в MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
в MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG&amp;amp; msg)
в System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
в System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
в System.Windows.Threading.Dispatcher.Run()
в System.Windows.Application.RunDispatcher(Object ignore)
в System.Windows.Application.RunInternal(Window window)
в System.Windows.Application.Run(Window window)
в System.Windows.Application.Run()
в QuikConnectWpfLevels.App.Main() в d:\Работа\IFF\код\C#(S#)\work\QUIK\Levels\QuikConnectWpfLevels\QuikConnectWpfLevels\obj\Debug\App.g.cs:строка 0
в System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
в System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
в Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
в System.Threading.ThreadHelper.ThreadStart_Context(Object state)
в System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
в System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
в System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
в System.Threading.ThreadHelper.ThreadStart()&lt;/summary&gt;
&lt;/details&gt;
&lt;p&gt;Далее сравниваю код &amp;quot;посимвольно&amp;quot; с примером SampleSMA (в примере все работает на &amp;quot;ура&amp;quot;)- различий существенных не наблюдаю :(. Помогите плз разобраться, в чем может быть причина ошибки &lt;strong&gt;&amp;quot;Подключение не инициализировано&amp;quot;.&lt;/strong&gt;
Заранее благодарен&lt;/p&gt;
</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
</feed>