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
    Chris L.NinjaTrader Customer Service

    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
        Chris L.NinjaTrader Customer Service

        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 Taddypole, 04-26-2024, 02:47 PM
          1 response
          12 views
          0 likes
          Last Post NinjaTrader_Eduardo  
          Started by futtrader, 04-21-2024, 01:50 AM
          6 responses
          58 views
          0 likes
          Last Post futtrader  
          Started by sgordet, Today, 11:48 AM
          0 responses
          4 views
          0 likes
          Last Post sgordet
          by sgordet
           
          Started by Trader146, Today, 11:41 AM
          0 responses
          5 views
          0 likes
          Last Post Trader146  
          Started by jpapa, 04-23-2024, 07:22 AM
          2 responses
          21 views
          0 likes
          Last Post rene69851  
          Working...
          X