Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to get dollar value of tick

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

    How to get dollar value of tick

    How do we compute the dollar value of a tick for whatever instrument we have applied a strategy to? There was a bad answer to this question many years ago here: https://ninjatrader.com/support/foru...849-tick-value

    Unfortunately, this doesn't work - it gives a compiler error:
    "An object reference is required for the non-static field, method or property NinjaTrader.Cbi.Instrument.MasterInstrument.get"

    It looks like to get Instrument, you have to use bars.Instrument inside method OnBarUpdate.

    I don't want to do this. I want to set a private const TICK_VALUE_DOLLARS at the top of my strategy class. I want it to use whatever Instrument is associated with the default data series for this strategy. So how do I do this?

    #2
    Hello westofpluto,

    Thanks for your question.

    I don't want to do this. I want to set a private const TICK_VALUE_DOLLARS at the top of my strategy class. I want it to use whatever Instrument is associated with the default data series for this strategy. So how do I do this?
    You can't do this. Instrument objects are accessible as early as State.DataLoaded. The script must reach the part of its life where it wires into data in order to properly access the Instrument object.

    You can declare a private double and assign it in State.DataLoaded, however.

    Code:
    else if (State == State.DataLoaded)
    {
        myDbl = Instrument.MasterInstrument.PointValue * Instrument.MasterInstrument.TickSize;
    }
    OnStateChange (State reference) - https://ninjatrader.com/support/help...tatechange.htm

    Instrument - https://ninjatrader.com/support/help...instrument.htm

    Please let us know if you have any questions.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    88 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    134 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    119 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    67 views
    0 likes
    Last Post PaulMohn  
    Working...
    X