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

CurrentDayOHL and multi instruments

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

    CurrentDayOHL and multi instruments

    Hi,
    I'm running a multi instrument indicator with 5 instruments.
    I'd like to know how to get CurrentDayOHL.CurrentLow & CurrentHigh ; GetCurrentBid() and GetCurrentAsk() and Instrument.FullName for each instrument separately.
    Last edited by BankRobber; 09-09-2011, 03:50 AM.

    #2
    Welcome to our forums BankRobber - our NinjaScript trainee will take a look at your inquiry shortly, thanks for the patience.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Happy to assist

      Bank Robber,

      Welcome to the forum! I am happy to assist.

      In your initialize function, you will need to add the instruments you want similarly to below, where the first line is your primary instrument :

      protected override void Initialize()
      {
      Add(PeriodType.Minute, 1); // Instrument1
      Add("Instrument2", PeriodType.Minute, 1);
      Add("Instrument3", PeriodType.Minute, 1);
      }


      Then you can reference : BarsArray[1] for the first instrument, BarsArray[2] for the second, and so on.


      To call CurrentDayOHL, you must pass the correct instrument as input like the following examples for instrument 1 :

      CurrentDayOHL(BarsArray[1]).CurrentHigh
      CurrentDayOHL(BarsArray[1]).CurrentLow

      As far as GetCurrentBid() and GetCurrentAsk(), these functions have an override you can use to access the Bid/Ask of a particular instrument. Basically, have a look at the following :

      GetCurrentBid(1) //accesses the bid for Instrument 1
      GetCurrentBid(2) //accesses the bid for Instrument 2


      GetCurrentAsk(1) //accesses the ask for Instrument 1
      GetCurrentAsk(2) //access the ask for Instrument 2


      I would recommend reading through the following help-guide section in great detail.

      http://www.ninjatrader.com/support/helpGuides/nt7/index.html?multi_time_frame__instruments.htm

      Please let me know if I can assist you further.
      Last edited by NinjaTrader_AdamP; 09-09-2011, 01:00 PM.
      Adam P.NinjaTrader Customer Service

      Comment


        #4
        Thanks, now it is working like a charm!
        Last edited by BankRobber; 09-11-2011, 11:41 PM.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by mmckinnm, Today, 01:34 PM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by Conceptzx, 10-11-2022, 06:38 AM
        3 responses
        60 views
        0 likes
        Last Post NinjaTrader_SeanH  
        Started by f.saeidi, Today, 01:32 PM
        1 response
        2 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by traderqz, Today, 12:06 AM
        9 responses
        16 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by kevinenergy, 02-17-2023, 12:42 PM
        117 responses
        2,766 views
        1 like
        Last Post jculp
        by jculp
         
        Working...
        X