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 StockTrader88, 03-06-2021, 08:58 AM
          44 responses
          3,966 views
          3 likes
          Last Post jhudas88  
          Started by rbeckmann05, Today, 06:48 PM
          0 responses
          4 views
          0 likes
          Last Post rbeckmann05  
          Started by rhyminkevin, Today, 04:58 PM
          4 responses
          54 views
          0 likes
          Last Post dp8282
          by dp8282
           
          Started by iceman2018, Today, 05:07 PM
          0 responses
          5 views
          0 likes
          Last Post iceman2018  
          Started by lightsun47, Today, 03:51 PM
          0 responses
          8 views
          0 likes
          Last Post lightsun47  
          Working...
          X