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

Trying to add RSI as a divergence indicator to PAS

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

    Trying to add RSI as a divergence indicator to PAS

    Hi everyone.

    I've been trying to learn coding in Ninjascript and suffering silently for quite a while now. Honestly, I usually have simply given up by this time and resolve to use things that already work.

    I do keep seeing the same errors over and over in my coding though and will now endeavor to defeat this one most common for me.

    In this case, I am editing PriceActionSwing Indicator by Dorschen, trying to add other indicators (RSI in this case) to display divergence. It seems a simple enough process, having used the included MACD and Stochastics as a reference. I had a few naming errors and have worked those out but am left with two instances of:

    'NinjaTrader.NinjaScript.Indicators.PriceActionSwi ng.DivergenceMode' does not contain a definition for 'Rsi'

    I am in your hands if anyone dares to help me resolve a constant thorn in my coding and set me on a higher path.




    #2
    I checked PAS code, DivergenceMode is enum and it actually doesn't have RSI. Just look for "public enum DivergenceMode" and add RSI at the end.

    Comment


      #3
      Hi Leeroy, thanks for your effort and response. I know it doesn't have RSI, it doesn't have a lot of things but apparently, it's supposed to be easy to add them as a source. I added RSI in exactly the same way and places that MACD and Stochastics are already in place, but I still can't compile because of that definition error.
      Did you try adding it?

      Comment


        #4
        Did you add RSI in DivergenceMode enum? This enum resided in PriceActionSwing file, not in PriceActionSwingPro you're trying to modify. This causes that error.

        Comment


          #5
          Hello notenufftime,

          Thanks for your notes.

          Leeroy_Jenkins has provided some great information on this topic that you could look into.

          If DivergenceMode is an enum as Leeroy_Jenkins noted, you would have to add the RSI to the DivergenceMode enum so that it is available to access from the enum.

          Something you could consider is reaching out to the developer of the indicator directly to ask for information on how to go about adding more indicators to the third-party script.

          Brandon H.NinjaTrader Customer Service

          Comment


            #6
            Originally posted by Leeroy_Jenkins View Post
            Did you add RSI in DivergenceMode enum? This enum resided in PriceActionSwing file, not in PriceActionSwingPro you're trying to modify. This causes that error.
            Ok I did mention that I am new to coding so I'll beg your patience from the onset. I am editing PriceActionSwingPro from Ninja Editor. Where do I find PriceActionSwing file and with what do I edit it?

            Comment


              #7
              Originally posted by NinjaTrader_BrandonH View Post
              Hello notenufftime,

              Thanks for your notes.

              Leeroy_Jenkins has provided some great information on this topic that you could look into.

              If DivergenceMode is an enum as Leeroy_Jenkins noted, you would have to add the RSI to the DivergenceMode enum so that it is available to access from the enum.

              Something you could consider is reaching out to the developer of the indicator directly to ask for information on how to go about adding more indicators to the third-party script.
              Hi Brandon and thank you for your input.

              I did reach out to the originator long ago but he's very quiet. This indicator is more than 10 years old now but has a fabulous base for things I want to try.

              Where and what is the DivergenceMode enum and how should I edit it? Not within PriceActionSwingBase or PriceActionSwingPro, I've searched.

              Comment


                #8
                Oh wait...I've found someting... 'public enum DivergenceMode { Off, MACD, Stochastics, }' in PriceActionSwingBase. I'll do some editing, thank you

                Comment


                  #9
                  Well there you go, works like a charm now.

                  It makes me wonder:
                  Is it typical to have a reference call to another file?
                  Why not simply have it within the file you are working with?

                  I've no doubt I'll be back for more tutelage, RSI wasn't really what I wanted to add but it seemed most basic. At least I have some ammo now.

                  Thank you Leeroy and Brandon

                  Comment


                    #10
                    Hello notenufftime,

                    Thanks for your notes.

                    Depending on the logic of a script and how the programmer wants it to function, it could be common to have a reference call to another file.

                    For example, if you have a script that has public methods that are used by multiple scripts, those public methods would be placed in a separate file for individual scripts to access.
                    Brandon H.NinjaTrader Customer Service

                    Comment


                      #11
                      Understood and I'll bear that in mind. It's like learning an entirely new language.

                      Comment


                        #12
                        ​I would recommend you install Visual Studio because editing in the NT Editor is kinda cumbersome. In Visual Studio, you can simply right click on "DivergenceMode" and select "go to definition" to quickly navigate to where this enum is defined. It's much easier to deal with all these dependencies ​​ Not to mention all other stuff that VS has but not NT Editor.

                        Comment


                          #13
                          I appreciate the advice, I have VS installed and have toyed with it on occasion. I've stuck with NT editor because its native, so I assumed fewer problems. I'm a rank amateur with great aspirations though so I will try VS and see how it goes for me. Thank you Leeroy.

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Haiasi, 04-25-2024, 06:53 PM
                          2 responses
                          17 views
                          0 likes
                          Last Post Massinisa  
                          Started by Creamers, Today, 05:32 AM
                          0 responses
                          5 views
                          0 likes
                          Last Post Creamers  
                          Started by Segwin, 05-07-2018, 02:15 PM
                          12 responses
                          1,786 views
                          0 likes
                          Last Post Leafcutter  
                          Started by poplagelu, Today, 05:00 AM
                          0 responses
                          3 views
                          0 likes
                          Last Post poplagelu  
                          Started by fx.practic, 10-15-2013, 12:53 AM
                          5 responses
                          5,408 views
                          0 likes
                          Last Post Bidder
                          by Bidder
                           
                          Working...
                          X