Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DrawingTools w/PriceLevels Issue

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    I am wondering what was the solution for the error mentioned by many people here. Why not post solution here?

    I am getting same error when I am trying to create a custom drawing tool.


    2024-06-06 19:18:03:158 *************** unhandled exception trapped ***************
    2024-06-06 19:18:03:158 The value "NinjaTrader.NinjaScript.DrawingTools.PriceLev el" is not of type "NinjaTrader.NinjaScript.DrawingTools.PriceLev el" and cannot be used in this generic collection.
    Parameter name: value
    2024-06-06 19:18:03:158 System.ArgumentException: The value "NinjaTrader.NinjaScript.DrawingTools.PriceLev el" is not of type "NinjaTrader.NinjaScript.DrawingTools.PriceLev el" and cannot be used in this generic collection.
    Parameter name: value
    at System.ThrowHelper.ThrowWrongValueTypeArgumentExce ption(Object value, Type targetType)
    at System.Collections.Generic.List`1.System.Collectio ns.IList.Add(Object item)
    at NinjaTrader.NinjaScript.DrawingTools.PriceLevelCon tainer.CopyTo(NinjaScript ninjaScript) in C:\Users\RVReady\Documents\NinjaTrader 8\bin\Custom\DrawingTools\@PriceLevels.cs:line 239
    at NinjaTrader.Gui.Chart.GlobalDrawingToolManager.OnC hanged(ChartControl source, DrawingTool drawingTool)
    at NinjaTrader.Gui.Chart.GlobalDrawingToolManager.Che ckGlobalAttachToChanged(ChartControl source, DrawingTool original, DrawingTool edited)
    at NinjaTrader.Gui.Chart.ChartDrawingToolCommands.<>c __DisplayClass44_0.<OnDrawingObjectPropertiesExecu ted>g__ApplyHandler|4(IEnumerable`1 editItems)
    at NinjaTrader.Gui.Chart.DrawingToolEditor.OnOkClick( Object sender, RoutedEventArgs e)
    at System.Windows.EventRoute.InvokeHandlersImpl(Objec t source, RoutedEventArgs args, Boolean reRaised)
    at System.Windows.UIElement.RaiseEventImpl(Dependency Object sender, RoutedEventArgs args)
    at System.Windows.Controls.Primitives.ButtonBase.OnCl ick()
    at System.Windows.Controls.Button.OnClick()
    at System.Windows.Controls.Primitives.ButtonBase.OnMo useLeftButtonUp(MouseButtonEventArgs e)
    at System.Windows.RoutedEventArgs.InvokeHandler(Deleg ate handler, Object target)
    at System.Windows.RoutedEventHandlerInfo.InvokeHandle r(Object target, RoutedEventArgs routedEventArgs)
    at System.Windows.EventRoute.InvokeHandlersImpl(Objec t source, RoutedEventArgs args, Boolean reRaised)
    at System.Windows.UIElement.ReRaiseEventAs(Dependency Object sender, RoutedEventArgs args, RoutedEvent newEvent)
    at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
    at System.Windows.RoutedEventArgs.InvokeHandler(Deleg ate handler, Object target)
    at System.Windows.RoutedEventHandlerInfo.InvokeHandle r(Object target, RoutedEventArgs routedEventArgs)
    at System.Windows.EventRoute.InvokeHandlersImpl(Objec t source, RoutedEventArgs args, Boolean reRaised)
    at System.Windows.UIElement.RaiseEventImpl(Dependency Object sender, RoutedEventArgs args)
    at System.Windows.UIElement.RaiseTrustedEvent(RoutedE ventArgs args)
    at System.Windows.Input.InputManager.ProcessStagingAr ea()
    at System.Windows.Input.InputManager.ProcessInput(Inp utEventArgs input)
    at System.Windows.Input.InputProviderSite.ReportInput (InputReport inputReport)
    at System.Windows.Interop.HwndMouseInputProvider.Repo rtInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
    at System.Windows.Interop.HwndMouseInputProvider.Filt erMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
    at System.Windows.Interop.HwndSource.InputFilterMessa ge(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.Internal RealCall(Delegate callback, Object args, Int32 numArgs)
    at System.Windows.Threading.ExceptionWrapper.TryCatch When(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

    Comment


      #17
      Hello tradeesh,

      Thank you very much for your post.

      This error indicates that a script has been corrupted, e.g., because it was overwritten.

      Resetting the custom and internal scripts will resolve this. To do this, please first navigate to Documents > NinjaTrader 8, and rename the "bin" folder, e.g. to "bin-old".

      Once renamed, please perform a repair installation to replace this folder by following the steps below:
      • Shut down NinjaTrader
      • Go to your computer's Control Panel > Programs & Features (Note: search for 'Control Panel' to find it within the Windows Start Menu. This will be a different window than the Settings page)
      • Left-click once on NinjaTrader > select 'Repair' above the list of available programs
      • Restart the platform after it finishes repairing, and test for this behavior again.
      ​Please don't hesitate to let me know if you have any further questions about this!

      Comment


        #18
        NinjaTrader_Manfred the solution you gave me is basically reinstalling Ninjatrader, so it will remove all the custom script. The goal here is to keep the custom script I've modified and run it.


        Simply restarting the Ninjatrader make the error go away but whenever I modify the script on any place, it comes back up again. Everytime it comes up I have to restart the Ninjatrader which is annoying.

        Line number 239 is causing problem in PriceLevel.cs.
        Please see attached screenshot.
        Attached Files

        Comment


          #19
          Hello tradeesh,

          You can delete the @PriceLevels.cs file from Documents\NinjaTrader 8\bin\Custom\DrawingTools, and then run the repair to replace only this one file with the original.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #20
            Originally posted by NinjaTrader_ChelseaB View Post
            Hello tradeesh,

            You can delete the @PriceLevels.cs file from Documents\NinjaTrader 8\bin\Custom\DrawingTools, and then run the repair to replace only this one file with the original.
            I've run into this issue multiple times in the past and also have issues with Fibs at times. Attached some screen shots if it helps. Version 8.1.3.1. This issue causes the message box to pop up over the chart.




            Attached Files
            Last edited by neo302; 07-14-2024, 08:44 AM.

            Comment


              #21
              Hello neo302,

              This appears to be a custom script and not the @PriceLevels.cs file from NinjaTrader, also this appears to be Visual Studio and not the NinjaScript Editor of NinjaTrader.

              Chelsea B.NinjaTrader Customer Service

              Comment


                #22
                Originally posted by NinjaTrader_ChelseaB View Post
                Hello neo302,

                This appears to be a custom script and not the @PriceLevels.cs file from NinjaTrader, also this appears to be Visual Studio and not the NinjaScript Editor of NinjaTrader.
                Hey Chelsea,
                OK. This code is from my @PriceLevels.cs file and is in line ~182. Is this not around line 182 of bin>Custom>DrawingTools>@PriceLevels.cs ?
                If not, maybe an indicator I downloaded overwrote it? It says this at the top:
                //
                // Copyright (C) 2024, NinjaTrader LLC <www.ninjatrader.com>.
                // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
                //​
                Also, yes, I use Visual Studio to code.

                Thank you

                Comment


                  #23
                  Hello neo302,

                  Delete the file from Documents\NinjaTrader 8\bin\Custom\DrawingTools and run the NinjaTrader 8.1.3.1 installer to replace the file with the original.
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #24
                    Originally posted by NinjaTrader_ChelseaB View Post
                    Hello neo302,

                    Delete the file from Documents\NinjaTrader 8\bin\Custom\DrawingTools and run the NinjaTrader 8.1.3.1 installer to replace the file with the original.
                    https://account.ninjatrader.com/welcome-download
                    Hey ChelseaB,
                    Just FYI, I renamed the original file, did the install and used an app to compare them and the files are identical.
                    Thanks

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by argusthome, 03-08-2026, 10:06 AM
                    0 responses
                    89 views
                    0 likes
                    Last Post argusthome  
                    Started by NabilKhattabi, 03-06-2026, 11:18 AM
                    0 responses
                    48 views
                    0 likes
                    Last Post NabilKhattabi  
                    Started by Deep42, 03-06-2026, 12:28 AM
                    0 responses
                    31 views
                    0 likes
                    Last Post Deep42
                    by Deep42
                     
                    Started by TheRealMorford, 03-05-2026, 06:15 PM
                    0 responses
                    34 views
                    0 likes
                    Last Post TheRealMorford  
                    Started by Mindset, 02-28-2026, 06:16 AM
                    0 responses
                    69 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Working...
                    X