Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ask volume

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

    ask volume

    Hi,

    I am trying to plot using AddPlot(new Stroke(Brushes.DarkCyan, 2), PlotStyle.Bar, Custom.Resource.VOLVolume); only ask volume. with below syntax
    Value[0] = GetCurrentAskVolume(0);
    but when I am printing the value[0] from the above and comparing with the value printed from VOL indicator with ask price as input, it is completely different. Can you please advise what should be correct syntex to plot only ask volume for an intrument?

    #2
    Hello asmmbillah,

    GetCurrentAskVolume() provides a snapshot of the volume of the most recent ask update (not the accumulated ask volume of the bar).

    The VOL indicator shows the accumulated volume of the bar.

    You would need to add an additional series using MarketDataType.Ask to get the Volumes[1][0] with the ask volume of the bar.


    Alternatively, you could set the data series on the chart to use Ask as the 'Price based on'.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for your reply. As per your advice, I am doing the below, but still different values.


      I have compared that with ask price as input with the same isntrument with VOL indicator. its completely different. Can you please advice, why is that or what is wrong in the above?
      Last edited by asmmbillah; 09-22-2020, 07:34 AM.

      Comment


        #4
        Hello asmmbillah,

        The VOL indicator by default uses last data. Are you changing the chart to use Price based on last for the VOL indicator to use ask data?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Yes, chaing it to use Ask data. Please see the VOL attachment with indicator settings which will also show you details about input series. I am using market replay data. Also see the custom indicator value at the same time in another screenshot, which shows different value. Please advise.

          Comment


            #6

            which visually shows simiar value for the live candle, but when it moves to the next, previous bars' plots become very small and I have printed in output window, it is showing very small value. see the screenshot for your ref.
            Last edited by asmmbillah; 09-22-2020, 07:34 AM.

            Comment


              #7
              Hello asmmbillah,

              Are you using a live license key while connected to the playback?

              I'm not able to reproduce that behavior when testing the code you have suggested.
              https://drive.google.com/file/d/1zVo...w?usp=drivesdk
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Thanks for your video. I have also tested and recorded a video for your reference. please find it below:
                https://www.dropbox.com/s/bqc1qp1hdj...04-06.mp4?dl=0

                and I am using AddDataSeries(null, BarsPeriodType.Minute, BarsArray[0].BarsPeriod.Value, MarketDataType.Ask);
                will wait for your reply.
                Last edited by asmmbillah; 08-31-2020, 10:24 AM.

                Comment


                  #9
                  Hello asmmbillah,

                  Try using my test script. This was written for daily bars because this is what I saw in your initial screenshot.

                  As a heads up, using BarsArray[0].BarsPeriod.Value in AddDataSeries() is not supported by NinjaTrader Support.

                  From the help guide:
                  "Warning: This property should NOT be accessed within the OnStateChange() method before the State has reached State.DataLoaded"


                  "Arguments supplied to AddDataSeries() should be hardcoded and NOT dependent on run-time variables which cannot be reliably obtained during State.Configure (e.g., Instrument, Bars, or user input). Attempting to add a data series dynamically is NOT guaranteed and therefore should be avoided. Trying to load bars dynamically may result in an error similar to: Unable to load bars series. Your NinjaScript may be trying to use an additional data series dynamically in an unsupported manner."


                  So I will not be able to provide an example with that.
                  Attached Files
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    thanks for your reply. I have tested it by changing it to minute and period 1 hardcoded, still the same result. Or this cannot be done for a minute?

                    Comment


                      #11
                      Hello asmmbillah,

                      Try it on daily first as this is what the original screenshot was showing.

                      If you take the exact steps shown in the video are you getting different behavior than what is shown in the video?
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        yes, I have imported your sample file. tested it with daily. works fine.
                        Last edited by asmmbillah; 09-22-2020, 07:35 AM.

                        Comment


                          #13
                          Hello asmmbillah,

                          With minute bars it looks like the ask series (BarsInProgress 1) is closing before the primary series.

                          So when the primary closes, the ask series has already started building a new bar and the value from that gets set to the primary plot values.

                          If you were to also set Value[1] to Volumes[1][1] this would correct that after the primary closes.

                          Also, these values should probably only be set when BarsInProgress is 1.
                          Chelsea B.NinjaTrader Customer Service

                          Comment


                            #14
                            Thanks for your suggestions. I have made necessary changes as you advised above and tested. Found issues on plots which I have marked in two screenshots with red circles. Left chart in screenshot is using 1 min ask price data with VOL indicator, and right chart is using 1 min last price data with your sample indicator after making above changes. I am attaching the changed file and screenshotf for your ref and advice.

                            Comment


                              #15
                              Hello asmmbillah,

                              For those bars, which series closed first? BIP 0 or BIP 1?

                              It may be necessary to check that CurrentBars[0] is less than CurrentBars[1] for Values[1] to be set.
                              Chelsea B.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              672 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              379 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              111 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              577 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              582 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X