Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

tick size

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

    tick size

    I have a tickSize property

    [Range(1, double.MaxValue),
    NinjaScriptProperty]
    [Display(ResourceType = typeof(Custom.Resource), Name = "tickSize", GroupName = "NinjaScriptParameters", Order = 0)]
    public double tickSize
    { get; set; }

    that I'd like to initialize with Bars.Instrument.MasterInstrument.TickSize and use in my code.

    can this be done, if so can I do this in OnStateChange?

    #2
    Why are you setting up tick size like this? You cannot change it. Try declaring the variable:
    double tickSize;
    Then in State.Configure:
    tickSize = TickSize;
    eDanny
    NinjaTrader Ecosystem Vendor - Integrity Traders

    Comment


      #3
      Hello dibDab,

      Thank you for your note.

      What is your purpose for using the tickSize property? TickSize is already available per the instrument's settings in the database:


      Are you able to provide an example of what you plan to use this for so I may better assist you?

      I look forward to your clarification.

      Comment


        #4
        I wanted to display tickSize in the UI as a property, initialised as Bars.Instrument.MasterInstrument.TickSize and allow it to be changed?

        Comment


          #5
          Hello dibDab,

          Thank you for clarifying.

          It is not supported to change Bars.Instrument.MasterInstrument.TickSize as a property in the script because this is a value saved in the instrument database. Tick sizes are set by the exchanges that instruments are traded on and not by NinjaTrader itself, so even manually changing the tick size in the database could lead to some unexpected results. If you are wanting to use a tick size value for calculations in your script, you could set a different variable that defaults to the value of Bars.Instrument.MasterInstrument.TickSize and could be manually changed. That could look something like the following snippet:

          Code:
          protected override void OnStateChange()
                  {
                      if (State == State.SetDefaults)
                      {
                          SizeOfTick                    = Bars.Instrument.MasterInstrument.TickSize;
                      }
                  }
                  #region Properties
                  [NinjaScriptProperty]
                  [Range(1E-05, double.MaxValue)]
                  [Display(Name="SizeOfTick", Description="Tick Size.  Defaults based on instrument settings in database.", Order=1, GroupName="Parameters")]
                  public double SizeOfTick
                  { get; set; }
                  #endregion​​
          Please let us know if we may be of further assistance.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          631 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          364 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
          566 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          568 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X