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

MACD based on SMA values

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

    MACD based on SMA values

    The MACD indicator that comes with NinjaTrader is based on EMA values. Does anyone have the same indicator but based on SMA values?

    Thanks, Steven

    #2
    I don't have one personally, but it would be really easy to modify your current MACD to use SMA instead of EMA...just go through and replace instances of 'EMA' with 'SMA'.

    Comment


      #3
      Hello,

      Attached is a MACD using a SMA rather than the default EMA.
      Attached Files
      MatthewNinjaTrader Product Management

      Comment


        #4
        Thanks for the file...Works great.

        Steven

        Comment


          #5
          Matthew,

          I am after a MACD with TEMA. I tried to change your SMA version without any luck. With you being kind enough to change the EMA to SMA for everyone, I was hoping you would do the same for the TEMA version. I know this is above and beyond your normal scope but it would be greatly appreciate. Thank you.


          Bob

          Comment


            #6
            Hello Ram011558,

            Thanks for your post and welcome to the forums.

            To change the version created for SMA in post 3, once you have downloaded and installed the MACDSMA, you would need to follow these short steps to make the changes you want:

            1) Tools>Edit Ninjascript> Indicators

            2) Select MACDSMA

            3) In the code of MACSMA, right mouse click, select "save as" and provide a new name, like MACDTEMA

            4) In the new file of MACDTEMA, go to like 64 and replace SMA with TEMA. Go to line 65 and replace SMA with TEMA. Your lines 64 and 65 should now look like:

            fastSma.Set(TEMA(Input, Fast)[0]);
            slowSma.Set(TEMA(Input, Slow)[0]);


            5) Right mouse click on the chart and select compile.

            6) Once complied, close the file and apply the new indicator to your chart(s)
            Paul H.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Matthew View Post
              Hello,

              Attached is a MACD using a SMA rather than the default EMA.
              This indicator does not work in NinjaTrader 8.

              It says: ''This NinjaScript archive was made from an older, imcompatible version of NinjaTrader.''.

              Could you look into this matter, please?
              Attached Files

              Comment


                #8
                Hello California,

                Thanks for your post and welcome to the NinjaTrader forums!

                You are correct, this is a NinjaTrader7 indicator posted in the NinjaTrader7 indicator development forum. NinjaTrader7 scripts are not compatible with NinjaTrader8. Please do not try to import NinjaTrader7 (or earlier) scripts into NinjaTrader8.

                For your convenience and as this was quick, I have converted this to NT8, please note that we do not routinely provide this service.
                Attached Files
                Paul H.NinjaTrader Customer Service

                Comment


                  #9
                  This is what I've been looking for.... almost. I want to use EMA for fast and SMA for slow but not sure how to make that change in the code. Do I simply just change FastSMA to FastEMA everywhere its present?

                  Comment


                    #10
                    Hello jcsetf,

                    Welcome to the NinjaTrader forums!

                    Below is a link to a support article with helpful resources on getting started with NinjaScript and C#.


                    On line 75, call the EMA indicator instead of the SMA indicator.
                    FastSMA[0] = EMA(Input, Fast)[0];
                    Chelsea B.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by jclose, Today, 09:37 PM
                    0 responses
                    4 views
                    0 likes
                    Last Post jclose
                    by jclose
                     
                    Started by WeyldFalcon, 08-07-2020, 06:13 AM
                    10 responses
                    1,413 views
                    0 likes
                    Last Post Traderontheroad  
                    Started by firefoxforum12, Today, 08:53 PM
                    0 responses
                    10 views
                    0 likes
                    Last Post firefoxforum12  
                    Started by stafe, Today, 08:34 PM
                    0 responses
                    10 views
                    0 likes
                    Last Post stafe
                    by stafe
                     
                    Started by sastrades, 01-31-2024, 10:19 PM
                    11 responses
                    169 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Working...
                    X