Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Display Volumetric Code on Range Chart

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

    Display Volumetric Code on Range Chart

    I created a custom indicator using volumetric bars. The code works fine on volumetric bar chart however I want the indicator to populate on the range chart instead. The indicator draws a blue box when a condition is met. To be able to get the volumetric indicator to populate on the range chart, I opened a chart and inputted two data series (4 range and 4 range volumetric). I added the indicator to the chart and assigned the Input Series to the 4 Range Volumetric (since the indicator code uses Volumetric bars) and assigned the Panel to 1 (the 4 range chart). Why wouldn't this work? See below for the snip of the code. See below snip of the chart and the indicator parameters. The blue box only seems to show up on the 4 Range Volumetric chart.

    Click image for larger version

Name:	image.png
Views:	127
Size:	6.8 KB
ID:	1331149
    Click image for larger version

Name:	image.png
Views:	123
Size:	9.0 KB
ID:	1331148

    Click image for larger version

Name:	image.png
Views:	143
Size:	82.4 KB
ID:	1331147

    #2
    Hello algospoke,

    To use volumetric data the script needs to add that data in its code, you can't access other bar series from the chart.

    After adding the volumetric series by using AddVolumetric you would also need to change the code to BarsArray which is shown in the sample for using volumetric data.



    https://ninjatrader.com/support/help...tric_bars2.htm
    protected override void OnBarUpdate()
    {
    if (Bars == null)
    return;


    // script, you could call AddVolumetric() in State.Configure and then for example use
    // NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe barsType = BarsArray[1].BarsType as
    // NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe;

    Comment


      #3
      Jesse,

      Awesome. Thanks for the feedback. Do I have to hard code the instrument and the BarsPeriodType in AddVolumetric? For example, once I add the indicator to the chart and if I want to change the instrument on the chart or the time frame, I don't want to have to always go back to the code to fix it.

      Click image for larger version

Name:	image.png
Views:	116
Size:	11.7 KB
ID:	1331532

      Comment


        #4
        Hello algospoke,

        You don't need to hard code the instrument, you can just use null in place of the string for the instrument name. The other values do need to be hard coded.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        558 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        324 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
        545 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        547 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X