Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can i have several VolumetricBars in an array?

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

    Can i have several VolumetricBars in an array?

    Hi,

    I'm trying an indicator, where I want to have different Volumetric Bars added to a 5 minute BarChart.

    Under State Configure I have:
    AddVolumetric(null, BarsPeriodType.Minute, 10, VolumetricDeltaType.BidAsk, 1);
    AddVolumetric(null, BarsPeriodType.Minute, 15, VolumetricDeltaType.BidAsk, 1);​

    Under OnBarUpdate() I have:
    NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe barsType1 = BarsArray[1].BarsType as NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe;
    NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe barsType2 = BarsArray[2].BarsType as NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe;

    so when working the indicator logic, for
    if(BarsInProgress) = 1 I use barsType1
    and
    if(BarsInProgress) = 2 I use barsType2​​



    But I want to do it easier using another variable and having the "barsType" as an array, so I could define something like:
    NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe barsType[1] = BarsArray[1].BarsType as NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe;​
    NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe barsType[2] = BarsArray[2].BarsType as NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe;​​

    So I could have the logic later like:
    if(BarsInProgress) = index I use barsType[index]


    is it possible?

    #2
    Hi artson, thanks for posting. The code you posted looks like it should work as long as you've defined an array or List of type NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe. It should be possible, please test it and if it does not work you may post your script and I will try in on my PC.

    Kind regards,
    -ChrisL

    Comment


      #3
      Thanks

      Can you give me an example how to:
      defined an array or List of type NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe

      I tried something but I didn't work....

      Comment


        #4
        Hi artson, I posted my test script for reference.

        Kind regards,
        -ChrisL
        Attached Files

        Comment


          #5
          Thanks a lot Chris!

          It looks very goodI don't know about Lists

          I would have never found it!!!

          I'll try to implement it

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          85 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          47 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          29 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          32 views
          0 likes
          Last Post TheRealMorford  
          Started by Mindset, 02-28-2026, 06:16 AM
          0 responses
          67 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X