Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Added indicator isn't plotting the line

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

    Added indicator isn't plotting the line

    I added a data series and ATR indicator to my strategy. I am able to print atr1[0] to the output panel (with accurate values), but only the indicator panel is painting to the chart. Not the graph of the values. My primary series is a range chart. The added series is a 1-minute chart if that makes a difference. The indicator labels with the default values (like they do whenever there's an error) and are not in range of the atr1 values.

    Here is the code snippet:

    }else if (State == State.DataLoaded){
    atr1 = ATR(BarsArray[2],20);
    atr1.Plots[0].Brush = Brushes.Green;
    AddChartIndicator(atr1);

    #2
    Hello Chippy,

    When using indicators that target a secondary series those cannot be added using AddChartIndicator, there is a note about that in the AddChartIndicator page. If you wanted to plot the atr value you would need to use AddPlot to create a plot and then assign the ATR to that plot:

    Code:
    if(BarsInProgress == 0) Value[0] = art1[0];
    That would create a consistent plot of the atr values at the time of the primary close.


    Comment


      #3
      Thanks Jesse, that's not going to work for me... this is for a strategy. My understanding is that AddPlot will only plot to the primary panel.

      What I'm trying to do is add a simple ATR indicator (in its own panel on the chart page) to my strategy but to do that the ATR method requires the data series (since it's a different series than the primary data series). The only way I know how to do that is via AddDataSeries. Is there another way I can do this?

      Comment


        #4
        Hello Chippy

        You can add indicators using the strategy just not for ones that use a secondary series, in your use case you can't add that indicator visually.

        You can see the following link for an example of using a dummy indicator to plot in a secondary panel. The strategy would still need to add a series and set it from the BarsInProgress 0 for that to work.






        Comment


          #5
          Hi Jesse. I found that link just before I sent my last post and have been tinkering around with it but I just don't get it. Can you explain this:

          private SamplePanelPlot samplePanelPlot;

          It looks like "SamplePanelPlot" is a type?? That doesn't make sense.

          and then this looks like a method calling itself. Is this recursive?:

          samplePanelPlot = SamplePanelPlot();

          Comment


            #6
            Hello Chippy

            Code:
            private SamplePanelPlot samplePanelPlot;
            This is a variable definition, the variable name is samplePanelPlot and the type is SamplePanelPlot . SamplePanelPlot is an indicator that comes with that sample.

            Code:
            samplePanelPlot = SamplePanelPlot();
            This is the same as how you would call any other indicator, for example a similar code would be:
            Code:
            private SMA mySma;
            mySma = SMA(12);

            Comment


              #7
              Thanks... I would need to alter any indicators I want to use for that purpose, to include the strategy method. More trouble than it's worth. Thanks anyway.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by CarlTrading, 03-31-2026, 09:41 PM
              1 response
              45 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by CarlTrading, 04-01-2026, 02:41 AM
              0 responses
              21 views
              0 likes
              Last Post CarlTrading  
              Started by CaptainJack, 03-31-2026, 11:44 PM
              0 responses
              31 views
              1 like
              Last Post CaptainJack  
              Started by CarlTrading, 03-30-2026, 11:51 AM
              0 responses
              50 views
              0 likes
              Last Post CarlTrading  
              Started by CarlTrading, 03-30-2026, 11:48 AM
              0 responses
              42 views
              0 likes
              Last Post CarlTrading  
              Working...
              X