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

Problem compiling when one indicator references another

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

    Problem compiling when one indicator references another

    I have the following:

    Value = myIndicator()[0] ...to get current bar value
    Value1 = myIndicator()[1] ...to get prior bar value

    When I compile this I get an error:

    'NinjaTrader.Indicator.myIndicator' is a 'type' but is used like a 'variable' CS0118

    for each such reference (there are several to several different indicators)

    Has some thing changed?
    This is old code that has compiled many times before... I just made some unrelated changes.

    I believe this is what is documented... as the correct way to reference another indicator.

    HELP, Please

    #2
    Is the call perhaps execting any parameter inputs?

    Is the compile error really found in those two lines?

    Please double click on the error at the bottom, since NinjaTrader would compile all indicators into one assembly all errors of all your NinjaScript file would be listed there.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      NO, there are no parameter inputs to any of the several indicators involved...

      YES, in the real code there are 16 similar calls to 5 different indicators... all are the same


      Sorry, I am not sure what it is you want me to double click at the bottom....

      Comment


        #4
        When you compile, all compile errors for all your NinjaScript files are listed at the bottom of the editor - please double click on those reported, you might think the error is in i.e. File A where as it's located in File B and you needed to address it there to be able to compile.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Thanks Bertrand, now I see....

          Yes, I have looked closely at all of the errors.....

          There are 16 of them...
          they all occur in a single file.... the indicator that references the others.
          they are all on exactly this type of reference....

          When I remove the referencing indicator (delete source), the referenced indicators all compile fine.

          What next?

          Comment


            #6
            ts_gordo, if you don't want to post it here, please contact me directly at support at ninjatrader dot com with the source file giving you the issue trying to compile, I'll then take a look.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Here is what I found:

              I built and exported an assembly of all the referenced indicators. (previously deleted referencing indicator source)

              Deleted all the sorces from the editor

              Imported the assembly (the one just exported)
              re-introduced the source of the referencing indicator

              It recompiles -- NO ERRORS!

              So, the reference syntax works if the things are compiled seperately, NOT if compiled together.

              This is problematic because I NEED to produce a SINGLE assembly for distribution.

              Hope this helps.

              Comment


                #8
                ts_gordo, are you perhaps running into this issue here?

                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  I don't think so.

                  Think of it this way: I have 5 indicators (lets call them Inds-A). I can compile and export them without error.
                  I also have an other indicator (Ind-B) that references each of the indicators in Inds-A.

                  Here is what happens:

                  When INDS-A are imported into NT as an assembly, Ind-B compiles and exports with out error.

                  But, when I have the source codes for INDS-A and IND-B in NT and try to compile any one (recognizing that ALL will Compile) I get the CS0118 errors reported -- all against the lines in Ind-B that reference Inds-A.

                  Comment


                    #10
                    ts_gordo,

                    To cover all bases, please be sure when you are using source codes to remove all NinjaScript assemblies that may be duplicates.
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      To NT_Josh or NT_Bertrand is there a way to email the support staff with a .txt file? I just tried sending my script to Bertrand to take a look at some of my compiling errors. But with a character limit of 5000 in an PM, I was only over by 10000

                      Comment


                        #12
                        You could send it to support at ninjatrader dot com to my Attn. Thanks
                        BertrandNinjaTrader Customer Service

                        Comment


                          #13
                          Bertrand please, be sure ALL BASES ARE COVERED!

                          To my mind this is real simple:

                          With two indicators and one indicator references the other, they CANNOT be compiled together without errors.

                          Yet, they do compile seperately (correct order, of course)

                          Comment


                            #14
                            ts_gordo, what Josh meant is not working together with sources and compiled assemblies providing the same methods, as you could run into issues with duplicates then.

                            If you remove custom assemblies present and then compile the new assembly with taking note to the previous 'export problems' link given, does the issue persist?
                            BertrandNinjaTrader Customer Service

                            Comment


                              #15
                              This is what I have to do. I use a separate install of NT on a laptop. When I want to compile to object code I move the .cs file or in your case a group if .cs files to that install. These would be the only indicators present besides the standard NT indicators. Now when compiling there should be no problem. It's a hassle but works nicely. As a suggestion though, somehow make NT able to compile an assembly without it seeing unrelated installed .dll files and requiring them to be present on a new install. Very frustrating!

                              Dan
                              eDanny
                              NinjaTrader Ecosystem Vendor - Integrity Traders

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by funk10101, Today, 12:02 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post funk10101  
                              Started by gravdigaz6, Yesterday, 11:40 PM
                              1 response
                              8 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by MarianApalaghiei, Yesterday, 10:49 PM
                              3 responses
                              10 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by XXtrader, Yesterday, 11:30 PM
                              0 responses
                              4 views
                              0 likes
                              Last Post XXtrader  
                              Started by love2code2trade, 04-17-2024, 01:45 PM
                              4 responses
                              28 views
                              0 likes
                              Last Post love2code2trade  
                              Working...
                              X