Написал this.SellAtMarket(0m) и вылетело исключение, что не определен параметр u2. Как правильно использовать эти методы (со своим объёмом тоже) ?
Написал this.SellAtMarket(0m) и вылетело исключение, что не определен параметр u2. Как правильно использовать эти методы (со своим объёмом тоже) ?
Kommentare (5)
Anmelden oder Konto erstellen, Melden Sie sich an oder registrieren Sie sich, um einen Kommentar zu hinterlassen
Чему равен Strategy.Volume перед вызовом метода? Покажите стэк трэйс.
Volume = 2. Это точно
в StockSharp.BusinessEntities.Unit.CreateResult(Unit u1, Unit u2, Func
3 operation, Func3 percentOperation) в StockSharp.BusinessEntities.Unit.op_Addition(Unit u1, Unit u2) в StockSharp.Algo.TraderHelper.GetMarketPrice(Security security, OrderDirections direction, Unit priceDelta, MarketPriceTypes priceType) в StockSharp.Algo.Strategies.StrategyHelper.BuyAtMarket(Strategy strategy, Decimal volume) в MyRobot.MainWindow.MenuItemTest_Click(Object sender, RoutedEventArgs e) в C:\Users\Алексей\Desktop\МТС\StockSharp\MyRobot\Robot\MainWindow.xaml.cs:строка 749 в 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.MenuItem.InvokeClickAfterRender(Object arg) в 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.DispatcherOperation.InvokeImpl() в System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state) в System.Threading.ExecutionContext.runTryCode(Object userData) в System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) в System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) в System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) в System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) в System.Windows.Threading.DispatcherOperation.Invoke() в System.Windows.Threading.Dispatcher.ProcessQueue() в System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) в MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& 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.InvokeImpl(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& 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) в MyRobot.Program.Main(String[] args) в C:\Users\Алексей\Desktop\МТС\StockSharp\MyRobot\Robot\Startup.cs:строка 32 в 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.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) в System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) в System.Threading.ThreadHelper.ThreadStart()Версия S#?
4.0.8
с codeplex возьмите последнюю версию