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:	146
Size:	6.8 KB
ID:	1331149
    Click image for larger version

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

    Click image for larger version

Name:	image.png
Views:	163
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:	133
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 cmoran13, 04-16-2026, 01:02 PM
        0 responses
        43 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        25 views
        0 likes
        Last Post PaulMohn  
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        163 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        98 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        158 views
        2 likes
        Last Post CaptainJack  
        Working...
        X