Announcement

Collapse
No announcement yet.

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.

    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 Hwop38, 05-04-2026, 07:02 PM
        0 responses
        161 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        308 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        245 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        349 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        179 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Working...
        X