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

set plots to drawtext

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

    set plots to drawtext

    I made an indicator that is working very well, but I do not understand plots to eventually use a strategy.

    I want to assign variables to my drawtext print statements, then I want to set my plots to these variables.

    If you could point me in the right direction I'd really appreciate it.

    Thank you.

    #2
    Hello,
    Can you clarify what part of the text object are you wanting to assign the plot to?
    For example are you wanting to assign the plot to the Y value of the DrawText() object?
    Cody B.NinjaTrader Customer Service

    Comment


      #3
      I'm not sure what you mean. My ind runs a calculation and creates results from the order flow of each bar. So it's level 2 I believe. I'm told I need a plot for each result--which is a number that prints via drawtext on my chart--so a strategy can reference these plots.

      Does this help your understanding?
      Thanks,
      Chris

      Comment


        #4
        Hello,
        The plot is what will hold the values of the level 2 data and then the DrawText() would be a visual representation of this data. You would not be assigning a plot to the DrawText but instead you will be creating DrawText() methods based off of the plots dataset.
        Are you trying to recreate the order flow analytics indicators or can you clarify further what you are trying to achieve?
        Cody B.NinjaTrader Customer Service

        Comment


          #5
          I've been looking at the MACD ind and it's helping me understand datasets and plots a little more, so I'll be studying that for a while. I have another question:

          In OnBarUpdate using tick bars, I want to calculate the total volume of the bar, bidvol + askvol, then zero it out when the bar closes, and do the same for the next bar. I need this result to use in a calculation. I thought askVol + bidVol would work, but it returns a zero every time.

          Is there a function that will return bidvol and askvol of each bar?

          Thank you.

          Comment


            #6
            Hello,
            There is not a method that would return this value however through custom logic it would be possible.

            Are you trying to get the historical volume or only the realtime volume bid plus ask volume?
            Cody B.NinjaTrader Customer Service

            Comment


              #7
              I simply want to get the bid and ask volume for each tick bar so I can use it in a calculation for each bar. Then I want the results to be able to stay in a panel on my charts, not disappear when the chart refreshes. If this is what you mean by historical, then I guess I want historical.

              Thanks.

              Comment


                #8
                You should switch to NinjaTrader 8, as it offers to store synchronized bid and ask volume in the historical data base.

                Comment


                  #9
                  Hello,
                  Harry is correct in that you can store these values in NinjaTrader 8.
                  If you wanted to use NinjaTrader 7 you can add two data series: one for the bid and another for the ask.
                  Then create a plot that is set to the Volume of the added data series.
                  Please see the example below:
                  Code:
                  protected override void Initialize()
                  {
                       Add("ES 03-16", PeriodType.Tick, 150, MarketDataType.Ask);
                       Add("ES 03-16" , PeriodType.Tick, 150, MarketDataType.Bid);
                       Add(new Plot(Color.FromKnownColor(KnownColor.RoyalBlue), PlotStyle.Bar,   "BidandAskVol"));
                       Overlay= true;
                       CalculateOnBarClose = false;
                  }
                  protected override void OnBarUpdate()
                  {
                        BidandAskVol.Set(VOL(BarsArray[1])[0] + VOL(BarsArray[2])[0]);
                  }
                  Please see the following link on working with multiple time-frames and instruments: http://ninjatrader.com/support/helpG...nstruments.htm

                  Please let me know if you have any questions on the example.
                  Cody B.NinjaTrader Customer Service

                  Comment


                    #10
                    Thanks for this info, Cody. It is giving me a volume result, but it's incorrect. I'm using a 19 tick bar chart for testing and I'm getting volume of around 600, when it should actually be 20 to 40.

                    My ind is working, at least to the output window, I'm just getting an incorrect volume result.

                    Again, I only want bid+ask volume on the current tick bar then cleared for the next bar.

                    Any thoughts as to what's going wrong?
                    Thanks.

                    Comment


                      #11
                      Hello,
                      The code provided should process exactly as you are wanting.
                      Can you clarify that you are indeed wanting the Bid volume and the Ask Volume and not the traded Volume of the Bar?
                      Also so I may test further please clarify what instrument you are testing this on.
                      Cody B.NinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by NinjaTrader_CodyB View Post
                        Hello,
                        The code provided should process exactly as you are wanting.
                        Can you clarify that you are indeed wanting the Bid volume and the Ask Volume and not the traded Volume of the Bar?
                        Also so I may test further please clarify what instrument you are testing this on.
                        I use ES 3-16. I think I'm unclear as to what traded vol of the bar is. When I look at order flow, there is a total volume. When I click the center wheel of my mouse over the regular bars on my chart, there is a volume. These two volumes are the same. That is the volume I need. Is this traded Volume of the Bar? If so, that is what I'm after.

                        Thanks for the help.

                        Comment


                          #13
                          Hello,
                          What you refer to in your last post is the traded volume. This is not equal to the bid volume + ask volume.

                          To get this volume you can simply use the Volume method on the primary dataseries which is Volume[0].

                          Please see the following link on the Volume method: http://ninjatrader.com/support/helpG...t7/volume2.htm

                          You could create a plot that holds these values by doing the following:
                          Code:
                          Add(new Plot(Color.FromKnownColor(KnownColor.RoyalBlue), PlotStyle.Bar,   "myVolume"));
                          
                          protected override void OnBarUpdate()
                          {
                              myVolume.Set(Volume[0]);
                          }
                          Please let us know if you have any further questions.
                          Cody B.NinjaTrader Customer Service

                          Comment


                            #14
                            Thanks, I'll try this. So are you saying "bid volume" the total of all orders placed at the bid whether or not they're filled?

                            Comment


                              #15
                              Hello,
                              Yes, the bid volume is the number of orders placed at the bid price including the orders that do not get filled.

                              If we can be of any other assistance please let us know.
                              Cody B.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by sidlercom80, 10-28-2023, 08:49 AM
                              166 responses
                              2,234 views
                              0 likes
                              Last Post sidlercom80  
                              Started by thread, Yesterday, 11:58 PM
                              0 responses
                              1 view
                              0 likes
                              Last Post thread
                              by thread
                               
                              Started by jclose, Yesterday, 09:37 PM
                              0 responses
                              6 views
                              0 likes
                              Last Post jclose
                              by jclose
                               
                              Started by WeyldFalcon, 08-07-2020, 06:13 AM
                              10 responses
                              1,414 views
                              0 likes
                              Last Post Traderontheroad  
                              Started by firefoxforum12, Yesterday, 08:53 PM
                              0 responses
                              11 views
                              0 likes
                              Last Post firefoxforum12  
                              Working...
                              X