Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Band Around a Moving Average

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

    Band Around a Moving Average

    I am trying to find an indicator that will create a band a certain number of pips above and below a moving average. For example: create a 89sma moving average and have an option to add a 20 pip band above or below.

    Any help would be greatly appreciated.

    #2
    forrest,

    You would need to make a custom indicator for this and then create two plots for the bands. When you set the value to the plots you can just take "SMA(89)[0] + 20 * TickSize" or "SMA(89)[0] - 20 * TickSize" to bump up/down the bands.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      question

      I have never programmed anything. What are other options?

      Comment


        #4
        Unfortunately this would have to be done through programming a custom indicator. You could try one of these 3rd party NinjaScript Consultants here: http://www.ninjatrader.com/webnew/pa...injaScript.htm
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          forrest:

          go into the wizard: tools>newninjascript>new indicator

          give it a name
          check the overlay box

          next

          write
          Period
          where MyInput was

          next

          change
          Plot0 to Avg
          and name the next 2 plots Upr and Lwr

          (feel free to play with the colors)

          next
          (you're not adding lines so)
          next

          finish

          a new window with code will open up

          find the line:
          Avg.Set(Close[0]);
          Upr.Set(Close[0]);
          Lwr.Set(Close[0]);

          change it to:

          Avg.Set(SMA(period)[0]);
          Upr.Set(SMA(period)[0]+20 * TickSize);
          Lwr.Set(SMA(period)[0]-20 * TickSize);

          click the compile button(or F5)
          and you're set

          also in the variables screen in the wizard you can add an Offset variable and replace the 20 with the variable in the code.

          enjoy

          Comment


            #6
            Mike

            Mike,

            Thanks man. I appreciate the detailed response. Thank you so much, this is a life saver for me. I'll give it shot tomorrow.

            Forrest

            Comment


              #7
              Mike

              Mike,

              Worked perfectly Mike. Thank you for your help!

              Forrest

              Comment


                #8
                Thanks

                This is helpful thank you.

                Comment


                  #9
                  Originally posted by forrest View Post
                  Mike,

                  Worked perfectly Mike. Thank you for your help!

                  Forrest
                  Hello Forrest. I currently have the broker version of Ninja Trader which does not allow me to build custom indicators. Would you mind uploading this indicator to the "Indicator Sharing" forum? Thanks for your consideration.

                  Regards
                  Chuck

                  Comment


                    #10
                    Maxreturn

                    Let's see if this works. I will try to attach here.
                    Attached Files

                    Comment


                      #11
                      Originally posted by forrest View Post
                      Let's see if this works. I will try to attach here.
                      Thanks Forrest but when I try to download the file has a ".cs" extension and only allows me to download as a Metaquotes 4 file. Is there a way for you to export it from within Ninja Trader as a "zip" file? Thanks for your consideration.

                      Regards
                      Chuck

                      Comment


                        #12
                        maxreturn

                        I will be glad to try. But I am not sure how to send a zip. If you know how I can send without deleting my copy please let me know. The reply above which goes through the steps to set-up this indicator takes no time at all.

                        Forrest

                        Comment


                          #13
                          forrest,

                          You should export the script with these steps and just in a new post add the zip as an attachment.

                          Josh P.NinjaTrader Customer Service

                          Comment


                            #14
                            Originally posted by forrest View Post
                            I will be glad to try. But I am not sure how to send a zip. If you know how I can send without deleting my copy please let me know. The reply above which goes through the steps to set-up this indicator takes no time at all.

                            Forrest
                            I'm sure that's true Forrest but I have the broker's version of the software which does not allow me to create custom indicators.

                            Regards
                            Chuck

                            Comment


                              #15
                              maxreturn

                              Here you go. Thanks for the instructions. Apologize for taking so long..had to watch my two year old. Let me know if this does not work.

                              Forrest
                              Attached Files

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              576 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