Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Coding Question

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

    Coding Question

    I cant get this to compile. It looks right to me and those are the correct settings on the indicator.

    && TrendStrengthA(Close,EMA,100,5,5)[0]> 60)

    I also tried this:

    && TrendStrengthA(Close,EMA,100,5,5).TrendStrength[0]< 50)
    I get this error message for both:
    The best overloaded method match for 'NinjaTrader.Indicator.Indicator.TrendStrengthA(Ni njaTrader.Data.IDataSeries, VC.NinjaScript.Utility.MovingAverageType, int, int, int)' has some invalid arguments CS1502

    Argument '2': cannot convert from 'method group' to 'VC.NinjaScript.Utility.MovingAverageType' CS1503

    Thanks for your help

    #2
    Try substituting EMA with

    Code:
    NinjaTrader.Indicator.MAV.MAType.EMA
    mrlogik
    NinjaTrader Ecosystem Vendor - Purelogik Trading

    Comment


      #3
      That didnt work either, but thanks for the imput.
      Much appreciated, mrlogik.

      Comment


        #4
        Hi dwalls,

        Can you please post your code for the TrendStrengthA, then I can take a look...Thanks!

        Comment


          #5
          Thanks NinjaTrader_Bertrand.
          Attached is the code for the TrendStrenghtA indicator, I just downloaded it from the Indicators section of this forum.
          Here is a sample of what I am trying to code:

          if (CurrentBar < 5)
          return;
          if (CrossAbove(EMA(Close,5), EMA(Close,20), 1)
          && TrendStrengthA (Close,EMA,100,5,5)[1]> 60)

          But the second line wont compile.

          Thanks
          Attached Files

          Comment


            #6
            Try this and let me know (I don't have NT w/ me now to test)

            Code:
            TrendStrengthA(Close, MovingAverageType.EMA, 100, 5, 5).TrendStrength[0]
            mrlogik
            NinjaTrader Ecosystem Vendor - Purelogik Trading

            Comment


              #7
              Thanks mrlogik.
              I did try that and I get this error message:

              The name 'MovingAverageType' does not exist in the current context CS0103.

              Thanks

              Comment


                #8
                At the top of your file where you see the "using" lines, add this

                Code:
                using VC.NinjaScript.Utility;
                Sorry, its hard to try things out without NT on this computer.
                mrlogik
                NinjaTrader Ecosystem Vendor - Purelogik Trading

                Comment


                  #9
                  That worked. Thanks mrlogik.
                  Not bad for no NT.

                  What does that "using VC.NinjaScript.Utility;" do?

                  Thanks for your help.

                  Comment


                    #10
                    Its a namespace that defines different enums for use within the TrendStrengthA indicator.

                    The MovingAverageType type is defined from within this namespace.

                    Anywhere you want to use the TrendStrengthA indicator, you will need to add that include at the top of the file.
                    mrlogik
                    NinjaTrader Ecosystem Vendor - Purelogik Trading

                    Comment


                      #11
                      Thank you for your posts and help to our users mrlogik!

                      Comment


                        #12
                        :-)

                        My pleasure.
                        mrlogik
                        NinjaTrader Ecosystem Vendor - Purelogik Trading

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                        0 responses
                        580 views
                        0 likes
                        Last Post Geovanny Suaza  
                        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                        0 responses
                        335 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by Mindset, 02-09-2026, 11:44 AM
                        0 responses
                        102 views
                        0 likes
                        Last Post Mindset
                        by Mindset
                         
                        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                        0 responses
                        554 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by RFrosty, 01-28-2026, 06:49 PM
                        0 responses
                        552 views
                        1 like
                        Last Post RFrosty
                        by RFrosty
                         
                        Working...
                        X