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 helpwanted, Today, 03:06 AM
              0 responses
              3 views
              0 likes
              Last Post helpwanted  
              Started by Brevo, Today, 01:45 AM
              0 responses
              6 views
              0 likes
              Last Post Brevo
              by Brevo
               
              Started by aussugardefender, Today, 01:07 AM
              0 responses
              5 views
              0 likes
              Last Post aussugardefender  
              Started by pvincent, 06-23-2022, 12:53 PM
              14 responses
              242 views
              0 likes
              Last Post Nyman
              by Nyman
               
              Started by TraderG23, 12-08-2023, 07:56 AM
              9 responses
              384 views
              1 like
              Last Post Gavini
              by Gavini
               
              Working...
              X