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.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thanks Paul

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Stanfillirenfro, Yesterday, 09:19 AM
      7 responses
      51 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by TraderCro, 04-12-2024, 11:36 AM
      4 responses
      69 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Mindset, Yesterday, 02:04 AM
      1 response
      15 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by agclub, 04-21-2024, 08:57 PM
      4 responses
      18 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by Irukandji, Today, 04:58 AM
      0 responses
      6 views
      0 likes
      Last Post Irukandji  
      Working...
      X