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 f.saeidi, Today, 12:14 PM
        2 responses
        5 views
        0 likes
        Last Post f.saeidi  
        Started by TradeForge, 04-19-2024, 02:09 AM
        2 responses
        28 views
        0 likes
        Last Post TradeForge  
        Started by aprilfool, 12-03-2022, 03:01 PM
        3 responses
        327 views
        0 likes
        Last Post NinjaTrader_Adrian  
        Started by giulyko00, Today, 12:03 PM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by AnnBarnes, Today, 12:17 PM
        1 response
        2 views
        0 likes
        Last Post NinjaTrader_Zachary  
        Working...
        X