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

NT7 OnMarketData Question

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

    NT7 OnMarketData Question

    Hi, I need to access the number of lots associated with each Ask/Bid transaction using the OnMarketData method. Seems the Volume argument provides a running total (not sure). Any input is appreciated. tx

    #2
    Hello pman777,

    I have a few simple examples that demonstrate replicating the Time & Sales window and show how to accumulate volume from each market update and displaying this on the chart.

    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you Chelsea, but seems the examples are for NT8 ... any for NT7?

      Comment


        #4
        Hi pman777,

        I've moved your thread from the NT8 section of the forums to the NT7 section of the forums.

        Below is a link to these samples for NT7.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thank you Chelsea, I'm having another problem displaying the Ask/Bid volume as they change in real time. I'm currently using the "DrawText" command to display the ask & bid volumes on the right side of my chart but these values are only updated when there is a change in price. My Print command is displaying every volume change in the Output console, but the DrawText is not updating the chart. Any thoughts?

          Here's my code:

          protected override void OnMarketData(MarketDataEventArgs e)
          {
          if (e.MarketDataType == MarketDataType.Ask)
          {
          askVol = e.Volume; askPrice = e.Price;
          if (printOn) Print(Time[0].ToString() + " MarketDataType: " + e.MarketDataType+ "++++++++++++++++ e.Volume: " + e.Volume+ " e.Price: " + e.Price);
          }

          if (e.MarketDataType == MarketDataType.Bid)
          {
          bidVol = e.Volume; bidPrice = e.Price;
          if (printOn) Print(Time[0].ToString() + " MarketDataType: " + e.MarketDataType+ "---------------- e.Volume: " + e.Volume+ " e.Price: " + e.Price);
          }

          DrawText("askVol", askVol.ToString(), -20, askPrice, Color.Peru);
          DrawText("bidVol", bidVol.ToString(), -20, bidPrice, Color.Peru);

          }

          Comment


            #6
            Hello pman777,

            By default the chart updates every half second.

            Right-click chart -> Properties... -> Display update interval (sec).

            I wouldn't recommend turning this up for performance reasons.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              I set the Display update interval to .1 but the problem is still there

              Comment


                #8
                I noticed that if I click my mouse on the chart it updates the fields ... forcing a refresh. Is there a way to do that from within my indicator?

                Comment


                  #9
                  Originally posted by pman777 View Post
                  I noticed that if I click my mouse on the chart it updates the fields ... forcing a refresh. Is there a way to do that from within my indicator?
                  Code:
                  ChartControl.Refresh()
                  ?
                  Undocumented and unsupported. Be advised accordingly.

                  Comment


                    #10
                    thank you Koganam ... by the way I posted on another thread that I'm looking for a time-counter routine that will count the time in seconds that a volume bar is active. Can you direct me to something that would help. thanks again

                    Comment


                      #11
                      Hello pman777,

                      koganam is correct. Using ChartControl.Refresh() will trigger the chart to update, but this is unsupported and can cause performance and behavior issues (when improperly used).
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        Thanks Chelsea ... got it working and it seems to be performing fine, even at peak volume.

                        Comment


                          #13
                          Originally posted by pman777 View Post
                          thank you Koganam ... by the way I posted on another thread that I'm looking for a time-counter routine that will count the time in seconds that a volume bar is active. Can you direct me to something that would help. thanks again
                          Code:
                          double secondsElapsed = (Time[0] - Time[1]).TotalSeconds;

                          Comment


                            #14
                            Your DrawText methods should update in real time in OnMarketData method, not just on price change.
                            eDanny
                            NinjaTrader Ecosystem Vendor - Integrity Traders

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by algospoke, Yesterday, 06:40 PM
                            2 responses
                            19 views
                            0 likes
                            Last Post algospoke  
                            Started by ghoul, Today, 06:02 PM
                            3 responses
                            14 views
                            0 likes
                            Last Post NinjaTrader_Manfred  
                            Started by jeronymite, 04-12-2024, 04:26 PM
                            3 responses
                            45 views
                            0 likes
                            Last Post jeronymite  
                            Started by Barry Milan, Yesterday, 10:35 PM
                            7 responses
                            21 views
                            0 likes
                            Last Post NinjaTrader_Manfred  
                            Started by AttiM, 02-14-2024, 05:20 PM
                            10 responses
                            181 views
                            0 likes
                            Last Post jeronymite  
                            Working...
                            X