I feel that it's time to use ParameterTypes other than int and double, but I can't make it work. Could you give some examples or something? I've found a brief description, but it would be great to have something more).
E.g. I have an exception when trying to use ParameterTypes.StringChoice .
I do it like this:
But I get this exception:
System.InvalidCastException: Unable to cast object of type 'System.String' to type 'System.Double'.
at WealthLab.Core.Parameter.get_AsDouble()
at ParamsMapping.ComputeBatchWatcher(Object , ParamsMapping )
at WealthLab.WPF.ParameterSliderPanel.BuildSliders()
at WealthLab.WPF.ParameterSliderPanel.set_Parameters(ParameterList value)
at InterceptorVisitor.ForgotInvocation(Object , ParameterList , InterceptorVisitor )
at WealthLab7.cwStrategy.CreateProperty()
at WealthLab7.cwStrategy.set_Strategy(Strategy value)
at WealthLab7.MainWindow.OpenStrategyWindow(Strategy s, Boolean fromQuickRef)
at WealthLab7.MainWindow.OpenStrategy(Strategy s)
at TemplateIdentifier.ForgotInvocation(Object , Strategy , TemplateIdentifier )
at WealthLab7.cwHome.PrepareResolver(Object key, MouseButtonEventArgs cfg)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.Controls.Control.OnMouseDoubleClick(MouseButtonEventArgs e)
at System.Windows.Controls.Control.HandleDoubleClick(Object sender, MouseButtonEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
E.g. I have an exception when trying to use ParameterTypes.StringChoice .
I do it like this:
CODE:
public IntradayDebugStrategy() { AddParameter("maxMoneyAvgMillionsPerDay", ParameterTypes.Double, 100, 10, 500, 10); AddParameter("param", ParameterTypes.StringChoice, "string").Choices = new List<string> {"1", "2", "abc"}; } public override void Initialize(BarHistory bars) { maxMoneyAvgMillionsPerDay = Parameters.FindName("maxMoneyAvgMillionsPerDay").AsDouble; param = Parameters.FindName("param").AsString; }
But I get this exception:
System.InvalidCastException: Unable to cast object of type 'System.String' to type 'System.Double'.
at WealthLab.Core.Parameter.get_AsDouble()
at ParamsMapping.ComputeBatchWatcher(Object , ParamsMapping )
at WealthLab.WPF.ParameterSliderPanel.BuildSliders()
at WealthLab.WPF.ParameterSliderPanel.set_Parameters(ParameterList value)
at InterceptorVisitor.ForgotInvocation(Object , ParameterList , InterceptorVisitor )
at WealthLab7.cwStrategy.CreateProperty()
at WealthLab7.cwStrategy.set_Strategy(Strategy value)
at WealthLab7.MainWindow.OpenStrategyWindow(Strategy s, Boolean fromQuickRef)
at WealthLab7.MainWindow.OpenStrategy(Strategy s)
at TemplateIdentifier.ForgotInvocation(Object , Strategy , TemplateIdentifier )
at WealthLab7.cwHome.PrepareResolver(Object key, MouseButtonEventArgs cfg)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.Controls.Control.OnMouseDoubleClick(MouseButtonEventArgs e)
at System.Windows.Controls.Control.HandleDoubleClick(Object sender, MouseButtonEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
Rename
Strategies only support numeric int and double parameters. Adding other types at this point would be a significant modification.
Other types are here not for strategies, I see, thanks.
Yes, mainly for indicators, drawing objects, etc...
Your Response
Post
Edit Post
Login is required