Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

GetMaximumVolume not matching with Order Flow Volume Profile

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

    GetMaximumVolume not matching with Order Flow Volume Profile

    Hi there,

    I've just wrote a small scipt that logs the maximum volume in the VolumetricBars series which is set like :

    Code:
    else if (State == State.Configure)
    {
          // adding volumetric series to the script
          AddVolumetric(null, Data.BarsPeriodType.Month, 1, Data.VolumetricDeltaType.BidAsk, 1);
     }
    I am then logging this and matching the logged values to the Order Flow Volume Profile POC which is a monthly volume profile and the numbers are slightly off by a few prices?

    Here is the code for logging and identifying the max volume of the monthly bar:

    Code:
    protected override void OnBarUpdate()
    {
    
                 IdentifyHighestVolumePrice();
    
    }
    
    private void IdentifyHighestVolumePrice()
    {
    
                 NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe barsType = BarsArray[1].BarsType as BarsTypes.VolumetricBarsType;
                 try
                 {
                           // identifies the highest volume of the current bar
                           double priceOfHighestVolume;
                          barsType.Volumes[CurrentBars[1]].GetMaximumVolume(null, out priceOfHighestVolume);
    
                         Log("priceOfHighestVolume at month " + CurrentBars[1]);
                         Log(priceOfHighestVolume);
    
                   }
                  catch
                   {
                   }
    }

    Ive attached screenshots of the chart and logs. There are logs for the first monthly bar (october which because i only have 75 days loaded is only the partial month), november and december.

    Im calculating OnBarClose. And tick replay is off.

    Thanks a lot,

    Tarik
    Attached Files

    #2
    Hello tarikmedjber,

    Thank you for your post.

    I'm using what looks to be the same chart settings but I'm not seeing it print as I'd expect for all the months. Could you provide an exported copy of the script so I can be sure we're testing the same code? You can export the script from Tools > Export > NinjaScript Addon. Do not check the box to export as a compiled assembly or I will not be able to review the logic. Please attach the resulting .Zip file to your reply.

    Thanks in advance; I look forward to assisting you further.

    Comment


      #3
      Hi Kat,

      Thanks for getting back to me.

      I've attached the script.

      I have it on a 60 minute es chart. I've attached a screenshot of that configuration as well.

      Thanks again,

      Tarik


      Attached Files

      Comment


        #4
        Hello tarikmedjber,

        Thank you for your reply.

        I'm not seeing the script attached, can you try again to attach that?

        Thanks in advance; I look forward to assisting you further.

        Comment


          #5
          Hi sorry about that,

          Is it not showing there for you? (Ive attached a screenshot)

          Thanks

          Attached Files

          Comment


            #6
            Hi,

            i don't know what happened there, it has disappeared for me as well.

            Trying again here...

            Thanks !
            Attached Files

            Comment


              #7
              Hello,

              Can someone help?

              Thanks

              Comment


                #8
                Hello tarikmedjber,

                Thank you for your replies.

                Our volume of inquiries is quite high in the mornings and I have not had time yet today to review your code as it was posted during the night last night for me. As soon as I have had the chance to review I will let you know my findings.

                Thanks in advance for your patience.

                Comment


                  #9
                  Hi Kate, ahh no problem, understandable! Thanks

                  Comment


                    #10
                    Hello tarikmedjber,

                    Thank you for your reply.

                    I think you're comparing apples to oranges here, so to speak.

                    I'm seeing this match the POC when the Volume Profile is set up like so:

                    Click image for larger version

Name:	2022-01-12_10-08-05.png
Views:	251
Size:	57.6 KB
ID:	1185418

                    Keep in mind that because you're referencing a secondary series that's 1 month long, you won't be able to retrieve values before that series has at least 1 bar to check. So you should add a check for the number of bars in that series to the top of OnBarUpdate:

                    protected override void OnBarUpdate()
                    {
                    if(CurrentBars[1] < 1)
                    return;

                    IdentifyHighestVolumePrice(1);

                    }

                    Also keep in mind that you can't retrieve those values for that month until that monthly bar closes since you're running OnBarClose, so during the current month you would see the POC for the prior month returned.

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

                    Comment


                      #11
                      Hey Kate,

                      Good news!

                      The Apple and Orange were definitely not the same haha!

                      The Display mode I had was set as "Standard" rather then Buy Sell.

                      Everything is in order now and thanks for the tips!

                      Super help, thank you and have a great rest of your day

                      Tarik

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                      0 responses
                      571 views
                      0 likes
                      Last Post Geovanny Suaza  
                      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                      0 responses
                      331 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by Mindset, 02-09-2026, 11:44 AM
                      0 responses
                      101 views
                      0 likes
                      Last Post Mindset
                      by Mindset
                       
                      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                      0 responses
                      549 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by RFrosty, 01-28-2026, 06:49 PM
                      0 responses
                      550 views
                      1 like
                      Last Post RFrosty
                      by RFrosty
                       
                      Working...
                      X