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

Instrument Code

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

    Instrument Code

    I am attempting to find a way to access the current instrument. So, if displaying Euro Futures, I would like to be able to access the "symbol for it" (e.g. 6Exx or whatever). If it is accessible, can it be accessed from initialize()?

    Also, I would like to be able to access the time frame that is displayed on the chart. I know that you can access the "tick value" with (this.TickSize)... Have been trying to find something similar like "BarTime". There is a "BarsPeriod", but it appears to only be relevant to certain indicators.

    Appreciate any help...

    Thank you.

    #2
    SharkCub, you can get the full name of an instrument (including the expiry) with this code:
    Code:
    string fullInstName = Instrument.FullName;
    If you just want the instrument name (no expiry):
    Code:
    string partName = Instrument.MasterInstrument.Name;
    There is no guarantee these properties will be accessible in the Initialize() section, due to the way it is called multiple times in the course of normal operations.

    BarsPeriod will give you everything you want to know about the bar type and duration. Please take a look at the help guide entry and let us know if you have any other questions.
    AustinNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by GLFX005, Today, 03:23 AM
    0 responses
    1 view
    0 likes
    Last Post GLFX005
    by GLFX005
     
    Started by XXtrader, Yesterday, 11:30 PM
    2 responses
    11 views
    0 likes
    Last Post XXtrader  
    Started by Waxavi, Today, 02:10 AM
    0 responses
    6 views
    0 likes
    Last Post Waxavi
    by Waxavi
     
    Started by TradeForge, Today, 02:09 AM
    0 responses
    14 views
    0 likes
    Last Post TradeForge  
    Started by Waxavi, Today, 02:00 AM
    0 responses
    3 views
    0 likes
    Last Post Waxavi
    by Waxavi
     
    Working...
    X