Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

200 MA of 5 min chart on 1 minute chart

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

    200 MA of 5 min chart on 1 minute chart

    Anybody know how to get the 200 MA of 5 min chart on a 1 minute chart?

    And no you can't just put in a 1000ma on the 1 minute chart. It's different.

    #2
    Hello stockgoblin,

    Are you wanting to do this from the code or just on a chart using the system indicators?

    Please see the following video which demonstrates how to overlay an indicator which is calculated from one data series onto another:

    World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.
    MatthewNinjaTrader Product Management

    Comment


      #3
      Hey, that's great thanks. When I try it though my computer gets bogged down pretty bad. I think an indicator would be less intrusive on processing power. IS it possible as an indicator?

      Also, I'd like to upgrade my computer. What should I upgrade first so Ninjatrader runs more smoothly and doesn't lag as much from having too many rays drawn on my charts?

      Comment


        #4
        stockgoblin,

        Yes, this would be possible by using a custom indicator. You would need to use the Add() method to add the secondary data series to the chart and then tell the MA indicator to calculate from this data series.

        More information on working with Multi Series Indicators can be found below:



        The most important factor would be your CPU. I would also suggest reviewing our Performance Tips to ensure the best performance out of NinjaTrader:

        MatthewNinjaTrader Product Management

        Comment


          #5
          Okay, I put the Add(PeriodType.Minute, 5); into the SMA indicator code but I'm having problems figuring out where to put the BarsArray in the following so it references the 5 minute data.

          if (CurrentBar == 0)
          Value.Set(Input[0]);
          else
          {
          double last = Value[1] * Math.Min(CurrentBar, Period);

          if (CurrentBar >= Period)
          Value.Set((last + Input[0] - Input[Period]) / Math.Min(CurrentBar, Period));
          else
          Value.Set((last + Input[0]) / (Math.Min(CurrentBar, Period) + 1));
          }

          Any idea?

          Comment


            #6
            stockgoblin,

            Rather than duplicate the system SMA's logic, you can simply reference the SMA() function and add this as a plot.

            Code:
            protected override void Initialize()
                    {
               
                        Add(PeriodType.Minute, 1);
            
                        Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
                        Overlay                = true;
                    }
            
                      protected override void OnBarUpdate()
                    {
                    
                        // Ensures that the plot is drawn on the primary data series
                        if (BarsInProgress == 0)
                    
                        {
                            // Sets Plot0 to the SMA of the 5 minute data series
                            Plot0.Set(SMA([B]BarsArray[1][/B], Period)[0]);
                        }
            MatthewNinjaTrader Product Management

            Comment


              #7
              Hi, I'm just having trouble understanding.

              Sorry to question your code but...

              did you mean: Add(PeriodType.Minute, 5); instead of Add(PeriodType.Minute, 1); as I'm trying to put the SMA from the 5 minute data series onto the 1 minute chart

              and I'm getting: The name 'Plot0' does not exist in the current context

              for Plot0.Set(SMA(BarsArray[1], Period)[0]); - is this to be: Value.Set(SMA(BarsArray[1], Period)[0]); ???

              I'm new to coding so I'm trying to reference the SMA indicator included in Ninjatrader and alter it to plot from the 5 minute data series.

              Any help is appreciated. Thanks

              Comment


                #8
                Hi stockgoblin,

                Yes, Add(PeriodType.Minute, 5); will add a 5 minute series to the script.

                You will need to replace Plot0 with the name of your plot. Plot0 is the name of the first default plot added but you may have changed it in the indicator wizard.
                Ryan M.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                577 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                334 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                101 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                553 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                551 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X