Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Moving Average of an Indicator

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

    Moving Average of an Indicator

    Hi,

    Is there a way to plot a moving average of an indicator? Not Moving Average of price. For instance MACD. I would like to add a SMA of the MACD in the same pane. I know how to overlay, but I'm looking for an indicator that will plot this.

    Thanks.
    J

    #2
    Hi Joshua 1:8,

    Thank you for your post.

    With NinjaTrader 7, you can nest indicators, first selecting SMA, then using the MACD as the input series.

    More info at - http://www.ninjatrader.com/webnew/NT7/NinjaTrader7.html
    Under the "New Indicators on Indicators" section
    TimNinjaTrader Customer Service

    Comment


      #3
      That's what thats for!! (input series) LOL!

      Thank you very much! Just what i was looking for!

      J

      Comment


        #4
        Hello, I am trying the following simple condition:

        if (Range()[0] * VOL()[0] < SMA(Range() * VOL(), ma1)[0])

        where ma1 is a lookback period, integer variable.

        However I get an error message:
        "Operator '*' cannot be applied to operands of type 'NinjaTrader.Indicator.Range' and 'NinjaTrader.Indicator.VOL'"

        Could you clarify how to solve this?
        I'd like the product of range and volume to be lower that its moving average.

        Thanks for your help!

        Comment


          #5
          Hello Zordon,

          The issue here is the expected input for your SMA indicator. It needs to be a data series.
          See here for a tutorial on DataSeries.

          DataSeries are:
          1) Declared in Variables region
          private DataSeries rangeTimesVol;

          2) Instantiated in Initialize() method:
          rangeTimesVol = new DataSeries (this);

          3) Set in OnBarUpdate()
          rangeTimesVol.Set(Range()[0] * VOL()[0]);

          You can then use this as input for SMA:
          if (Range()[0] * VOL()[0] < SMA(rangeTimesVol, ma1)[0])
          Ryan M.NinjaTrader Customer Service

          Comment


            #6
            Thanks a lot.

            When I put point 2 under section: protected override void Initialize()
            rangeTimesVol = new DataSeries (this);

            I get a bunch of errors:

            Type expected
            Class member declaration expected.
            ) expected.
            Invalid token '=' in class, struct, or interface member declaration
            Method must have a return type
            Type expected

            Could you help?




            Originally posted by NinjaTrader_RyanM View Post
            Hello Zordon,

            The issue here is the expected input for your SMA indicator. It needs to be a data series.
            See here for a tutorial on DataSeries.

            DataSeries are:
            1) Declared in Variables region
            private DataSeries rangeTimesVol;

            2) Instantiated in Initialize() method:
            rangeTimesVol = new DataSeries (this);

            3) Set in OnBarUpdate()
            rangeTimesVol.Set(Range()[0] * VOL()[0]);

            You can then use this as input for SMA:
            if (Range()[0] * VOL()[0] < SMA(rangeTimesVol, ma1)[0])

            Comment


              #7
              Here's how it should look:

              Code:
               
              protected override void Initialize()
              {
              CalculateOnBarClose = true;
              rangeTimesVol = new DataSeries (this);
              }
              You may have other items in Initialize, but make sure the statement is within the curly brackets { } of Initialize()
              Ryan M.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              109 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              59 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              37 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              40 views
              0 likes
              Last Post TheRealMorford  
              Started by Mindset, 02-28-2026, 06:16 AM
              0 responses
              78 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Working...
              X