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 NullPointStrategies, Today, 05:17 AM
    0 responses
    44 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    124 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    65 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    42 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X