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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    80 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    40 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    63 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    63 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    54 views
    0 likes
    Last Post CarlTrading  
    Working...
    X