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 jclose, Today, 09:37 PM
      0 responses
      5 views
      0 likes
      Last Post jclose
      by jclose
       
      Started by WeyldFalcon, 08-07-2020, 06:13 AM
      10 responses
      1,413 views
      0 likes
      Last Post Traderontheroad  
      Started by firefoxforum12, Today, 08:53 PM
      0 responses
      11 views
      0 likes
      Last Post firefoxforum12  
      Started by stafe, Today, 08:34 PM
      0 responses
      11 views
      0 likes
      Last Post stafe
      by stafe
       
      Started by sastrades, 01-31-2024, 10:19 PM
      11 responses
      169 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Working...
      X