Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

In Ninjascript, can filename be different from class name?

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

    In Ninjascript, can filename be different from class name?

    Dear Ninjatrader Support,
    I have a filename different from class name.
    Eg: if FileName= abc.cs
    then inside the SAME file, i have a class defined as follows:
    public class DifferentFromFileName{

    ...
    }
    This actually compiled well, executed on my local box. however, when i moved to my cloud server, there was an error importing this particular file. I couldnt remove that package using Controller-Tool-RemoveNinjascript Assembly.
    i had remove and reinstall Ninjatrader 8 to completely wipe off everything and roll back and import old package.
    Can you pls advise if filename can be different from class name.?
    I need this approach such as filename as different to classname, for some security reasons.
    thanks

    #2
    I am thinking, if i export a file with different class name, then i should be able to import the same file within DLL, with a different class name. Not sure why it didnt work

    Comment


      #3
      Hello prabbala,

      Thanks for your post.

      File names can be separate from class names. Class names are what makes each NinjaScript unique and are what you should be ensuring are unique. If you are seeing duplicate errors, this would likely be due to the same class name being reused between two files.

      If you import a DLL which contains scripts with a different class name, you will not encounter conflicts.

      If you want to update the scripts, then you should use the same class name for the scripts and the same file name for the DLL so the DLL gets overwritten with updated scripts.

      Please let us know if you have any additional questions.
      JimNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Max238, Today, 01:28 AM
      1 response
      21 views
      0 likes
      Last Post CactusMan  
      Started by giulyko00, Yesterday, 12:03 PM
      2 responses
      10 views
      0 likes
      Last Post giulyko00  
      Started by r68cervera, Today, 05:29 AM
      0 responses
      4 views
      0 likes
      Last Post r68cervera  
      Started by geddyisodin, Today, 05:20 AM
      0 responses
      6 views
      0 likes
      Last Post geddyisodin  
      Started by JonesJoker, 04-22-2024, 12:23 PM
      6 responses
      37 views
      0 likes
      Last Post JonesJoker  
      Working...
      X