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

bid and ask volume

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

    #31
    Hi imalil,

    Congratulate you on having accurate outputs. To print the values to chart, I use a simple NT function DrawText. Here is a sample use to print Ask volume at 20 pixels above the high of every bar.

    Put this at the end of OnBarUpdate():
    DrawText("ask vol", AutoScale, askVol.ToString(), 0, High[0], 20, Color.Blue, ChartControl.Font, StringAlignment.Center, Color.Transparent, Color.Transparent, 0);
    To learn more about the function, please visit: http://www.ninjatrader.com/support/h...7/drawtext.htm

    Anyway, you have gone through the toughest part of the road. The rest is very easy to go.

    Thanks.
    Pi
    Last edited by ninZa; 02-06-2015, 08:11 AM.
    ninZa
    NinjaTrader Ecosystem Vendor - ninZa.co

    Comment


      #32
      Thank you, Pi, this works. Only thing missing is how do I keep the number above the bar AFTER the bar prints? Right now it disappears the instant the bar prints. Thank you very much.

      Comment


        #33
        Originally posted by imalil View Post
        Thank you, Pi, this works. Only thing missing is how do I keep the number above the bar AFTER the bar prints? Right now it disappears the instant the bar prints. Thank you very much.
        Please make the tag unique, for example:

        DrawText("ask vol" + CurrentBar, .....);
        Cheers.
        Pi
        ninZa
        NinjaTrader Ecosystem Vendor - ninZa.co

        Comment


          #34
          Thanks for your information, Pi, everything is working. I was wondering if there's a simple way to print this result in a window below the chart, like MACD. MACD has a zero line and bars that represent the value, above and below this zero line after every bar closes. This is also a way I'd like to see my data displayed. Is there simple code to change the DrawText to a window below the chart, MACD style? Thank you very much for all your help.

          Comment


            #35
            Originally posted by imalil View Post
            Thanks for your information, Pi, everything is working. I was wondering if there's a simple way to print this result in a window below the chart, like MACD. MACD has a zero line and bars that represent the value, above and below this zero line after every bar closes. This is also a way I'd like to see my data displayed. Is there simple code to change the DrawText to a window below the chart, MACD style? Thank you very much for all your help.
            Do you want the display similar to mine below?

            ninZa
            NinjaTrader Ecosystem Vendor - ninZa.co

            Comment


              #36
              Yes, that looks very, very good. Two quick questions as I look at your chart: Are the codes for the top numbers and the bottom graph independent of each other? Can you turn off one without affecting the other?

              Also, probably a stupid question, but do the bars on the bottom--and the numbers on the top for that matter--remain after the data feed is closed and reopened? Or do they refresh each time?

              So my answer is yes, I do like your display. Thank you very, very much for your replies.

              Comment


                #37
                Originally posted by imalil View Post
                Yes, that looks very, very good. Two quick questions as I look at your chart: Are the codes for the top numbers and the bottom graph independent of each other? Can you turn off one without affecting the other?

                Also, probably a stupid question, but do the bars on the bottom--and the numbers on the top for that matter--remain after the data feed is closed and reopened? Or do they refresh each time?

                So my answer is yes, I do like your display. Thank you very, very much for your replies.
                Hi imalil,

                My answers:

                1. They are NOT independent. The numbers you see are displayed in "Alternated" mode, which is top - bottom - top - bottom - top...

                2. Data are erased when you hit F5, platform restarts, or data feed refreshes... It's considered advanced programming to make this indicator work with historical data, even to me. We need to add additional series for bid & ask. It's pretty complicated and time-consuming, so I don't have such a plan now.

                Below is the code I use to add a histogram to display volume delta. Please modify it to fit your needs. If you are unclear at any points, please ask me

                In #region Properties:

                [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
                [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
                public DataSeries VolumeDelta {
                get { return Values[0]; }
                }
                In Initialized():

                Add(new Plot(Color.Black, PlotStyle.Bar, "Volume Delta"));
                Plots[0].Pen.Width = 5; // initialize the width of histogram bars, this line is optional

                Overlay = false;
                In OnBarUpdate():

                double volDelta = askVol - bidVol; // compute volDelta

                VolumeDelta.Set(volDelta); // set the value to the plot
                Last edited by ninZa; 02-21-2015, 09:48 PM.
                ninZa
                NinjaTrader Ecosystem Vendor - ninZa.co

                Comment


                  #38
                  how can you show the bid verse ask in each cell, with no actual candles?

                  Comment


                    #39
                    Originally posted by brucelevy View Post
                    how can you show the bid verse ask in each cell, with no actual candles?
                    If you want to hide the candles, make them transparent, or the same as the BackColor.

                    Comment


                      #40
                      Thank you, Pi, the code is working. I have two questions: I notice on your chart you change the color of the bar when the value turns negative. How are you doing this?

                      Also, is there an easy way to print a line at zero? Thank you again.

                      Comment


                        #41
                        Originally posted by brucelevy View Post
                        how can you show the bid verse ask in each cell, with no actual candles?
                        This seems to be an order flow indicator. The most powerful solution is to use C# graphic programming for this (like Heiken Ashi).
                        ninZa
                        NinjaTrader Ecosystem Vendor - ninZa.co

                        Comment


                          #42
                          Originally posted by imalil View Post
                          Thank you, Pi, the code is working. I have two questions: I notice on your chart you change the color of the bar when the value turns negative. How are you doing this?

                          Also, is there an easy way to print a line at zero? Thank you again.
                          Suppose you have only 1 plot, whose index is 0. So the following code to change the color of the plot is put in OnBarUpdate():

                          if (Values[0][0] > 0) PlotColors[0][0] = Color.Blue;
                          else if (Values[0][0] < 0) PlotColors[0][0] = Color.Red;
                          Adding a line at zero: in Initialize():

                          Add(new Line(Color.Gray, 0, "Zero Line"));
                          Cheers.
                          Pi
                          ninZa
                          NinjaTrader Ecosystem Vendor - ninZa.co

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by usazencort, Today, 01:16 AM
                          0 responses
                          1 view
                          0 likes
                          Last Post usazencort  
                          Started by kaywai, 09-01-2023, 08:44 PM
                          5 responses
                          603 views
                          0 likes
                          Last Post NinjaTrader_Jason  
                          Started by xiinteractive, 04-09-2024, 08:08 AM
                          6 responses
                          23 views
                          0 likes
                          Last Post xiinteractive  
                          Started by Pattontje, Yesterday, 02:10 PM
                          2 responses
                          22 views
                          0 likes
                          Last Post Pattontje  
                          Started by flybuzz, 04-21-2024, 04:07 PM
                          17 responses
                          230 views
                          0 likes
                          Last Post TradingLoss  
                          Working...
                          X