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 usazencort, Today, 01:16 AM
          0 responses
          1 view
          0 likes
          Last Post usazencort  
          Started by kaywai, 09-01-2023, 08:44 PM
          5 responses
          603 views
          0 likes
          Last Post NinjaTrader_Jason  
          Started by xiinteractive, 04-09-2024, 08:08 AM
          6 responses
          23 views
          0 likes
          Last Post xiinteractive  
          Started by Pattontje, Yesterday, 02:10 PM
          2 responses
          22 views
          0 likes
          Last Post Pattontje  
          Started by flybuzz, 04-21-2024, 04:07 PM
          17 responses
          230 views
          0 likes
          Last Post TradingLoss  
          Working...
          X