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

Plot from strategy into different panel.

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

    Plot from strategy into different panel.

    I wanted to plot 3 int values from deep within my strategy. They are very small values with a range of -10 to +10 so I don't want to print on the main panel with the ES but below it like shown: HERE

    I saw this example but it uses AddIndicator() which I'm not sure I need to go through the hassle of implementing since the values are nested pretty deep and I don't know how to export them:
    When running a strategy on a chart you may find the need to plot values onto a chart. If these values are internal strategy calculations that are difficult to migrate to an indicator, you can use the following technique to achieve a plot. NinjaTrader 8 With NinjaTrader 8 we introduced strategy plots which provide the ability


    It seems like from that example I'd have to export values from my strategy to an indicator and then host that indicator back in my strategy?

    Is there a simple way to get those values on a separate panel?

    Thanks!
    Last edited by hillborne; 05-18-2017, 11:52 PM.

    #2
    Hello hillborne,

    Thanks for writing in.

    As stated in the sample's thread, the sample describes how to plot multiple indicators so they plot to multiple separate panels. You can use AddPlot() just like you can for indicators. Using AddPlot() from the strategy will only allow you to plot to 1 additional panel.

    With NinjaTrader 8 we introduced strategy plots which provide the ability for a strategy to render its own plots. These plots must be specific to a single panel just like indicators. If you need to have strategy plots on more then a single panel then please use the technique seen in the attached sample. You can find documentation on the standard methods for plotting in the Indicator help guide section, although the documents are for indicators the plotting items are shared between indicators and strategies.

    You can still use the same technique as NT7 for expanded plotting options or multi panel plotting, the attached sample is a duplication of the original NT7 sample.

    Important related documentation:
    Plotting from a strategy with Indicator plot methods
    There is sample code in the help guide for AddPlot() that does what you are looking for and can be used in a strategy:

    Code:
    protected override void OnStateChange()
    {
      if (State == State.SetDefaults)
      {
        Name = "Examples Indicator";
     
        // Add three plots and associated Series<double> objects
        AddPlot(Brushes.Blue, "PlotA");     // Defines the plot for Values[0]
        AddPlot(Brushes.Red, "PlotB");     // Defines the plot for Values[1]
        AddPlot(Brushes.Green, "PlotC");   // Defines the plot for Values[2]
      }
    }
    protected override void OnBarUpdate()
    {
      Values[0][0] = Median[0];   // Blue "Plot A"
      Values[1][0] = Low[0];       // Red "Plot B"
      Values[2][0] = High[0];     // Green "Plot C"
    }


    Please let me know if I may be of further help.
    JimNinjaTrader Customer Service

    Comment


      #3
      Hi Jim,

      Thanks for the quick reply.

      I'm using that technique to plot a few different EMA's on the main panel. Do you have a reference for how to export some internal values to a different panel?

      I don't know how to specify that 3 other values should appear on a different panel. The example I quoted seems to say that you need to create a separate indicator for those 3 values and then have the strategy export those values and then host that indicator in order to plot those values?

      It's all a little too recursive so if you could simply explain if it's possible to get three ints from a strategy on to a separate panel, that'd be great.

      Comment


        #4
        Hello hillborne,

        Thanks for the reply.

        The example I quoted seems to say that you need to create a separate indicator for those 3 values and then have the strategy export those values and then host that indicator in order to plot those values?
        This is correct. You will need to add 3 instances of indicators that plot to a separate panel and update those plots with values from your strategy. You can use the SamplePanelPlot indicator included with the sample you had linked to plot to separate panels.

        Simply put, for separate panels for each plot, use multiple instances of the SamplePanelPlot indicator from the linked sample. For multiple plots in one separate panel, use AddPlot().

        Please let me know if I may be of further help.
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by DJ888, 04-16-2024, 06:09 PM
        4 responses
        12 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by terofs, Today, 04:18 PM
        0 responses
        9 views
        0 likes
        Last Post terofs
        by terofs
         
        Started by nandhumca, Today, 03:41 PM
        0 responses
        7 views
        0 likes
        Last Post nandhumca  
        Started by The_Sec, Today, 03:37 PM
        0 responses
        3 views
        0 likes
        Last Post The_Sec
        by The_Sec
         
        Started by GwFutures1988, Today, 02:48 PM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Working...
        X