Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Adding Indicator to Chart

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

    Adding Indicator to Chart

    Ok. I usually add indicators to my strategy without a problem, however I have this indicator that I have placed Plot into the code for reference in my strategy. If I place the indicator on my chart it plots the information. However when I add the indicator to the strategy, It plots nothing. Can you tell me what I may be missing.There are no errors shown.

    In the indicator information is populated using onmarketdata.


    private NinjaTrader.NinjaScript.Indicators.ddma.deltax RealtimeIndicator1;

    protected override void OnStateChange()
    {
    .......
    else if (State == State.Configure)
    {
    AddDataSeries(Data.BarsPeriodType.Tick, 1);
    }
    else if (State == State.DataLoaded)
    {

    RealtimeIndicator1 = deltax(Close, true, false, true, false);
    AddChartIndicator(RealtimeIndicator1);
    }

    #2
    Hello richa61416,

    Thank you for your post.

    This looks like the correct syntax. Is this a 3rd party indicator you got from elsewhere, or is this an indicator you created yourself? Do any errors appear in the log panel of the Control Center?

    Thanks in advance; I look forward to assisting you further.

    Comment


      #3
      It is a 3rd party indicator made available for elite members, for which they provide the source code hence I can make any changes I want. I added the plots to the indicator, and they displayed fine, it is only the addchartindicator within strategies that fails to allow it to run. Any clues as to what may stop it from running on strategy?

      Comment


        #4
        Hello richa61416,

        Thank you for your reply.

        This sounds like it may be a state issue.



        If you are adding an indicator which is dependent on the correct State of the indicator, you will need to ensure that you are also calling the indicator from the strategy in OnBarUpdate(), otherwise your indicator will only process in State.RealTime for performance optimizations.

        Essentially if you dont call the indciator in OBU and only AddChartIndicator you can see it "not work" until later in realtime.

        So you could try something like this:

        protected override void OnBarUpdate()
        {
        // call deltax() historically to ensure the indicator processes its historical states as well
        double deltax1 = deltax(Close, true, false, true, false)[0];
        }

        Please let us know if we may be of further assistance to you.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        88 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        134 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        119 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        67 views
        0 likes
        Last Post PaulMohn  
        Working...
        X