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 sjsj2732, Yesterday, 04:31 AM
            0 responses
            33 views
            0 likes
            Last Post sjsj2732  
            Started by NullPointStrategies, 03-13-2026, 05:17 AM
            0 responses
            286 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            286 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            133 views
            1 like
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            91 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Working...
            X