Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Printing Secondary with Volumetric Being the Primary

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

    Printing Secondary with Volumetric Being the Primary

    In my strategy I have my Primary as a Volumetric Tick Chart and the Secondary a 30 Sec Chart. Im trying to use BarsInProgress to print the Secondary price but its not doing it. Under State.Configure I have the timeframe, "AddDataSeries("MNQ 03-21", Data.BarsPeriodType.Second, 30, Data.MarketDataType.Last)". If I take away the Volumetric bars in OnBarUpdate, BarsInProgress == 1 works.

    This is what i have using the example in the manual. [url]https://ninjatrader.com/support/helpGuides/nt8/?order_flow_volumetric_bars2.htm[/url]


    else if (State == State.Configure)
    {
    AddDataSeries("MNQ 03-21", Data.BarsPeriodType.Second, 30, Data.MarketDataType.Last);
    }

    }

    protected override void OnBarUpdate()
    {

    if (Bars == null)
    return;

    NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe barsType = Bars.BarsSeries.BarsType as
    NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe;

    if (barsType == null)
    return;

    // Trying to Print 30 Sec Period
    if (BarsInProgress == 1)
    {
    Print(Convert.ToString(Times[1][0]) + Closes[1][0]);
    }

    How can I get the 30 sec to print with volumetric data?

    #2
    Hello Tmaninc,

    Thanks for your post.


    What is happening is that the code for the volumetric bars is being applied to the non-volumetric 30-second bars because you have not isolated the volumetric code to BarsInProgress 0 (chart bars).

    You need to encapsulate as follows:

    [I][B]if (BarsInProgress == 0)[/B]
    [B]{[/B]
    if (Bars == null)
    return;

    NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe barsType = Bars.BarsSeries.BarsType as
    NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe;

    if (barsType == null)
    return;
    [B]}[/B][/I]
    Last edited by NinjaTrader_PaulH; 01-01-2021, 07:14 AM. Reason: Moving topic to NinjaTrader8 strategy forum.

    Comment


      #3
      Thanks Paul

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      599 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      344 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      103 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      558 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      557 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X