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

Total Volume current and prior day

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

    #16
    Hello Mike.A,

    Thank you for your replies.

    Draw.TextFixed does not have a concept of margin - only the specific TopRight / BottomRight / TopLeft / BottomLeft would work.

    However, with Draw.Text you can place text anywhere you like on the chart:



    As far as discrepancy beween the indicator and the Daily Volume column, the indicator shows Level 1 Volume data that comes from your provider.

    This does not include non-last-trade-qualifying types of trades.

    The Time & Sales window and Daily Volume column of the Market Analyzer uses a Fundamental Data, or MarketData.DailyVolume.

    The reason is that MarketData.DailyVolume includes all Last Trade types and all non-last-trade-qualifying trades.

    Each data provider is different and we do not know how the other platforms store, transmit, and display data.

    Below are some Examples of non-last-trade-qualifying trades that do not come through IQFeed/Kinetick and would be excluded from the Volume series:
    • a = acquisition
    • b = bunched trade - average price c = cash trade
    • d = distribution
    • e = automatic execution f = intermarket sweep
    • g = bunched sold trade - opening/reopening trade detail h = intraday trade detail
    • i = basket index on close transaction j = rule 127 trade
    • k = rule 155 trade l = sold last
    • n= next day o = opened
    • p = prior reference price r = seller
    • s = split trade
    • u = extended hours trade - reported late or out of sequence
    • w = average price trade
    • y = yellow flagged regular trade
    • z = sold - out of sequence
    Please note that this list only applies to IQFeed/Kinetick, other data providers may include or exclude these types of trades.

    IQFeed and Kinetick are still considered unfiltered data feeds.

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #17
      Hi Kate
      Thank you for your respond

      I am not advance in Script language
      Can you please let me know how to be able to control the text in specific area as:
      a little left or right and Up or down a little from the TextPosition.TopRight

      Draw.Text(this,"Test","Tdy: "+ VOL(Closes[1])[0] .ToString("0,000.")+"\nYdy: "+VOL(Closes[1])[1] .ToString("0,000."),TextPosition.TopRight, textColor, textFont1, outlineColor, areaColor, zopacity);

      Print(VOL(Closes[1])[0]);

      Thank you for your help

      Mike


      Comment


        #18
        Hello Mike.A,

        Thank you for your note.

        To clarify, Draw.Text will draw text to the chart but this will move along with the chart as it prints and would be based on a price and bars back. It does not have a concept of TextPosition.TopRight as Draw.TextFixed. You wouldn't necessarily be able to position it and keep it a little below the top right as the chart constantly adjusts based on price, though you could place it at a constant offset from the current price, but it would move around the chart as that changed. What you'd want in your case would require custom rendering. I would take a look at the built in SampleCustomRender indicator which goes into using SharpDX for custom rendering - however, I would be aware that this would require some advanced programming skill, and you may prefer to use the Draw.FixedText.

        Here's a link to our help guide that goes over SharpDX rendering:


        I've also attached a example script one of my colleagues created that creates a text box on the top left of a chart as a further example.

        Please let us know if we may be of further assistance to you.

        Attached Files
        Kate W.NinjaTrader Customer Service

        Comment


          #19
          Hi Kate
          Thank you very much for responding
          this indicator you sent it to me ( Position-Display-Indicator.Zip ) is the exact exactly what I tray to do but instead of showing the P&L and Acc. Bal, I try to show Current day and Yest. Volume.
          with the ability to move the text around by changing the Vertical offset and Horizontal offset.

          I tried to do that again and again today after download this indicator, to change the string to Vol instead of P&L. but I wasn't successful and in the same time I can't afford to hire a programmer to do that for me for now.

          is any easy way to get indicator show up Vol text and move it around the chart or any similar indicator easy to convert it to this idea??

          Thank you very much for your help
          Mike

          Comment


            #20
            Hello Mike.A,

            Thank you for your reply.

            I would say that script is probably the easiest way forward and to change the string that is displayed, you would have to modify the segment below:

            string label = "UnRealized PnL" +"\n\n"+ "Realized PnL" +"\n\n"+ "Account Balance" +"\n";
            string realizedPnLstring = "\n" + "\n" + "\n" + realizedPnL.ToString("N2");
            string cashValuestring = "\n" + "\n" + "\n" + "\n" + "\n" + cashValue.ToString("N2");
            string unRealizedPnLstring;

            You could start by working with your current code in a separate indicator to get what values you want to display stored in variables, and then it would be fairly simple to plug that into the existing Position Display Indicator example. As far as moving where the box displays, I would advise taking a close look at the SampleCustomRender indicator code that is available in the NinjaScript Editor that I mentioned in my previous post as that goes in depth on how you can control the location of rendered items.

            Please let us know if we may be of further assistance to you.

            Kate W.NinjaTrader Customer Service

            Comment


              #21
              Hello Kate

              Thank you for your response and sorry because I am not too advance in writing script

              When I tried to change:
              From:
              string realizedPnLstring = "\n" + "\n" + "\n" + realizedPnL.ToString("N2");
              To:
              string realizedPnLstring = "\n" + "\n" + "\n" + VOL(Closes[1])[0] .ToString("0,000.");

              It is compiled successfully

              but the text box disappears from the chart and get error massage in Account Data windows as:
              Indicator "CurrentDayAndYesVolTemp' Error on calling 'OnStateChange' method Index was outside the bound of the array.


              When I try to change
              From:
              string label = "UnRealized PnL" +"\n\n"+ "Realized PnL" +"\n\n"+ "Account Balance" +"\n";
              To:
              string label = " Today Volume :" +"\n"+ " Yes Volume :" +"\n"+ " ACcount Bal :";

              it is accepted and no problem when compiled or at the chart

              What I am doing wrong

              Thank you

              Mike

              Comment


                #22
                Hello Mike.A,

                Thank you for your reply.

                You are getting that error because you aren't doing the calculation of the volume in OnBarUpdate and then saving it to a variable. You would need to save the value of VOL(Closes[1])[0] to a variable there, and then use the variable instead of VOL(Closes[1])[0] within the code in OnRender.

                You would need to add the OnBarUpdate section to the script, much like how the original indicator example script was set up, as the Position Display Indicator example doesn't include that section since it doesn't look at bar information, only account information.

                Please let us know if we may be of further assistance to you.
                Kate W.NinjaTrader Customer Service

                Comment


                  #23
                  Hi Kate

                  Thank you for your note

                  I tried every way to put OnBarUpdate and still get the same error message
                  Sorry I am almost give up on this, I don't see any way to do it my self because I am not in advance to write script or program Ninja Script

                  Thank you very much for your help

                  Mike

                  Comment


                    #24
                    Hello Mike.A,

                    Thank you for your reply.

                    In the support department at NinjaTrader we do not create, debug, or modify code for our clients. This is so that we can maintain a high level of service for all of our clients as well as our vendors. The samples we provide are intended to give you further direction to move forward, and are not intended to be used for copy and paste purposes.

                    If you are interested in services in having the code written for you, I can have a representative of our EcoSystem reach out with more information on NinjaScript consultants who will be happy to do so.

                    If you would like to move forward programming on your own, I recommend starting small and working with some basic concepts before moving on to more complex items like you are currently looking at. Please see the information below.

                    If you are new to C#, to get a basic foundation for the concepts and syntax used in NinjaScript I would recommend this section of articles in our NT7 help guide first:

                    Basic Programming Concepts

                    For general C# education I have personally found Dot Net Perls to be a great reference site with easy to understand examples.

                    Browse examples for many languages, with explanations and code side by side for easy understanding.


                    There are a number of indicators which come pre-configured in NinjaTrader that you can use as a starting point. These are found under New -> NinjaScript Editor -> Strategy. You will see locked strategies where you can see the details of the code, but you will not be able to edit (you can though always create copies you can later edit via right click > Save as)

                    We also have some Reference samples online as well as ‘Tips and Tricks’ for both indicators and strategies:

                    Click here to see our NinjaScript Reference Samples
                    Click here to see our NinjaScript Tips

                    These samples can be downloaded, installed and modified from NinjaTrader and hopefully serve as a good base for your custom works.

                    Further, the following link is to our help guide with an alphabetical reference list to all supported methods, properties, and objects that are used in NinjaScript.

                    Alphabetical Reference

                    And our Educational Resources in the NinjaTrader 8 help guide.

                    Educational Resources

                    A set of specific tutorials for creating conditions in the NinjaTrader 8 Strategy Builder in the NinjaTrader 8 help guide.

                    Condition Builder

                    Please let us know if we may be of further assistance to you.
                    Kate W.NinjaTrader Customer Service

                    Comment


                      #25
                      Hi Kate
                      Thank you for your note

                      I tried and tried but it is above my level to achieve what I am trying to do
                      I think I will be fine as the indicator as it is now

                      Thank you for your help

                      Mike

                      Comment


                        #26
                        Nice indicator. Can the CurrentAnd PriorDayVolumeNT8 be converted into a plot on the chart so it can also be included as a condition in a strategy in Strategy Builder? If so how? Thanks.
                        Last edited by designer01; 03-05-2022, 02:19 PM.

                        Comment


                          #27
                          Hello designer01,

                          Thank you for your note.

                          The CurrentAndPriorDayVolumeNT8 indicator does not have an exposed plot for use in the Strategy Builder and is intended as an example only. You could certainly create a version that does include a plot, however, the indicator as it exists currently would not be usable in the Strategy Builder.

                          If you'd like to add a plot yourself, I recommend starting with the Strategy Wizard, which can set up plots for you, and then copying and pasting the logic from the existing indicator into that framework. From there, you'd just need to assign values to the plot. Once complete, you can then refer to that plot when using the indicator in the Strategy Builder and use it to create your logic.

                          Just so you're aware, in the support department at NinjaTrader we do not create, debug, or modify code for our clients. This is so that we can maintain a high level of service for all of our clients as well as our vendors. The samples we provide are intended to give you further direction to move forward, and are not intended to be used for copy and paste purposes.

                          If you are interested in services in having the code modified for you, I can have a representative of our EcoSystem reach out with more information on NinjaScript consultants who will be happy to do so.

                          Please let us know if we may be of further assistance to you.
                          Kate W.NinjaTrader Customer Service

                          Comment


                            #28
                            Hello Kate

                            Thank you for all your help

                            I wonder how to code for before Yesterday and before before Yesterday??

                            By other mean:

                            VOL(Closes[1])[0] For Today
                            VOL(Closes[1])[1] For Yesterday
                            ???????????????? For before Yesterday ?
                            ???????????????? For before before Yesterday ?

                            As always thank you very much for your help

                            Mike.A

                            Comment


                              #29
                              Hello Mike.A.,

                              Thank you for your note.

                              When working with Closes, the syntax is as follows:

                              Closes[int barSeriesIndex][int barsAgo]

                              If the added data series at index [1] for barSeriesIndex is set to daily bars, then this is how your examples look:
                              VOL(Closes[1])[0] would be the VOL from the closing price of the series at index [1] from [0] barsAgo (current bar). With daily bars, this means the VOL for today.
                              VOL(Closes[1])[1] would be the VOL from the closing price of the series at index [1] from [1] barsAgo (previous bar). With daily bars, this means the VOL from the previous daily bar, yesterday.

                              If you want the volume from the day before yesterday, you would simply change the barsAgo index to [2] for two bars ago:
                              VOL(Closes[1])[2]
                              and for "before before Yesterday" you would use [3] bars ago:
                              VOL(Closes[1])[3]

                              Here are some helpful links about referencing the correct bar and working with multi-time frame and instruments that have some helpful information about using barSeriesIndex and barsAgo indexes:






                              I hope this explanation helps to answer your question. Please let us know if we may be of further assistance.
                              Emily C.NinjaTrader Customer Service

                              Comment


                                #30
                                Hi Emily

                                Thank you very much for your answer
                                I try it the same like what is say in you reply : CurrentAndPriorDayVolumeNT8.zip

                                if (CurrentBars[0] < 1 || CurrentBars[1] < 1)
                                return;

                                Draw.TextFixed(this,"Test1"," TV: "+ VOL(Closes[1])[0] .ToString("0,000 ") ,TextPosition.TopLeft+20, Brushes.Yellow, new SimpleFont("Arial", 17f) { Bold = false,Italic = false}, outlineColor, areaColor, 100);

                                Draw.TextFixed(this,"Test2","\n Yv: "+VOL(Closes[1])[1] .ToString("0,000 "),TextPosition.TopLeft+20, Brushes.DarkGray, new SimpleFont("Arial", 17.25f) { Bold = false,Italic = false }, outlineColor, areaColor, 100);

                                Draw.TextFixed(this,"Test3"," \n\n BTV: "+ VOL(Closes[1])[2] .ToString("0,000 ") ,TextPosition.TopLeft+20, Brushes.Black, new SimpleFont("Arial", 17f) { Bold = false,Italic = false}, outlineColor, areaColor, 100);

                                Draw.TextFixed(this,"Test4"," \n\n\n BBTV: "+ VOL(Closes[1])[3] .ToString("0,000 ") ,TextPosition.TopLeft+20, Brushes.Black, new SimpleFont("Arial", 17f) { Bold = false,Italic = false}, outlineColor, areaColor, 100

                                it is compile with no problem but on the chart show the first two value only which is today and yesterday only and on the account data window give me error that

                                onBarUpdate' method on bar 8224: you are accessing an index with a value that is invalid since it is out of range. IE accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.

                                the code accept only [0] for today and [1] for yesterday will work fine with no errors but if you change from 1 to 2 or 3 will compile fine but error on the chart and Account data window.

                                All what I try to do is:

                                take Kate W post it code before here on page 1 of the conversation (attach a copy) and add Before and Before Before Yesterday on it??


                                Thank you Emily for your help
                                Mike.A

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by JoMoon2024, Today, 06:56 AM
                                0 responses
                                6 views
                                0 likes
                                Last Post JoMoon2024  
                                Started by Haiasi, 04-25-2024, 06:53 PM
                                2 responses
                                19 views
                                0 likes
                                Last Post Massinisa  
                                Started by Creamers, Today, 05:32 AM
                                0 responses
                                6 views
                                0 likes
                                Last Post Creamers  
                                Started by Segwin, 05-07-2018, 02:15 PM
                                12 responses
                                1,786 views
                                0 likes
                                Last Post Leafcutter  
                                Started by poplagelu, Today, 05:00 AM
                                0 responses
                                3 views
                                0 likes
                                Last Post poplagelu  
                                Working...
                                X