Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

2 plots, only one prints on chart

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

    2 plots, only one prints on chart

    I'm trying to plot a calculation on two different types of volume: level 2, non-historical volume calculated in OnMarketData, and regular historical (GetCurrentAskVolume() + GetCurrentBidVolume() volume.

    I'm trying to print both in a new panel using 'AddPlot(new Stroke(Brushes.Cyan), PlotStyle.Line,' for both, but only the historical, (GetCurrentAskVolume() + GetCurrentBidVolume(), prints. The other is ignored.

    The output window is giving me all the correct results, it just won't print.

    Do you know what I'm doing wrong?
    NT8, 8.0.2.0

    Thank you.

    #2
    Hello imalil,

    Thank you for your post.

    You would need to instead use the AddDataSeries() function to add additional bid and ask market data types. Then call those bar series for the values you need.

    For information on multiple bar series in your script please visit the following link: http://ninjatrader.com/support/helpG..._ask_serie.htm

    The syntax used from AddDataSeries() is as follows: AddDataSeries(string instrumentName, BarsPeriodType periodType, int period, MarketDataType marketDataType)

    Comment


      #3
      Thanks for the info, but I think I made the issue sound more complex than it actually is. I'll be more specific.

      An example: I made a simple indicator in NT7, which transferred to NT8. It has one data series. It calculates a number, then calculates a MA on that number. I have two plots in initialize for each result. It prints both lines fine.

      My new indicator has only one data series as well. I am simply getting two results, both of which are now calculated in OnMarketData. I have two plots, one for each result. The output window clearly shows everything is working as it should. Initialize and OnStateChange() are the same in both the MA and my new indicator. I am just not getting both outputs to print in my panel. Under OnStateChange() for both indicators I have:

      protected override void OnStateChange()
      {
      switch (State)
      {
      case State.SetDefaults:
      Name = "xxxx";
      Description = "xxxx";
      Initialize();
      break;
      }
      }
      I have no idea why it is like this. All my custom indicators seem to have this, which doesn't match NT indicators at all.

      Thank you for the help.

      Comment


        #4
        This has been fixed.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by The_Sec, Yesterday, 03:37 PM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by vecnopus, Today, 06:15 AM
        0 responses
        1 view
        0 likes
        Last Post vecnopus  
        Started by Aviram Y, Today, 05:29 AM
        0 responses
        5 views
        0 likes
        Last Post Aviram Y  
        Started by quantismo, 04-17-2024, 05:13 PM
        3 responses
        27 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by ScottWalsh, 04-16-2024, 04:29 PM
        7 responses
        36 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Working...
        X