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

Using a custom indicator

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

    Using a custom indicator

    How do Iaccess a custom indicator in my strategy when I do not have the source code? I added the .dll to the strategy script using "references". When I refer to it as I would any indicator, I get this error:

    'NinjaTrader.Indicator.Name' is a 'type' but is used like a 'variable'

    I don't know what this means.

    Thanks.

    #2
    imported post

    Hi SuzyG,

    Please refer to the HelpGuide > NinjaScript > Distributing Custom NinjaScript Indicators > Distribution Step 5

    You should have a DLL and a Vendor file (two files) from the source of the custom DLL provider. If you do not, please contact the vendor.

    Ray


    RayNinjaTrader Customer Service

    Comment


      #3
      imported post

      I have a .cs file in bin\custom\indicator and a .dll in bin\custom. I still don't get how I can refer to the indicator.

      Comment


        #4
        imported post

        If you have the required files, within your strategy, you can type "this." and you will see all methods and properties of the strategy which should then include the custom indicator. You can then select the method and go from there. If you do not see this, please let me know.
        RayNinjaTrader Customer Service

        Comment


          #5
          imported post

          No, I see ones I have created, but notcustom indicatorsfroma vendor.

          Comment


            #6
            imported post

            Let's start from scratch.

            a) Do you want to reference a custom indicator you coded by yourself -> make sure you coded this indicator using NT6B5 or later, then you simply can reference liek Ray said by typing"this."

            b) Do you want to reference a custom indicator which was coded by a vendor -> the vendor tehn should have build this indicator with NT6B5 or later and should have provided you 2 files as per documentation Ray referenced below

            If none of above is correct, then likely indicator was not build using NT6B5 or later, in this case you can not reference the custom indicator.

            Comment


              #7
              imported post

              a) I can see the indicators I have coded. "This." shows them.

              b) Yes, this is my trouble. In this case, I do have the source code and one compiled .dll. I have opened the source code and re-compiled in the 6.0.0.6 version. I still do not see it with "this." nor can I reference it in my scripts.

              Since I have the source code, I should be able to do something with it. It seems like recompiling it should have worked. ??

              Thank you.

              Comment


                #8
                imported post

                When you say you have source file, do you mean the actual indicator file itself? If yes, make sure you remove any DLL that was provided to you. Restart NT. Save the indicator file in C:\Program Files\NinjaTrader 6\bin\Custom\Indicator, open it, compile it, then it will be available.

                Ray
                RayNinjaTrader Customer Service

                Comment


                  #9
                  imported post

                  Hi Ray,

                  I did what you suggested and do not have the vendor's .dll in bin\custom. I have the source .cs or maybe part of it. I am not sure. It contains calculations, etc. There is no NinjaScript generated code. Since the generated code is missing, what does this mean? I can use the indicator on my chart, but not see it when I type this. or access it from within a strategy or indicator.

                  Thank you,

                  SuzyG

                  Comment


                    #10
                    imported post

                    If you have the source, then just compile it and you will be able to use within other indicators or a strategy. If you don't have the source and only the DLL then you must request the Vendor file from the vendor.

                    Ray
                    RayNinjaTrader Customer Service

                    Comment


                      #11
                      imported post

                      Yes, I should have clarified that. I did compile it.

                      Irebuilt it so I could get the generated code and now it works. Thank you for your help.

                      Comment


                        #12
                        imported post

                        Hi,

                        I think my question is related to this topic. I have a custom indicatorwhose valueI want to use in a strategy. In the strategy Initialize method I've got:

                        Add(MyIndicator(
                        1, 4, false, 80));

                        Then in the OnBarUpdate I tried:

                        tradingPrice =
                        this.MyIndicator.Value;

                        to obtain the indicator value, so I didn't have to duplicate the indicator code in the strategy. But this gives a compile error saying:

                        "'NinjaTrader.Strategy.Strategy.MyIndicator(in t, double, bool, int)' is a method, which is not valid in the given context."

                        Is there a better way to obtain the included indicator value?

                        Thanks,

                        Darryl

                        Comment


                          #13
                          imported post

                          Try



                          tradingPrice = this.MyIndicator.Values[0];
                          RayNinjaTrader Customer Service

                          Comment


                            #14
                            imported post

                            My mistake:

                            tradingPrice = this.MyIndicator.Value[0];
                            RayNinjaTrader Customer Service

                            Comment


                              #15
                              imported post

                              Yes, I tried that also, gives the same compile error.

                              Thanks,

                              Darryl


                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by tkaboris, Today, 08:01 AM
                              1 response
                              7 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by Lumbeezl, 01-11-2022, 06:50 PM
                              31 responses
                              817 views
                              1 like
                              Last Post NinjaTrader_Adrian  
                              Started by xiinteractive, 04-09-2024, 08:08 AM
                              5 responses
                              15 views
                              0 likes
                              Last Post NinjaTrader_Erick  
                              Started by swestendorf, Today, 11:14 AM
                              2 responses
                              6 views
                              0 likes
                              Last Post NinjaTrader_Kimberly  
                              Started by Mupulen, Today, 11:26 AM
                              0 responses
                              7 views
                              0 likes
                              Last Post Mupulen
                              by Mupulen
                               
                              Working...
                              X