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

Dynamic Properties

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

    Dynamic Properties

    Can we make dynamic property groups that show/hide when another property is changed?

    For example I have a Boolean checkbox property for some value. If checked another property group shows with settings for that enabled property.

    Thanks.

    #2
    Hello,

    yes this is possible, I have attached a couple of samples that demonstrate different ways to toggle properties. One uses an Expandable object/ typeconverter and is slightly more customizable, the other uses Reflection and is intended for a more inline use.

    Please let me know if I may be of additional assistance.
    Attached Files
    JesseNinjaTrader Customer Service

    Comment


      #3
      Perfect, thanks Jesse

      Comment


        #4
        DynamicPropertyExample is still unstable.

        Originally posted by NinjaTrader_Jesse View Post
        Hello,

        yes this is possible, I have attached a couple of samples that demonstrate different ways to toggle properties. One uses an Expandable object/ typeconverter and is slightly more customizable, the other uses Reflection and is intended for a more inline use.

        Please let me know if I may be of additional assistance.

        Hello Jesse,

        I have tested the DynamicPropertiesExampleNT8 that you had attached. It works when applied to a chart, but is not stable in a sense that whenever NinjaTrader compiles

        --> the indicator when refreshed on a chart after a recompile throws an exception with the three error messages

        "Error on getting/setting proprety 'MyProperties' for DynamicPropertyExample ...."
        "Unable to create instance of NinjaScript "DynamicPropertieyExample ... "
        " Failed to restore Indicator.NinjaTrader.NinjaScript.Indicators.Dynam icPropertyExample"

        -> and disappears from all charts

        In fact, every time that NinjaTrader is recompiled, it assumes that the implementation for this indicator has changed and all charts with the indicator need to be rebuilt.

        Would you have any idea, how to modify it to make it usable?

        Comment


          #5
          Refers to NinjaTrader 8.0.4.0

          This is the error message from the trace file, which I get for every refresh of the indicator after compiling NinjaTrader:

          2017-02-19 10:07:04:349 ERROR: Error on getting/setting property 'ExampleClassVariable' for NinjaScript 'PublicClassPropertyExample': Object of type 'NinjaTrader.NinjaScript.Indicators.PublicClassPro pertyExample+ExampleClass' cannot be converted to type 'NinjaTrader.NinjaScript.Indicators.PublicClassPro pertyExample+ExampleClass'.
          2017-02-19 10:07:04:349 ERROR: Unable to create instance of NinjaScript 'PublicClassPropertyExample'. Most likely either the implementation no longer exists, there is no default constructor defined, the default constructor does not work correctly, or the 'OnStateChange' implementation for State=SetDefaults is flawed: System.InvalidOperationException: 'DrawHorizontalGridLines' cannot be set from this state. Please see the Help Guide article on 'DrawHorizontalGridLines' for more information. at NinjaTrader.NinjaScript.IndicatorBase.set_DrawHori zontalGridLines(Boolean value) at NinjaTrader.NinjaScript.IndicatorBase.CopyTo(Ninja Script ninjaScript) at NinjaTrader.Gui.NinjaScript.IndicatorRenderBase.Co pyTo(NinjaScript ninjaScript) at NinjaTrader.NinjaScript.NinjaScript.Clone()
          2017-02-19 10:07:04:349 ERROR: Failed to restore Indicator 'NinjaTrader.NinjaScript.Indicators.PublicClassPro pertyExample'. Most likely (a) the implementation changed or (b) one or more properties have been renamed or removed or (c) the custom assembly which implements this Indicator no longer is there.
          Of course I did not do any changes to the indicator.

          Comment


            #6
            Any help to make the DynamicPropertiesExampleNT8 work?

            Comment


              #7
              Originally posted by Harry View Post
              Any help to make the DynamicPropertiesExampleNT8 work?
              Take a look at the PivotsTypeConverter in the default Pivots indy.. Is something like this what your looking for?


              -=Edge=-
              NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

              Comment


                #8
                Originally posted by -=Edge=- View Post
                Take a look at the PivotsTypeConverter in the default Pivots indy.. Is something like this what your looking for?


                Thank you, but this is not what I am looking for. The PivotsTypeConverter dynamically adds or removes properties, while I am looking for expandable properties.

                The sample posted by NinjaTrader Jesse shows how to build expandable properties, but unfortunately it does not work as expected.

                So I am looking for someone to tell me how to modify the sample in order to make it work. Currently the sample indicators throws an exception on all charts where it has been added to after each recompile of NinjaTrader.

                Comment


                  #9
                  Hello,

                  Thank you for the replies on this item.

                  After further review, it does appear that changes made in the current release prevent this item from being loaded correctly after a recompile. I do also see that this is currently resolved in the internal build from today. I will keep a watch on this topic, if possible I will test this prior to the next major release to check at that point if we still have any problems. The syntax in the file does not need any adjustment to work in the current internal build.

                  I look forward to being of further assistance.
                  JesseNinjaTrader Customer Service

                  Comment


                    #10
                    Hi Jesse,


                    Thank you for your answer. Much appreciated.

                    I look forward to testing the script once the next release is out.

                    Comment


                      #11
                      Originally posted by NinjaTrader_Jesse View Post
                      Hello,

                      Thank you for the replies on this item.

                      After further review, it does appear that changes made in the current release prevent this item from being loaded correctly after a recompile. I do also see that this is currently resolved in the internal build from today. I will keep a watch on this topic, if possible I will test this prior to the next major release to check at that point if we still have any problems. The syntax in the file does not need any adjustment to work in the current internal build.

                      I look forward to being of further assistance.

                      Hello Jesse,

                      I have checked the issue with the prior release 8.0.3.1 - and the code did not work either.

                      I repeat that the sample indicator that you have supplied can be added to a chart.

                      But as soon as NinjaTrader recompiles (for example when another indicator was changed or imported), the sample code will throw a number of exceptions as documented below and then disappear from any chart when it is refreshed.

                      Both releases 8.0.4.0 and 8.0.3.1 show the same behavior.

                      Comment


                        #12
                        Hello Harry,

                        Yes, I am unsure of when this was affected, this was working for the release at the time of the original post but since has become nonworking. I will continue to monitor this item through the next release cycle to check that the error does not come back.

                        I look forward to being of furhter assistnace.
                        JesseNinjaTrader Customer Service

                        Comment


                          #13
                          Jesse,

                          Thank you for your help.

                          I will wait for the next release and then test it again.

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Christopher_R, Today, 12:29 AM
                          0 responses
                          9 views
                          0 likes
                          Last Post Christopher_R  
                          Started by sidlercom80, 10-28-2023, 08:49 AM
                          166 responses
                          2,235 views
                          0 likes
                          Last Post sidlercom80  
                          Started by thread, Yesterday, 11:58 PM
                          0 responses
                          3 views
                          0 likes
                          Last Post thread
                          by thread
                           
                          Started by jclose, Yesterday, 09:37 PM
                          0 responses
                          8 views
                          0 likes
                          Last Post jclose
                          by jclose
                           
                          Started by WeyldFalcon, 08-07-2020, 06:13 AM
                          10 responses
                          1,415 views
                          0 likes
                          Last Post Traderontheroad  
                          Working...
                          X