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

NinjaTrader 8 - How To Copy Indicator

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

    NinjaTrader 8 - How To Copy Indicator

    Hello,

    I'm trying to create a new indicator based on the existing NinjaTrader 8 "Pivots" indicator. I'm not a great programmer, however I think I know enough to make the changes I'm looking for.

    I've made a copy of the Pivots code by doing a "select all" and "save as" from within the NinjaScript Editor, then created my custom name. Once the new indicator was made, I tried to compile it then received these errors (See attachment)

    I did a search on Google and the NinjaTrader forums, however I wasn't able to find anything that worked (or made sense to me). Any advice on this?


    Thank you.
    Attached Files

    #2
    Hello TzunTzai,

    Thanks for your post.

    Please note we are asking all NinjaTrader8 posts to be placed in the NinjaTrader8 beta forums. This helps the community keep NT7 and NT8 items separate when searching.

    It sounds like you have created a copy using the process you did, there is a slightly easier way:

    To create a copy of an indicator:
    1) open the indicator in the Ninjascript editor
    2) In the code of the Ninjascript file, right mouse click and select "save as"
    3) Enter new indicator/file name. > new file created.

    The error messages you posted are related to the the two public enums and the "TypeConverter".

    The enums have already been created by the original pivots indicator and they already exist in the indicators namespace. The easiest way to deal with them is to comment them out from your indicator (lines 453 - 468).

    For the type converter, it would be easiest to rename it. In line 33 change:
    from :[TypeConverter("NinjaTrader.NinjaScript.Indicators. PivotsTypeConverter")]

    To: [TypeConverter("NinjaTrader.NinjaScript.Indicators. PivotsType1Converter")]

    Also, in line 427:
    from: public class PivotsTypeConverter :NinjaTrader.NinjaScript.IndicatorBaseConverter

    To: public class PivotsType1Converter : NinjaTrader.NinjaScript.IndicatorBaseConverter

    (Note: if you have already changed the indicator, the line number above may not match so just refer then to the original Pivots indicator to verify/ find the specific lines of code needed to change in your indicator)
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      This helped. Thank you.

      Comment


        #4
        Hi,

        I have just been trying to do the same as Tzun Tzai and have come across the same error messages. Likewise my programming skills are just above non-existent, but I'm a quick learner. I was wondering how to "comment them out {the enums} from your indicator (lines 453 - 468)". If I could have an example on how to do this, that would be a tremendous help.

        Thanks.

        Comment


          #5
          Hello ADarr,

          Thanks for your post and welcome to the NinjaTrader forums!

          If you are going to work in Ninjascript then you will want to become familiar with C# programming language as that is what Ninjascript is based on and the C# syntax governs everything.

          In C#, when you use // the compiler will not execute anything on that line after the //, so in C# the // is one way to comment what is going on in the code, for example:

          double test = High[0] - Low[0]; // this is an example of a comment that would explain what "test" is

          You would also see entire lines of comments that may be used to explain certain sections, for example:

          //Disable this property if your indicator requires custom values that cumulate with each new market data event.
          //See Help Guide for additional information.


          In the case of my earlier replies in this thread, I used the terminology of "comment out" to mean place the // in front of lines that you don't want to execute, in effect making them the same as a comment. For example:

          //double test = High[0] - Low[0]; would not be executed by the compiler and ignored as if it were a comment.
          Paul H.NinjaTrader Customer Service

          Comment


            #6
            Hello NinjaTrader_Paul,

            Thank you for your quick reply. My error messages are in line 477 and line 485 of the Pivots indicator. These being enum HLCCalculationMode and enum PivotRange. How do I go about commenting them out - aren't they required for the calculation of the Pivots?

            Thanks.

            Comment


              #7
              Hello ADarr,

              Thanks for your reply.

              Point of clarification, this thread is located in the NinjaTrader7 forums and the thread starter was actually asking about NinjaTrader8 which I was responding to as NinjaTrader8. Please advise if you are working with NinjaTrader7 or NinjaTrader8, just to make sure we are on the same indicator code.
              Paul H.NinjaTrader Customer Service

              Comment


                #8
                Hi,

                I'm working on NinjaTrader 8. All I'm wanting to do is adjust the calculations for the support and resistance lines.

                Thanks.

                Comment


                  #9
                  Hello ADarr,

                  Thanks for your reply.

                  We'll be moving this thread into NT8 indicator development so any future posts will be correctly referenced.

                  In looking at the pivots indicator and my instruction in 2016 (when NinjaTrader8 was in beta testing), there have been some changes to the pivots indicator since then that make these changes invalid. I will review and see what can be figured out.

                  As you are not familiar with Ninjascript/C# it may be in your best interest to hire a 3rd party programmer to provide what you need, if this is of interest please let us know and we can provide you a reference link for that.
                  Paul H.NinjaTrader Customer Service

                  Comment


                    #10
                    Hello again,

                    A link to a programmer would be much appreciated.

                    Thank you.

                    Comment


                      #11
                      Hello ADarr,

                      Thank you for your post.

                      You can search our extensive library of NinjaScript consultants through the link below. Simply enter a consultant name or search by using our filter categories. Once you have identified your consultants of choice, please visit each consultant's site for more information or contact them directly to learn more:
                      You can locate the contact information for the consultants on their direct websites for any additional questions you may have. Since these consultants are third-party services for NinjaTrader, all pricing and support information will need to be obtained through the consultant.

                      This NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The companies and services listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem, LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Radano, 06-10-2021, 01:40 AM
                      20 responses
                      616 views
                      0 likes
                      Last Post NinjaTrader_BrandonH  
                      Started by Mizzouman1, Today, 07:35 AM
                      0 responses
                      6 views
                      0 likes
                      Last Post Mizzouman1  
                      Started by i019945nj, 12-14-2023, 06:41 AM
                      6 responses
                      67 views
                      0 likes
                      Last Post i019945nj  
                      Started by aa731, Today, 02:54 AM
                      1 response
                      8 views
                      0 likes
                      Last Post NinjaTrader_BrandonH  
                      Started by BarzTrading, Today, 07:25 AM
                      0 responses
                      3 views
                      0 likes
                      Last Post BarzTrading  
                      Working...
                      X