Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

how do you index multiple volumetric data series?

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

    how do you index multiple volumetric data series?

    hi, i'm trying to reference multiple volumetric data series in a script.
    I add the volumetric data series here:

    else if (State == State.Configure)
    {
    AddVolumetric("ES 12-19", BarsPeriodType.Second, 15, VolumetricDeltaType.BidAsk, 1);
    AddVolumetric("ES 12-19", BarsPeriodType.Range, 8, VolumetricDeltaType.BidAsk, 1);
    }

    create a variable here:
    NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe barsType = Bars.BarsSeries.BarsType as
    NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe;

    but how do you access the bar values? for example, if I wanted to access the delta for the bar, I would normally reference: Print("Delta for bar: " + barsType.Volumes[CurrentBar].BarDelta); for example. Do I index Volumes, or current bar? not sure how to access the delta for both the second and range volumetric series.

    #2
    Hello Renorail,

    Thanks for your post.

    From the help guide you would use the following as the means to assign a BarsArray[n] to the instance you create:

    NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe barsType = BarsArray[1].BarsType as NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe;
    Reference: https://ninjatrader.com/support/help...tric_bars2.htm

    Note that the name of the instance is "barsType", so you could also change this to be as you need to identify the instance to then access the data for example:

    NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe my15s = BarsArray[1].BarsType as NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe;

    NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe my8r = BarsArray[2].BarsType as NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe;



    Print("15 second Total Volume: " + my15s.Volumes[CurrentBars[1]].TotalVolume);

    Print ("8 range Total Volume: "+ my8r.Volumes[CurrentBars[2]].TotalVolume);

    Last edited by NinjaTrader_PaulH; 10-01-2019, 07:01 AM. Reason: Please note "Ty pe" should be "Type"
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thank you Paul!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by PaulMohn, Today, 03:49 AM
      0 responses
      7 views
      0 likes
      Last Post PaulMohn  
      Started by inanazsocial, Today, 01:15 AM
      1 response
      9 views
      0 likes
      Last Post NinjaTrader_Jason  
      Started by rocketman7, Today, 02:12 AM
      0 responses
      10 views
      0 likes
      Last Post rocketman7  
      Started by dustydbayer, Today, 01:59 AM
      0 responses
      4 views
      0 likes
      Last Post dustydbayer  
      Started by trilliantrader, 04-18-2024, 08:16 AM
      5 responses
      23 views
      0 likes
      Last Post trilliantrader  
      Working...
      X