Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

New kind of Colored moving average coding

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

    New kind of Colored moving average coding

    Hi. All colored moving averages repaint because they are based on slope formula. I had an idea to remedy that.
    1. Instead of being based on slope, the moving average color can be based on whether it was higher than the previous bar. For example, green if higher than previous bar, and red if lower than previous bar.
    2. It would be nice to have all known moving averages that the indicator supports such as wma, hulls, etc.

    I'm no coder, so experienced ninjas, please help out with the code. I posted a screenshot of an HMA color change indicator which is slope based and repaints. I guess thats how i would like whatever we create.

    Thanks.
    Attached Files

    #2
    Hello Draco,

    You can use the built in functions Rising() and Falling() to check if a current value is higher than its previous value.

    If you're using version 7, the multicolor plot approach has changed. See here for details.

    See here if you'd like help with allowing different moving average selections.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Moving average

      I don't understand what you mean when you say that all ma's colored based on slope will repaint? That depends on how the slope is calculated. However, I took the free "Public enum" and added colors to it.
      It will only work in NT7
      Attached Files

      Comment


        #4
        Originally posted by finnbjurvoll View Post
        I don't understand what you mean when you say that all ma's colored based on slope will repaint? That depends on how the slope is calculated. However, I took the free "Public enum" and added colors to it.
        It will only work in NT7
        In the past , multi color line plots in NT would paint over the correct color at the point where the different segments were joined together. For that reason I would always use dots instead of lines for multi color plots.

        I downloaded your indicator and I get an error when compiling.

        Indicator\Multi_MA.cs The type or namespace name 'UniversalMovingAverage' could not be found (are you missing a using directive or an assembly reference?) CS0246 - click for info 206 50

        Do I need to find and download UniversalMovingAverage.cs?

        Comment


          #5
          I changed your code

          publicenum UniversalMovingAverage6
          {
          EMA,
          HMA,
          SMA,
          WMA,

          }

          to this

          publicenum UniversalMovingAverage
          {
          EMA,
          HMA,
          SMA,
          WMA,

          }

          then it compiled without errors.

          Comment


            #6
            ThatManFromTexas, Thanks for the correction. Finn Jurbol

            Comment


              #7
              how can i get this download? thanks
              tonism

              Comment


                #8
                Hi Tonism,

                finnbjurvoll shared a file to download in post 3.
                Ryan M.NinjaTrader Customer Service

                Comment


                  #9
                  thank you - this didn't have a zip file - is there one?

                  Comment


                    #10
                    is there a zip file for this indicator? thanks

                    Comment


                      #11
                      Hello tonism,

                      You'll have to ask orginal author for a zip file. This code is not suppported or maintained by NinjaTrader.

                      .cs indicator files are stored in My Documents\NinjaTrader\bin\custom\indicator
                      Ryan M.NinjaTrader Customer Service

                      Comment


                        #12
                        thank you. it says member finnbjurvoll said there was a download but it doesn't work. any suggestions?
                        tonism

                        Comment


                          #13
                          You can copy the .cs file into your indicators folder manually. The from the Control Center click Tools/Edit NinjaScript/Indicator and select the indicator. When the editor opens, make the change specified by ThatManFromTexas. Compile the code and close. All done.

                          Dan
                          eDanny
                          NinjaTrader Ecosystem Vendor - Integrity Traders

                          Comment


                            #14
                            Thanks!

                            Thanks finnbjurvoll, ThatManFromTexas, eDanny.

                            Indicator (with correction) works great. Thanks for sharing.

                            -AT

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by timmbbo, Today, 08:59 AM
                            1 response
                            2 views
                            0 likes
                            Last Post NinjaTrader_ChelseaB  
                            Started by KennyK, 05-29-2017, 02:02 AM
                            2 responses
                            1,281 views
                            0 likes
                            Last Post marcus2300  
                            Started by fernandobr, Today, 09:11 AM
                            0 responses
                            3 views
                            0 likes
                            Last Post fernandobr  
                            Started by itrader46, Today, 09:04 AM
                            1 response
                            6 views
                            0 likes
                            Last Post NinjaTrader_Clayton  
                            Started by bmartz, 03-12-2024, 06:12 AM
                            5 responses
                            33 views
                            0 likes
                            Last Post NinjaTrader_Zachary  
                            Working...
                            X