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

Identifying the instrument

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

    Identifying the instrument

    Hi,

    Is there a way, with custom code, to identify the instrument I am currently back testing?.

    Something like:

    string Instrument;

    switch (Instrument) {
    case ES:
    Slippage=2;
    Bars.Session.TemplateName="My_15:30 to 22:15";
    break;
    case CAC40:
    Slippage=1;
    Bars.Session.TemplateName="My_15:00 to 22:30";
    break;
    default:

    break;
    }

    It would automatically instrument-custom-fill the back test window menu as soon as I select the strategy.

    Thanks

    #2
    Hello CJS,

    You can reference this with Instrument.MasterInstrument.Name.

    Unfortunately you will not be able to set Initialize()-level properties on it, as it may not be available by the time you need to set the properties, and Initialize() is called for all scripts, not just the one you're working with.
    Ryan M.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by chbruno, 04-24-2024, 04:10 PM
    4 responses
    50 views
    0 likes
    Last Post chbruno
    by chbruno
     
    Started by TraderG23, 12-08-2023, 07:56 AM
    10 responses
    398 views
    1 like
    Last Post beobast
    by beobast
     
    Started by lorem, Yesterday, 09:18 AM
    5 responses
    20 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by WHICKED, Today, 12:56 PM
    2 responses
    15 views
    0 likes
    Last Post WHICKED
    by WHICKED
     
    Started by Felix Reichert, Today, 02:12 PM
    0 responses
    4 views
    0 likes
    Last Post Felix Reichert  
    Working...
    X