Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ask volume

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

    #16
    thanks for your reply. It is really hard to follow which one closed first. however, with careful observation I could see, none of them are closed first, rather it is random. or if you know a better way to find out that you could suggest me so that I could provide you with more accurate info. Most important part is, the bars which are alrady plotted, later those are changing theri heights. And about "necessary to check that CurrentBars[0] is less than CurrentBars[1] for Values[1] to be set." - I am not sure what you proposed there, I would appreciate if you could be a bit more detailed there fore my understanding. thank in advance.
    Last edited by asmmbillah; 08-31-2020, 01:30 PM.

    Comment


      #17
      Hello asmmbillah,

      Use prints to find any information.

      Print the BarsInProgress to the output window along with the time of the bar at the top of OnBarUpdate().

      Previously, I have suggested you may try setting the Value of the previous bar to the Volume of the previous bar to correct if the ask is updating before the primary.

      However, this only needs to be corrected if the ask updates first, and the volume resets before the primary has a new bar slot for the plot. When the primary does update the current ask volume, which has already reset, is likely being set to the plot.

      So if CurrentBars[0] is less than CurrentBars[1] on time based series, this would imply that BarsInProgress 1 (the ask), has updated before BarsInProgress 0 (the primary) and it is appropriate to correct the previous bars value.
      Last edited by NinjaTrader_ChelseaB; 08-31-2020, 02:52 PM.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #18
        Thanks for your reply. I have done the prints I could see the below and I think, Additional data series ie, ask is updating first. See the output prints below:
        21/08/2020 05:02:00 : BIP = 01725
        21/08/2020 05:02:00 : BIP = 11732
        Value[0] : 4777 Value[1] : 4068
        21/08/2020 05:03:00 : BIP = 01725
        21/08/2020 05:03:00 : BIP = 11733
        Value[0] : 19 Value[1] : 4777
        21/08/2020 05:03:00 : BIP = 01725
        21/08/2020 05:03:00 : BIP = 11733
        Value[0] : 39 Value[1] : 4777
        21/08/2020 05:03:00 : BIP = 01725
        21/08/2020 05:03:00 : BIP = 11733
        Value[0] : 58 Value[1] : 4777
        21/08/2020 05:03:00 : BIP = 01725
        21/08/2020 05:03:00 : BIP = 11733
        Value[0] : 78 Value[1] : 4777
        21/08/2020 05:03:00 : BIP = 01725
        21/08/2020 05:03:00 : BIP = 11733
        Value[0] : 97 Value[1] : 4777
        21/08/2020 05:03:00 : BIP = 01725
        21/08/2020 05:03:00 : BIP = 11733
        Value[0] : 113 Value[1] : 4777
        21/08/2020 05:03:00 : BIP = 01725
        21/08/2020 05:03:00 : BIP = 11733
        Value[0] : 130 Value[1] : 4777
        21/08/2020 05:03:00 : BIP = 01725
        21/08/2020 05:03:00 : BIP = 11733
        Value[0] : 150 Value[1] : 4777
        21/08/2020 05:03:00 : BIP = 01725
        21/08/2020 05:03:00 : BIP = 11733
        Value[0] : 173 Value[1] : 4777
        21/08/2020 05:03:00 : BIP = 01726
        21/08/2020 05:03:00 : BIP = 11733
        Value[0] : 173 Value[1] : 4777
        21/08/2020 05:03:00 : BIP = 01726
        21/08/2020 05:03:00 : BIP = 11733
        Value[0] : 197 Value[1] : 4777


        But though I am checking for if (CurrentBars[0] < CurrentBars[1]), it is updating the previous few plots, but which does not match with VOL indicator with ASK data as input. See the screenshot and I have circled with RED to show the above output prints's location. Then I ran the test for some time and differences became more and I have marked them with red circles in a second screenshot named "Later". Please advise.
        Last edited by asmmbillah; 09-22-2020, 07:33 AM.

        Comment


          #19
          Hello asmmbillah,

          It looks like the series loaded a different amount of bars.

          Are there some places where there are no updates for the primary series? I still would expect a bar close even if no data was received during that time on a time based bar.

          Maybe compare Times[1][0] being greater than Times[0][0] on the first tick of a new bar when the when the primary series is updating?
          Chelsea B.NinjaTrader Customer Service

          Comment


            #20
            Thanks for your reply. Please find the prints after advised changes:

            21/08/2020 06:24:00 : BIP = 0 - 1807
            21/08/2020 06:24:00 : BIP = 1 - 1814
            Value[0] : 3667 Value[1] : 3146
            21/08/2020 06:24:00 : BIP = 0 - 1807
            21/08/2020 06:24:00 : BIP = 1 - 1814
            Value[0] : 3671 Value[1] : 3146
            21/08/2020 06:24:00 : BIP = 0 - 1807
            21/08/2020 06:25:00 : BIP = 1 - 1815
            Value[0] : 5 Value[1] : 3671
            21/08/2020 06:24:00 : BIP = 0 - 1807
            21/08/2020 06:25:00 : BIP = 1 - 1815
            Value[0] : 12 Value[1] : 3671
            21/08/2020 06:24:00 : BIP = 0 - 1807
            21/08/2020 06:25:00 : BIP = 1 - 1815
            Value[0] : 20 Value[1] : 3671
            21/08/2020 06:24:00 : BIP = 0 - 1807
            21/08/2020 06:25:00 : BIP = 1 - 1815
            Value[0] : 29 Value[1] : 3671
            21/08/2020 06:24:00 : BIP = 0 - 1807
            21/08/2020 06:25:00 : BIP = 1 - 1815
            Value[0] : 40 Value[1] : 3671
            21/08/2020 06:24:00 : BIP = 0 - 1807
            21/08/2020 06:25:00 : BIP = 1 - 1815
            Value[0] : 52 Value[1] : 3671
            21/08/2020 06:24:00 : BIP = 0 - 1807
            21/08/2020 06:25:00 : BIP = 1 - 1815
            Value[0] : 65 Value[1] : 3671
            21/08/2020 06:24:00 : BIP = 0 - 1807
            21/08/2020 06:25:00 : BIP = 1 - 1815
            Value[0] : 77 Value[1] : 3671
            21/08/2020 06:24:00 : BIP = 0 - 1807
            21/08/2020 06:25:00 : BIP = 1 - 1815
            Value[0] : 88 Value[1] : 3671
            21/08/2020 06:24:00 : BIP = 0 - 1807
            21/08/2020 06:25:00 : BIP = 1 - 1815
            Value[0] : 97 Value[1] : 3671
            21/08/2020 06:24:00 : BIP = 0 - 1807
            21/08/2020 06:25:00 : BIP = 1 - 1815
            Value[0] : 104 Value[1] : 3671
            21/08/2020 06:24:00 : BIP = 0 - 1807
            21/08/2020 06:25:00 : BIP = 1 - 1815
            Value[0] : 110 Value[1] : 3671
            21/08/2020 06:24:00 : BIP = 0 - 1807
            21/08/2020 06:25:00 : BIP = 1 - 1815
            Value[0] : 115 Value[1] : 3671
            21/08/2020 06:24:00 : BIP = 0 - 1807
            21/08/2020 06:25:00 : BIP = 1 - 1815
            Value[0] : 119 Value[1] : 3671
            21/08/2020 06:24:00 : BIP = 0 - 1807
            21/08/2020 06:25:00 : BIP = 1 - 1815
            Value[0] : 122 Value[1] : 3671
            21/08/2020 06:25:00 : BIP = 0 - 1808
            21/08/2020 06:25:00 : BIP = 1 - 1815
            Value[0] : 122 Value[1] : 3671
            21/08/2020 06:25:00 : BIP = 0 - 1808
            21/08/2020 06:25:00 : BIP = 1 - 1815
            Value[0] : 124 Value[1] : 3671

            Last edited by asmmbillah; 09-22-2020, 07:33 AM.

            Comment


              #21
              Hello asmmbillah,

              The checking of the times was not implemented in your condition. This is checking the CurrentBars instead, which unexpectedly are different amounts.

              I was not able to confirm, are there some places where there are no updates for the primary series?

              21/08/2020 06:24:00 : BIP = 0 - 1807
              21/08/2020 06:25:00 : BIP = 1 - 1815

              This appears to be a place where BarsInProgress 0, is still processing the minute behind BarsInProgress 1 which has moved on to the new bar already. Once BarsInProgress 0 has updated to the 6:25 bar, the value for the previous bar will need to be reset to the volume of Values[1][1], or it will only contain the first few updates of BarsInProgress 1 on the current bar.
              You may need to find some custom logic to get this right, but checking the times of the bars should tell you when BarsInProgress 1 is updated to the new bar before BarsInProgress 0.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #22
                Thanks for your reply. unfortunately what you mentioned and stated, that already I can see. but as this issue is with this platform specific, I wanted more specific support or guidance on it. you mentioned me to find a custom logic, but I have no idea whats happening in the background in this platform - I thought you might have. Therefore, I thought you would offer a solution at least to solve this NT related irregular behaviour. was I expected that correctly?
                Also, from my observation what I can see is, as it calculates on each tick, therefore unless there is a tick, it holds anything for calculation. I have changed it to on price change calculation to test. but your ask price and last price movements are not same. therefore, it does not solve the issue. I hope your product development team might be interested to look into this on how to overcome this issue.
                Last edited by asmmbillah; 09-02-2020, 12:48 PM.

                Comment


                  #23
                  Hello asmmbillah,

                  Its a matter of order-of-events that is specific to what you are trying to accomplish.
                  You are wanting show show the data of an added series but with a plot synchronized to a different series that is updating at a different time.

                  (Are you finding that just adding that series to the chart and using that series for the input to the indicator is insufficient so are you wanting to do this in code?
                  How to Plot Indicators on Hidden Data Series in NinjaTrader - https://youtu.be/XRGxiO3XW-k)

                  The plots are tied to the primary series. You are adding another series which is updating at different times than the primary series. You are wanting to make the data from the added series fit into the primary series.

                  If the added series is updating first, once the primary updates it will be getting the fresh values from the new bar of the added series.

                  The logic I am suggesting for what you are trying to accomplish would have to be custom logic for your custom script, in which you are trying to fit data from another source into a container built for a different series.

                  I'm suggesting, if the added series starts a new bar and the primary series has not yet started processing that bar, then wait until the primary series is processing the new bar as well, then reset the previous values.
                  Comparing the time of the added series to be greater than the primary series would be when the added series is updating first, and the previous bar should get updated.

                  Below is example code to assist
                  Code:
                  private bool resetBar;
                  
                  if (Times[1][0] > Times[0][0])
                  {
                  // BIP 1 has updated before BIP 0
                  resetBar = true;
                  }
                  
                  if (resetBar == true && Times[1][0] == Times[0][0])
                  {
                  // BIP 0 is now on the current bar, reset previous bars value
                  Values[0][1] = Volumes[1][1];
                  }
                  The point being, should the primary update before the added series, then we don't want to do this so that we don't end up getting the information from the added series previous bar before it has had a chance to update. The logic would need to accomplish that.

                  (If the series had the same number of bars, which I was expecting, checking the CurrentBar numbers would have accomplished this as well, however they don't seem to have loaded the same amount of bars. From your print it looks like the primary series has less bars than the added series. Are you seeing this on the chart or in the output data? Places where the primary series doesn't have a bar?)

                  Your alternative is to run Calculate with OnBarClose instead of OnEachTick, so the added series cannot start processing a new bar before the primary series.



                  As a disclaimer, in the support department at NinjaTrader it is against our policy to create, debug, or modify, code or logic for our clients. This is so that we can maintain a high level of service for all of our clients as well as our partners.

                  That said, I am happy to answer any questions you may have about NinjaScript if you decide to code this yourself.

                  You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our business development follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request.
                  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
                  673 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