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

How can SetDefaults tell whether it is on a daily or weekly (etc) chart?

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

    How can SetDefaults tell whether it is on a daily or weekly (etc) chart?

    The proper default for one of my parameters depends on whether the indicator is on a daily chart, a weekly chart, etc.

    How do I find which the chart is from SetDefaults so I can set the correct default value?

    I know I can handle this in Configure but that would require second-guessing the user, which would be a bad idea.

    #2
    Hello ETFVoyageur,

    SetDefaults cannot tell what series you have selected, that is called before that process happens. SetDefaults is only used to provide default starting values for the script to display in the user interface before you start manually configuring user inputs or properties.

    You can read about the liffecycle of a NinjaScript object here: https://ninjatrader.com/support/help...fecycle_of.htm
    JesseNinjaTrader Customer Service

    Comment


      #3
      For some properties, the correct default value depends on whether the chart is daily, weekly, etc.

      When the Indicators dialog is popped up, it contains an "Input series" item.

      What I am asking for is a way to ensure that the property defaults are appropriate for the input series being shown.

      Is there any way to ensure such consistency within the dialog?

      Comment


        #4
        Hello ETFVoyageur,

        In that situation I couldn't really suggest anything if you need those defaults in SetDefaults, that is not how the lifecycle of the script works so that would not be possible. I could only suggest to avoid putting yourself into that situation and limit the users input for those type of inputs. You can use the bar information later when the script is running to delegate logic as the script processes but not for configuring defaults that the user would select.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Thanks, Jesse,

          That's what I was afraid of. I'll work with it.

          I suggest that it is a system design bug that could be fixed without breaking anything. It should be possible for an indicator to put up defaults consistent with the input series. As far as I can tell, the input series is, or could be, known to the system in time that its value could be accessible in SetDefaults. Please enter a bug report that, in this case, it is not possible for the indicator to set default values consistent with the input series.

          Comment


            #6
            Hello ETFVoyageur,

            This would not be a bug or something I can report, that is the intended lifecycle of the script. Many properties cannot be accessed during SetDefaults, SetDefaults is called before the script is even applied to the chart to populate the property grid and get other values the the indicators name. Working with bar data at that point is not possible because it is unknown. Most properties that cannot be used at that time specify that in their help guide page. For example:
            https://ninjatrader.com/support/helpGuides/nt8/barsperiod.htm
            https://ninjatrader.com/support/helpGuides/nt8/bars.htm


            Warning: This property should NOT be accessed within the OnStateChange() method before the State has reached State.DataLoaded

            JesseNinjaTrader Customer Service

            Comment


              #7
              There is more than one kind of bug. One kind is when things do not work as designed, such as when they do not function as the documentation says they should. I am not alleging this kind of bug. I believe that it is working as designed.

              There is another kind of bug, though, which your reply ignores -- a design bug. That is when the system is working as designed, but the design should be changed. My report is for a design bug. At least to me, it is an obvious out-and-out design bug that there is no way for an indicator to set default values that make sense for the input series. When the dialog goes up, the values in the dialog should be consistent before the user changes anything. The current system design makes that impossible. That is why I allege that there is a design bug.

              Please report the bug. "Working as designed" is not an answer to a design bug.

              Working with bar data at that point is not possible because it is unknown.
              No one is asking for that. I'm just asking to know the input series that will be listed for the dialog you are asking me to post defaults for. The system obviously has that information at that time because it puts it into the dialog. I am not asking to access the series itself, which can't be available until later..
              Last edited by ETFVoyageur; 05-31-2024, 09:55 PM.

              Comment


                #8
                Hello ETFVoyageur,

                If you want to put in a feature request you can, there is a sub forum for that purpose. This is not a bug of design, it is intended to work that way. I can't report anything here so if you want to see something change please use the suggestions and feedback forum and post a small note about what you want changed, not about bugs because this is not one.

                JesseNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by HappyTrader76, 06-11-2024, 03:29 AM
                10 responses
                46 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by Stanfillirenfro, Today, 05:35 AM
                0 responses
                4 views
                0 likes
                Last Post Stanfillirenfro  
                Started by Taddypole, Yesterday, 12:56 PM
                2 responses
                9 views
                0 likes
                Last Post Taddypole  
                Started by iq200, Today, 04:26 AM
                0 responses
                4 views
                0 likes
                Last Post iq200
                by iq200
                 
                Started by Uregon, Today, 03:50 AM
                0 responses
                6 views
                0 likes
                Last Post Uregon
                by Uregon
                 
                Working...
                X