Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AddChartIndicator

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

    AddChartIndicator

    Hello, I’m trying to figure out AddChartIndicator. I start with an “empty” strategy, and just adds the two lines as described in the help guides:
    }
    else if (State == State.Configure)
    {
    AddChartIndicator(SMA(20));
    }
    }

    protected override void OnBarUpdate()
    {
    double sma = SMA(20)[0];
    }
    When I then select my strategy from the chart menu, nothing happens! I had expect to see a SMA plot at my chart, but nothing.

    What am I missing here?

    #2
    Hello AndBro,

    Thanks for your post.

    The code:
    else if (State == State.Configure)
    {
    AddChartIndicator(SMA(20));
    }

    Will add the SMA(20) as an indicator on the chart. The code in the OnBarUpdate() would not be related.


    When you apply and enable the strategy are you seeing any error messages in the "log" tab of the NinjaTrader control center that relate to the strategy? If you are seeing the error of trying to access a bars ago that may be related to the code you show in the OnbarUpdate().
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thank you Paul, “enable” was the solution  (it was not set!).
      Now it is working as I was expecting.
      /AndBro

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by maybeimnotrader, Today, 05:46 PM
      0 responses
      5 views
      0 likes
      Last Post maybeimnotrader  
      Started by quantismo, Today, 05:13 PM
      0 responses
      6 views
      0 likes
      Last Post quantismo  
      Started by AttiM, 02-14-2024, 05:20 PM
      8 responses
      166 views
      0 likes
      Last Post jeronymite  
      Started by cre8able, Today, 04:22 PM
      0 responses
      8 views
      0 likes
      Last Post cre8able  
      Started by RichStudent, Today, 04:21 PM
      0 responses
      5 views
      0 likes
      Last Post RichStudent  
      Working...
      X