Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

same name for ind and strat

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

    same name for ind and strat

    this is both interesting and annoying at the same time

    I have been naming my strats using the date....e.g. ABC_20100901

    I decided to use this same name for an indicator....

    Later I decided I should differentiate by naming the ind ABCi_20100901

    When I went to name the strat ABCs_20100901, I noticed that it already had the name in the chart with the 'i'....i.e. the strat had picked up the ind name without me assigning it.

    So...I saved the strat as ABCs_20100901...no problem in that the new name appeared on the top of the code editor....however....when I try to compile with the new name I get an error that a strat named ABCi_20100901 already exists...even though I am trying to compile ABCs_20100901

    no matter what name I try to compile the strat under, it retains the 'i' name in the code as
    public class TTTi_20100901 : Strategy

    can not seem to get out of this loop...help?

    #2
    resetDB and repair DB had no effect

    essentially what is happening is NT saves the file under the new name however does not change the public class code....which it usually does

    Comment


      #3
      grabbing at straws, I cleaned the registry....no help

      interesting that the strat and ind both run perfectly in a new chart/workspace...both with the same name....ABCi_20100901....even though that file name does not exist in either the custom/ind or strat folders

      Comment


        #4
        ATI user,

        To change the name of a script you should right click > Save As and then type a new name. There are a lot of generated code in the wrapper and such that needs to have the change propagated all the way through or else it won't work. Going through the Save As process will redo all the wrappers as necessary with the new name.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Josh View Post
          ATI user,

          To change the name of a script you should right click > Save As and then type a new name. There are a lot of generated code in the wrapper and such that needs to have the change propagated all the way through or else it won't work. Going through the Save As process will redo all the wrappers as necessary with the new name.
          yes....my point being that SaveAs was not working...

          to reproduce.....create a strat named ABCDE....also create an indicator called ABCDE....then change the name of the ind to ABCDEF....and you will find that NT not only changes all references to the old name in the ind....but also in the strat....even though you are only changing the ind name.

          this is a bug...or at least there should be a fail-safe that will not allow SaveAs in the same name as an existing ind or strat

          it took me 7 iterations of SaveAs test1, test2, test3, test4, test5, test6, test7, each with compile errors due to the reference/call having been change in the strat....each time I deleted the old files and eventually it cleared.

          working fine now...thanks.

          PS....I had a problem maybe 2 years ago wherein I did SaveAs and double clicked and existing name in the list....similar issue....forget how I got out of that one....anyway possibly some issue in SaveAs?

          Comment


            #6
            ATI user,

            Once you are in an uncompileable state, Save As for sure won't work. You need to clear out the conflicts/inconsistencies then do it again. Conflicts/inconsistencies usually arise from improper manual changing of names without fully changing it across all areas required.

            I just tried it on my end several times here and it was successful.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              did you try to reproduce the original problem ?...i.e. NT changed the name and all internal refrences in the strat even though I was doing SaveAs in the indicator?

              Comment


                #8
                Yes, I have already tried renaming both a strategy and an indicator with Save As. Both of which worked.

                Right click>Save As>new name>recompile=error free
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  thanks Josh...just lucky here I guess

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  605 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  351 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  105 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  560 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  561 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X