Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi Instrument Bid Ask data

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

    Multi Instrument Bid Ask data

    Hi,

    I am trying to load within a strategy two instruments, the primary instument and the secondary instrument using the following code obtained from another post on the forum.

    The output I am looking for is to show the ask, bid and last price for the secondary instrument but after running the strategy I find that it's only getting the Ask, Bid and Last data from the primary instrument?

    Is there something that I am doing incorrectly?

    Code:
     protected override void Initialize()
            {
                Add("ES 09-12", PeriodType.Tick, 1, MarketDataType.Ask);
                Add("ES 09-12", PeriodType.Tick, 1, MarketDataType.Bid);
                Add("ES 09-12", PeriodType.Tick, 1, MarketDataType.Last);
                
                CalculateOnBarClose                = false;
            }
    
            /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
            protected override void OnBarUpdate()
            {
     
            // Checks if OnBarUpdate() is called from an update on the primary Bars
            if (BarsInProgress == 0) //Main Chart interval
            {
                Print("This is the default instrument close : "+Close[0].ToString());
            }
            else if(BarsInProgress == 1) //Bid Tick Chart interval
            {
                Print("This is the instrument ask : "+Close[0].ToString());
            }
            else if(BarsInProgress == 2) //Ask Tick chart interval
            {
                Print("This is the instrumentName bid: "+Close[0].ToString());
            }
            else if(BarsInProgress == 3) //Ask Tick chart interval
            {
                Print("This is the instrumentName last: "+Close[0].ToString());
            }
            }
    I would also like to ask if it's possible to get the bid volume and ask volume from the secondary instrument also? If so, what method should I be looking to achieve that in?

    Thanks again and regards,
    suprsnipes
    Last edited by suprsnipes; 06-05-2012, 08:17 AM.

    #2
    Hello suprsnipers,
    To assist you further may I know what is the primary bar series i.e. (the main chart on which you are applying the strategy).

    I look forward to assisting you further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      I have just re-started NT and the strategy and I'm pleased to say that it is running correctly.

      The first part of the series is the YM 09-12.

      Is it possible for you to let me know how I can get the bid and ask volume data from the secondary series in addition to the bid and ask price?

      Comment


        #4
        Hello suprsnipers,
        You can use the Volume[0] code to get the volume from the secodary series.

        Code:
        if (BarsInProgress == 0) //Main Chart interval
                {
                    Print("This is the default instrument volume : "+Volume[0].ToString());
                }
                else if(BarsInProgress == 1) //Bid Tick Chart interval
                {
                    Print("This is the instrument ask volume : "+Volume[0].ToString());
                }
                else if(BarsInProgress == 2) //Ask Tick chart interval
                {
                    Print("This is the instrumentName bid volume: "+Volume[0].ToString());
                }
                else if(BarsInProgress == 3) //Ask Tick chart interval
                {
                    Print("This is the instrumentName last volume: "+Volume[0].ToString());
                }
        Instead of adding the Bid Ask data series, you can also use the GetCurrntBid, GetCurrentBidVolume functions to get the information regarding it. It will surely be resource friendly.






        Please let me know if I can assist you any further.
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          Great, thanks for your feedback I will try both of your suggestions.

          Comment


            #6
            Hello suprsnipers,
            Thanks for your note.
            Please let me know if I can assist you any further.
            JoydeepNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by cmoran13, Yesterday, 01:02 PM
            0 responses
            25 views
            0 likes
            Last Post cmoran13  
            Started by PaulMohn, 04-10-2026, 11:11 AM
            0 responses
            17 views
            0 likes
            Last Post PaulMohn  
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            160 views
            1 like
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            94 views
            1 like
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            147 views
            2 likes
            Last Post CaptainJack  
            Working...
            X