Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator cannot be serialized, ONLY after exporting

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

    Indicator cannot be serialized, ONLY after exporting

    I have some old NT7 indicators that haven't changed in years, but now when I export them (encrypted), then import them on another machine I get serialization errors when saving the workspace.

    They work fine locally (which is running the source code).

    The indicators import successfully on another machine and they run fine on a chart. However, if I save the workspace or try to create a chart template, I get serialization errors.

    Exported on 7.40, imported into 7.41

    Again, these worked fine for years. Is there any way of determining which param is causing the issue? Or any other technique in determining what is the issue?

    Also, in the Trace file I'm seeing "System.IO.FileLoadException: AssemblyResolveEvent handlers cannot return Assemblies loaded for reflection only." Could that be a root issue of something?

    Thank you

    EDIT: I re-exported in 7.42 and now I can't import due to "duplicate method names" error even after removing everything and restarting. NinjaTrader is SO incredibly fragile! So, now I'm stuck.
    Last edited by neoikon; 07-14-2021, 08:59 AM.

    #2
    Hello neoikon,

    Currently, NinjaTrader 7 is no longer under active development. If you are on NinjaTrader 7, I highly recommend moving to NinjaTrader 8 before NinjaTrader 7 reaches its end of life.
    Updates to NinjaTrader will contain the latest security updates and bug fixes, as well as new instruments and rollover dates.


    While serialization errors are usually related to public variables that are not using the XmlIgnore() attribute, It might be something in the script itself. The error notes something using reflection.
    https://ninjatrader.com/support/help...lor_inputs.htm
    http://www.ninjatrader.com/support/f...t.php?p=124724

    Please create a simple demonstration script, or reduce the script to remove everything that is not related to reproducing the error and provide the open source export of demonstration script so that we can test.

    To export a NinjaTrader 7 NinjaScript so this may be shared and imported by the recipient do the following:
    1. Click File -> Utilities -> Export NinjaScript
    2. Enter a unique name for the file in the value for 'File name:'
    3. Select the strategy from the objects list on the left -> click the right facing arrow ">" to add the strategy to the export
    4. Click the 'Export' button -> click 'yes' to add any referenced indicators to the export -> click OK to clear the export location message
    The exported file will be in the following location:
    • (My) Documents\NinjaTrader 7\bin\Custom\ExportNinjaScript\<export_file_name.z ip>
    Below is a link to the help guide on Exporting NinjaScripts.
    http://www.ninjatrader.com/support/h...nt7/export.htm

    Once exported, please attach the file as an attachment to your reply.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I want nothing more than to ditch NT7. But I have customers that still use it.

      Again, the script works fine locally. It only breaks after exporting. So, strip it down to what that is causing the issue?

      EDIT: I re-exported in 7.42 and now I can't import due to "duplicate method names" error even after removing everything and restarting. NinjaTrader is SO incredibly fragile! So, now I'm stuck.
      Last edited by neoikon; 07-14-2021, 09:26 AM.

      Comment


        #4
        Hello neoikon,

        Is the open source version of the script still in NinjaTrader?

        Are there other files that are using class names that are in this file?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          I've seen successfully exported zip files fail to import due to a
          public property based upon an internal public enum that was not
          fully qualified with its complete namespace.

          That is,
          Code:
          public MyEnum MyValue
          {
          ...
          }
          needed to be,
          Code:
          public <fully.qualified.namespace>.MyEnum MyValue
          {
          ...
          }
          Once MyEnum was fully qualified, the import worked.

          I never had a problem with NinjaScript supplied enums, so I never
          fully qualify those.

          It was only new public enums defined specifically by an indicator
          or strategy.

          Properties using those enums needed a fully qualified namespace
          to avoid the import problem.

          Being 'public' wasn't enough, the enum also needed to be fully
          qualified when used in a property type -- even if the namespace
          was previously declared with a 'using' directive.


          Just fyi.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by aelagha, Today, 12:21 AM
          0 responses
          18 views
          0 likes
          Last Post aelagha
          by aelagha
           
          Started by rcrook23, Today, 03:06 AM
          1 response
          11 views
          0 likes
          Last Post rcrook23  
          Started by timekiller1985, Today, 02:46 AM
          1 response
          12 views
          0 likes
          Last Post NinjaTrader_Jason  
          Started by sidlercom80, Today, 01:19 AM
          0 responses
          5 views
          0 likes
          Last Post sidlercom80  
          Started by xxzbill, Yesterday, 04:07 PM
          3 responses
          14 views
          0 likes
          Last Post xxzbill
          by xxzbill
           
          Working...
          X