Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Slope for different BarsInProgres

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

    Slope for different BarsInProgres

    I'm trying to retrieve the slope for different BarsInProgres

    I used the code:

    if (BarsInProgress == 3)
    {
    Print("Slope " + Slope(SMA(10),5,0));
    }

    but here I get the slope for BIP == 0

    I tried to set the slope as Slope(SMA(10)[3],5,0)

    but I get an error when compiling.

    what is the solution?

    #2
    guillembm, please try pushing in the needed BarsArray (or Highs, Lows, Closes) for the SMA to calculate on, so the Slope calculation would use this value.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      you mean this?

      Slope(SMA(BarsArray[3],10)[3],5,0)

      Comment


        #4
        Yes, but why do you request the SMA value 3 bars ago?
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Sorry. This should be the good one?

          Slope(SMA(BarsArray[3],10),5,0)

          Comment


            #6
            Yes, that looks good.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Slope for BarsArray Indicator

              There appears to be something wrong with this condition. If I compare the slope of an EMA in a higher time frame to a numeric value higher than 0, no entries execute. If I leave at 0 and back test on a year long data set, over 1,000 entries execute. The dataseries being referenced is 610T CL. Plenty of high single or maybe even double digit slope of the 55 EMA.

              && Slope(EMA(BarsArray[1], 55), 3, 0) > 2

              I also tried this method, but got the same results:

              double myArray155Slope = Slope(EMA(BarsArray[1],55), 3, 0);

              if (myArray155Slope > 2

              I'm sure it's something simple. But I'm not having much luck figure out what I'm doing wrong.

              Thanks for any help.
              Attached Files

              Comment


                #8
                Originally posted by kconradbell View Post
                There appears to be something wrong with this condition. If I compare the slope of an EMA in a higher time frame to a numeric value higher than 0, no entries execute. If I leave at 0 and back test on a year long data set, over 1,000 entries execute. The dataseries being referenced is 610T CL. Plenty of high single or maybe even double digit slope of the 55 EMA.

                && Slope(EMA(BarsArray[1], 55), 3, 0) > 2

                I also tried this method, but got the same results:

                double myArray155Slope = Slope(EMA(BarsArray[1],55), 3, 0);

                if (myArray155Slope > 2

                I'm sure it's something simple. But I'm not having much luck figure out what I'm doing wrong.

                Thanks for any help.
                Not sure if this "Slope" indicator is a standard NT indicators, but I don't see it in my indicator list :O

                Your description tells that the slope value is somewhere between 0 and 2. I don't know how the slope indicator calculate the slope value, but I suspect the slope value is a very small double, e.g. 0.002. Please check it.

                Thanks.
                Pi
                ninZa
                NinjaTrader Ecosystem Vendor - ninZa.co

                Comment


                  #9
                  Hello kconradbell,

                  Thank you for your post and welcome to the NinjaTrader Support Forum!

                  The Slope produces a value between 0 and 1. So value such as 0.5. Please take a look at the information on Slope at the following link: http://www.ninjatrader.com/support/h.../nt7/slope.htm

                  Please let me know if I may be of further assistance.

                  Comment


                    #10
                    Ah ha. It's a function, not an indicator. How careless I am when looking at the code.
                    ninZa
                    NinjaTrader Ecosystem Vendor - ninZa.co

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by kempotrader, Today, 08:56 AM
                    0 responses
                    6 views
                    0 likes
                    Last Post kempotrader  
                    Started by kempotrader, Today, 08:54 AM
                    0 responses
                    4 views
                    0 likes
                    Last Post kempotrader  
                    Started by mmenigma, Today, 08:54 AM
                    0 responses
                    2 views
                    0 likes
                    Last Post mmenigma  
                    Started by halgo_boulder, Today, 08:44 AM
                    0 responses
                    1 view
                    0 likes
                    Last Post halgo_boulder  
                    Started by drewski1980, Today, 08:24 AM
                    0 responses
                    3 views
                    0 likes
                    Last Post drewski1980  
                    Working...
                    X