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

NinjaScript generated code..... Issues...

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

    NinjaScript generated code..... Issues...

    Hi Guys,

    I am trying to better understand the NinjaScript auto generated code as it is getting in the way of me doing a few things.

    I have an indicator which has about 250 user definable parameters in the property section (I know its alot!) Many of the vars are for visual settings but there are quite a few which need to be changed to effect the operation of the indicator.

    Now, I want to acces one of the data-series from the above mentioned indicator from a strategy. This is where it gets a little complicated.

    Firstly, when add the indicator to the strategy e.g. add((TheIndicator(..... the parameters are displayed but there are only about 45 of them there.. There are 200 missing in other words. Now I can successfully fill out those 45 and the indicator is added no problem so accessing the data series wouldnt be an issue.

    The issue for me is that I need be able to define some of the variables that arnt in the list.

    My solutoin was to just change [GridCategory] under all the parameters to [Category] as I have read that this will cause the parameters not to need to be defined in the strategy code and this would be fine as I would just modify the default values in the indicator code and everything would be fine. BUT..... when i do this, the NinjaScript auto generated code doesnt update itself and still has the 45 vars which need to be read.....

    All that info above basically comes down to a few questions,

    1. Is there a way to make the NinaScript auto generated code re-generate? when does it generate in the first place? (got me stumped)

    2. Why is it that only 45 of my 250 parameters are coming up in the parameter section when calling the indi in the strategy code?

    3. Anyone have a solution for how I can just make all my existing parameters no longer public so that I can just change them all in my code? (ninjascript auto generated code would need to be updated for this I imagine)

    I would like to be able to do all this without effecting the usablity of the indicator as I still need to have the parameters available for the user to define in the properties sections... hmmmmm.......

    Any suggestions would be greatly appreciated..

    Cheers.

    #2
    Hello marty087,

    Thank you for your post.

    I am not aware of a method to make it user defined parameters are not listed when calling the indicator. I have not seen changing the GridCategory to Category change this either.

    Why do you need to update the NinjaScript generated code? What is not being changed that needs to be changed?

    I will look into the 45 out of 250 parameters further on my end.

    Comment


      #3
      Originally posted by NinjaTrader_PatrickH View Post
      Hello marty087,

      Why do you need to update the NinjaScript generated code? What is not being changed that needs to be changed?
      Hi Pat,

      I dont think my NinjaScript generated code updates at all any more. Here is an example....


      See pic labeled "AutoGenerateCodeExample1" below. I have temporarily removed the code which defines a bool which is included in the parameters. Now when I complile I get errors saying that the Var is not defined (see pic AutoGenerateCodeExample2 below) . The errors exist in the NinjaScript auto generated code.

      The same will happen if I change the name of the indicaor by Saving as a new file name, Once trying to compile, I will get all these errors from the auto generated code which is still referencing the old name. I have to Find & Replace all the old Name references with the new.

      Is there a way to make the NinjaCode generate again?
      Attached Files

      Comment


        #4
        Originally posted by marty087 View Post
        Hi Pat,

        I dont think my NinjaScript generated code updates at all any more. Here is an example....


        See pic labeled "AutoGenerateCodeExample1" below. I have temporarily removed the code which defines a bool which is included in the parameters. Now when I complile I get errors saying that the Var is not defined (see pic AutoGenerateCodeExample2 below) . The errors exist in the NinjaScript auto generated code.

        The same will happen if I change the name of the indicaor by Saving as a new file name, Once trying to compile, I will get all these errors from the auto generated code which is still referencing the old name. I have to Find & Replace all the old Name references with the new.

        Is there a way to make the NinjaCode generate again?
        Just delete all the old generated code, than F5 again
        If you still identify nothing changed --> your coding is incorrect somewhere, that's not the fault of NT.

        For the "invisible" public properties you mentioned, what GridCategory have you applied on them? I think they should be "Parameters"?

        Thanks.
        Pi
        Last edited by ninZa; 01-13-2015, 03:26 AM.
        ninZa
        NinjaTrader Ecosystem Vendor - ninZa.co

        Comment


          #5
          Correct, the 'invisble' ones would be under Parameters, the regular ones would be GridCategory and included in the constructors. Yes, if you remove the wrappers part and have a valid description for the study > a compile should regenerate those. Alternate approach could be copying over to a new blank file and then running a compile.
          BertrandNinjaTrader Customer Service

          Comment


            #6
            Originally posted by marty087 View Post
            Hi Pat,

            I dont think my NinjaScript generated code updates at all any more. Here is an example....


            See pic labeled "AutoGenerateCodeExample1" below. I have temporarily removed the code which defines a bool which is included in the parameters. Now when I complile I get errors saying that the Var is not defined (see pic AutoGenerateCodeExample2 below) . The errors exist in the NinjaScript auto generated code.

            The same will happen if I change the name of the indicaor by Saving as a new file name, Once trying to compile, I will get all these errors from the auto generated code which is still referencing the old name. I have to Find & Replace all the old Name references with the new.

            Is there a way to make the NinjaCode generate again?
            Have you provided a "Description" for the class? Is that description a single string, or a string expression?

            Comment


              #7
              Hi Guys,

              Firstly, thank you all for your help.

              I have noticed that if I generate a brand new indicator and compile it, the NinjaCode is auto generated. If I delete that code and re-compile it re-appears.

              So I have copied and pasted my code into a fresh file and deleted the NinjaCode and re-compiled and the compilation finishes without error but the NinjaCode doesn't re-appear.

              Furthermore to eliminate the chance that any of the causes for the NinjaCode not generating is caused by the publicly defined parameters, i have removed them all and copied the code into a fresh indicator and re-compiled. The NinjaCode doesnt re-generate. If I delete it, it just never comes back/

              Koganam, when you say "description for the class" I'm afraid I dont quite understand, as Im only a hoby profgrammer. Do you mean the description which shows in the GridCategory e.g [Description("Description goes here")] If thats is what you meant then some of these are quite long. But due to the above mentioed example, these are not the cause of the NinjaCode not re-generating...

              The only solution I have come up with is to generate the auto ninjacode in another indicator which has no public parameters. Copy and paste that auto ninjacode into my indicator and change the indiator name within it. Then compile the indicator and I can access it sucessfully from a strategy without having to define any overloads, so this seems to solve my probllem really... Although I would like to better understand whats going on here.

              I guess due to the fact that I am using some unsupported code in my program that this is cause errors behind the scenes which is causing the NinjaCode not to generate? If this is the case, is the some sort of log where I can see the issue?

              Thanks again for the replies.

              Comment


                #8
                Originally posted by koganam View Post
                Have you provided a "Description" for the class? Is that description a single string, or a string expression?
                I think Koganam referred to the description of the indicator, not the properties.
                ninZa
                NinjaTrader Ecosystem Vendor - ninZa.co

                Comment


                  #9
                  Originally posted by ninZa View Post
                  I think Koganam referred to the description of the indicator, not the properties.
                  Thanks for clarifying this NinZa. Turns out Koganam was on the money. I must have removed my indicator class description long ago and this was causing the NinjaCode not to generate. I just re-added the description before the indicator class line like below

                  [Description("GeoKing")]
                  public class GKNTv3PlusTime : Indicator

                  Now the Ninjacode is re-generating perfectly.

                  Its a relief to see that all my custom code can stay!

                  Comment


                    #10
                    Originally posted by marty087 View Post
                    Thanks for clarifying this NinZa. Turns out Koganam was on the money. I must have removed my indicator class description long ago and this was causing the NinjaCode not to generate. I just re-added the description before the indicator class line like below

                    [Description("GeoKing")]
                    public class GKNTv3PlusTime : Indicator

                    Now the Ninjacode is re-generating perfectly.

                    Its a relief to see that all my custom code can stay!
                    Oh oh you cannot remove the indicator description

                    Regarding the invisible properties, do you want to continue solving that problem?

                    Pi
                    ninZa
                    NinjaTrader Ecosystem Vendor - ninZa.co

                    Comment


                      #11
                      Originally posted by ninZa View Post
                      Oh oh you cannot remove the indicator description

                      Regarding the invisible properties, do you want to continue solving that problem?

                      Pi
                      Well, now that the NinjaCode is generating correctly. Changing "GridCategory" over to just "Category" solves that perfectly.

                      So I can did a simple Find and Replace for all the [GridCategory("Grid title goes here")] and chnaged it over to [Category("Grid title goes here")]

                      After re-compiling and then adding my indi to the strategy, the public parameters are 0.

                      So all I have to do now is go through the 250 or so paramterers manually and chose the ones I want to be able to define in the overload and change these ones over to GridCategory.

                      I have done a quick little test and it all works smoothly

                      Comment


                        #12
                        Originally posted by marty087 View Post
                        Well, now that the NinjaCode is generating correctly. Changing "GridCategory" over to just "Category" solves that perfectly.

                        So I can did a simple Find and Replace for all the [GridCategory("Grid title goes here")] and chnaged it over to [Category("Grid title goes here")]

                        After re-compiling and then adding my indi to the strategy, the public parameters are 0.

                        So all I have to do now is go through the 250 or so paramterers manually and chose the ones I want to be able to define in the overload and change these ones over to GridCategory.

                        I have done a quick little test and it all works smoothly
                        So to summarize:
                        • GridCategory: the property is visible when accessed from other indicators
                        • Category: the property is invisible
                        • No category (the line is simply removed): the property is also invisible
                        ninZa
                        NinjaTrader Ecosystem Vendor - ninZa.co

                        Comment


                          #13
                          Originally posted by marty087 View Post
                          Well, now that the NinjaCode is generating correctly. Changing "GridCategory" over to just "Category" solves that perfectly.

                          So I can did a simple Find and Replace for all the [GridCategory("Grid title goes here")] and chnaged it over to [Category("Grid title goes here")]

                          After re-compiling and then adding my indi to the strategy, the public parameters are 0.

                          So all I have to do now is go through the 250 or so paramterers manually and chose the ones I want to be able to define in the overload and change these ones over to GridCategory.

                          I have done a quick little test and it all works smoothly
                          So to summarize:
                          • GridCategory: the property is visible when accessed from other indicators
                          • Category: the property is invisible
                          • No category (the line is simply removed): the property is also invisible
                          ninZa
                          NinjaTrader Ecosystem Vendor - ninZa.co

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by warreng86, 11-10-2020, 02:04 PM
                          6 responses
                          1,357 views
                          0 likes
                          Last Post mathewlo  
                          Started by Perr0Grande, Today, 08:16 PM
                          0 responses
                          3 views
                          0 likes
                          Last Post Perr0Grande  
                          Started by elderan, Today, 08:03 PM
                          0 responses
                          5 views
                          0 likes
                          Last Post elderan
                          by elderan
                           
                          Started by algospoke, Today, 06:40 PM
                          0 responses
                          10 views
                          0 likes
                          Last Post algospoke  
                          Started by maybeimnotrader, Today, 05:46 PM
                          0 responses
                          12 views
                          0 likes
                          Last Post maybeimnotrader  
                          Working...
                          X