Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Instrument Name

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

    Instrument Name

    Hi,

    i´d like to check in my strategy if the name of the intrument is MSFT.
    I need this for backtesting on a bunch of possible stock portfolios.

    How do i do this ?

    I´ve found at http://www.ninjatrader.com/support/h...html?today.htm

    that there is something like "Instrument.MasterInstrument.Name".

    But if i put it into my "if clause" then it says that MSFT is not known.
    My sample:

    ...if (Position.MarketPosition == MarketPosition.Flat && Instrument.MasterInstrument.Name == MSFT)...
    then do something...

    It would be great if you could give me a hint how i could archive this.
    Thank You !

    #2
    Originally posted by nt2010 View Post
    Hi,

    i´d like to check in my strategy if the name of the intrument is MSFT.
    I need this for backtesting on a bunch of possible stock portfolios.

    How do i do this ?

    I´ve found at http://www.ninjatrader.com/support/h...html?today.htm

    that there is something like "Instrument.MasterInstrument.Name".

    But if i put it into my "if clause" then it says that MSFT is not known.
    My sample:

    ...if (Position.MarketPosition == MarketPosition.Flat && Instrument.MasterInstrument.Name == MSFT)...
    then do something...

    It would be great if you could give me a hint how i could archive this.
    Thank You !
    You need to compare like variables. Instrument.MasterInstrument.Name is a string. Correct would be: ... Instrument.MasterInstrument.Name == "MSFT"

    Comment


      #3
      Hi Koganam,

      thank you for your feedback. Its working !
      Thanx for the fast help.

      NT2010

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      671 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      379 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      111 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      575 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      582 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X