• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.


No announcement yet.

Partner 728x90


NT8b10 Strategy Plot disappears after Indicators list changes

  • Filter
  • Time
  • Show
Clear All
new posts

    NT8b10 Strategy Plot disappears after Indicators list changes

    Attached is a sample strategy showing the problem. To reproduce follow the steps:
    1. Load and enable SampleDisappearingStratPlot on the chart.
    2. You should have StrategyPlot plotting in panel below.
    3. Now add any indicator to the chart.
    4. StrategyPlot stops plotting.
    5. Refresh (F5) the chart
    6. StrategyPlot plots again

    PS. The disappearing also happens when you remove any indicator from the chart - simply any time you makes changes to indicators list.
    Attached Files
    Last edited by gregid; 03-26-2016, 05:58 AM.

    I see this too as you have described.

    It looks like it's not being fully recalculated from the strategy. Ie - if you add StrategyPlot to the chart - you get nothing also, because it has nothing.

    Interesting - it is being called from the strategy and processed. If you add a Print in OBU of the indicator .. and add/remove indicator - it prints all 0.

    	protected override void OnBarUpdate()
    			//Add your custom indicator logic here.
    			Print ("SP ind OBU:" + Values[0][0] ); 
    			//Values[0][0] = Opens[0][0]-10;
    When you refresh - you get values.

    If you in the strategy hardcode a value - you still get 0's until a refresh.
    		    sPlot.Value[0] = 1900;//Close[0];

    Perhaps the indicator is acting like an indicator when called from ADD/Remove indicator - and not from the strategy. It might be in the incorrect order in eventloop for this case.


      Hello gregid,

      I was able to confirm that the embedded indicator will stop updating when another indicator is added to the chart, and will resume updating when the chart is refreshed.

      However, I noticed in your source that you were calling


      While both are DataSeries, Plots and Indicators are not synonymous. I am attaching a modified version of the indicator you have sent me. It has been modified as follows :

      • The built-in indicator @SMA has been removed from your indicator package
      • The above line of code has been changed to


      I do not see the behavior you observed with the attached indicator package. Please test with this package. If the observed behavior persists, please let us know.
      Attached Files
      Jessica P.NinjaTrader Customer Service


        Thanks Jessica, but I am afraid you misunderstood the problem. I do not care about SMA at all and in my sample strategy I supplied dummy values (Close[0]) to the external plot. The StrategyPlot use here is of crucial importance. Think of the use case: plotting PnL values from the strategy. The use of the StrategyPlot has been always used for this purpose and still needs to be used in NT8 if one wants to plot in more than one panel. Please refer to your Reference Samples section.


          Here is related discussion:


            In case it wasn't obvious from my previous post let me clarify this.
            I am well aware of the possibility to add plots directly from strategy. Unfortunately this solution is only satisfactory if one is happy with plots added to the same panel as strategy and changing Panel in the strategy will move the strategy together with the plots to the selected (one) panel. So until there will be a way to plot in separate, multiple panel we must resort to the old method that currently shows the behaviour you were able to confirm on your end.
            In short - I appreciate your effort but unfortunately your suggested solution doesn't solve my problem and I am asking for a fix to this particualr issue.


              Hello gregid,

              For our records, I found what I believe to be the StrategyPlot Indicator for NinjaTrader 7 that you were referring to.


              Thank you for the further explanation, and for the link to the other thread. After carefully reviewing and testing this code, I was able to determine that we will not be able to use the approach you are attempting to use exactly. While we could move the code which updates sPlot.Values from the Strategy's OnBarUpdate to the Indicator's, and avoid this situation entirely, as you have pointed out we need to be able to update plots directly from a Strategy.

              So although the StrategyPlot approach from NinjaTrader 7 will no longer be available, NinjaTrader 8 was enhanced and now allows you to plot directly from a StrategyBase rather than needing to Add() a separate indicator to handle the plotting. It should be understood that the methods and objects used to plot on a chart may implemented via different classes which have different dependencies, and as such, may behave slightly differently or some properties which you can use in an indicator may not be available from a strategy. You will need to ensure that CalculatePlot is non-null to use this approach.

              In the meantime, we are also investigating this situation, where one would like to update an indicator from a strategy. When more information on our investigation, or any new sample code for NinjaTrader 8, is available, I will update this thread.
              Jessica P.NinjaTrader Customer Service


                As mentioned before - plotting from strategy directly (AddPlot) is more limitting then adding indicator and plotting to it. The latter allows to plot in separate panels. This approach works fine with the exception of changing of the indicators list where it loses values and requires strategy refresh. So I do not understand what do you mean by "StrategyPlot approach from NinjaTrader 7 will no longer be available". Are you going to take the functionality away?

                Please do not. I am only asking to look into possible fix eg. excluding indicators added from strategy from the list of indicators to be refreshed when other indicators change (Indicators PropertyGrid pressing OK or Apply button). And I would still prefer to have a flawed solution to none.


                  I misspoke earlier, we are not planning on removing any functionality. We are working to see why the sub indicator won't redraw. I will update this thread when we have any more information. I apologize for the misunderstandings and confusion, and am glad you were persistent and patient with your explanations.
                  Jessica P.NinjaTrader Customer Service


                    Hello gregid,

                    We have reviewed this case and it is expected that the behavior was caused by all indicators reloading on the chart as you pressed OK to close the indicators dialog. The strategy does not reload at this point which is why pressing F5 would reload your strategy and bring the plot back.

                    Brett has updated our NT8 reference sample here with what you may be looking for: http://ninjatrader.com/support/forum...4259#post34259

                    Please let me know if you have any questions or if I may be of further assistance.
                    Michael M.NinjaTrader Quality Assurance


                      Hi Michael

                      In regards to where the problem is - we agree the issue is that all indicators are refreshed and losing the strategy data. I have tried the reference sample but it doesn't resolve the problem. In fact after indicator refresh on the chart it will raise error on Bar 0 since Strategy == null.
                      So for a reference sample I recommend adding null check before changing plot values.
                      Also since it doesn't resolve the refresh issue I would think the NT7 way is a better option since it is more generic and doesn't duplicate data series unnecesarilly.

                      In terms of resolution to the problem - could (as I previously suggested) indicators added from strategy be excluded from the refreshed indicators? And only refresh with the strategy?
                      There are already certain constraints on strategy-added-indicators, eg. you cannot remove these indicators from the list - which is reasonable just as it is reasonable they shouldn't be refreshed from the level of indicators (for the same reason).


                        Hello gregid,

                        As a workaround, I am including an updated copy of the indicator you sent me, in which I :
                        • send a value to an indicator
                        • use its value in OnBarUpdate()
                        • send another value out of the indicator back to the strategy
                        • use that value to plot with

                        As you can see, this allows us to both use an indicator such as StrategyPlot directly, and to plot that indicator on the chart. If you set IsOverlay = false in the strategy, the strategy's own plots will be in a separate panel, and its indicators can be plotted to separate panels as well. I realize there are use cases where you would definitely want to plot directly from an indicator, rather than having an indicator relay its data to its parent strategy for plotting, but I am hoping this is useful in the meantime until this use case is covered.
                        Attached Files
                        Jessica P.NinjaTrader Customer Service


                          Thank you Jessica,

                          I appreciate your effort but I am having problem identifying which problem does the suggested workaround resolve. Please bear with me as I explore it:
                          1. I can already plot directly to strategy plot without a need for external indicator but... this will only plot in a single panel the same is the case with suggested workaround
                          2. The refresh problem will obviously not happen since it is only using internal plot from strategy (AddPlot). But this is exactly the same as feeding values directly to the plot in the strategy.
                          So my question is: what is the advantage of your workaround to simply feeding plot values directly without the amended indicator?
                          The main reason for using the StrategyPlot indicator is to be able to use multiple panel plotting which works fine with the exception of Indicators list refresh, so please let me know if I am missing something.


                            Hello gregid,

                            I appreciate your feedback as we work to find a solution that will meet your needs.

                            1. If the only feature of an indicator that is of value to you is plotting to another window, have you attempted to use the IsOverlay property, to send all the strategy's own plots to a new panel?

                            2. I had assumed that you wanted to be able to use an indicator for more than just sending plots to a new panel. If this is not the case, then this approach does not offer you any advantages.
                            Jessica P.NinjaTrader Customer Service


                              1. It's the need to have MULTIPLE panel plotting (eg. some data in panel 2, some in panel 3) that is the problem and a reason to utilize StrategyPlot indicator
                              2. Agreed as it is it doesn't give me any advantage right now, but good to know a way of doing it.


                              Latest Posts


                              Topics Statistics Last Post
                              Started by JohnS52, Today, 09:49 AM
                              0 responses
                              Last Post JohnS52
                              by JohnS52
                              Started by billythekid72, Today, 09:47 AM
                              0 responses
                              Last Post billythekid72  
                              Started by DTSSTS, Today, 08:29 AM
                              2 responses
                              Last Post DTSSTS
                              by DTSSTS
                              Started by mtamaku, Today, 08:39 AM
                              3 responses
                              Last Post NinjaTrader_ChelseaB  
                              Started by Douglee, Today, 08:11 AM
                              2 responses
                              Last Post Douglee
                              by Douglee