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

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.
      Emily C.NinjaTrader Customer Service

      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.
          Emily C.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Haiasi, Today, 06:53 PM
          1 response
          4 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by ScottWalsh, Today, 06:52 PM
          1 response
          13 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by ScottW, Today, 06:09 PM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by ftsc2022, 10-25-2022, 12:03 PM
          5 responses
          256 views
          0 likes
          Last Post KeyonMatthews  
          Started by Board game geek, 10-29-2023, 12:00 PM
          14 responses
          244 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Working...
          X