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

Slope delta

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

    Slope delta

    I'm attempting to calculate the change in slope from 1 bar ago to the current bar. I realize slope is already measuring the change but I want to measure the change of the slope. I receive an error doing it this way:
    Code:
    private double Slope0()
    		{
    			
    			return (Slope(Close, 1, 0)-Slope(Close, 2, 1));
    		}
    Any ideas how to get the Slope[0]-Slope[1] ?

    #2
    Hello Tdschulz,
    I can compile the code fine at my end.

    To assist you further can you please send a toy NinjaScript code* replicating the behavior to support[AT]ninjatrader[DOT]com

    Please append Attn:Joydeep in the subject line of the email and give a reference of this thread in the body of the email.

    I look forward to assisting you further.

    *The "toy" just means something that is a stripped down version that isn't necessarily the whole logic. It makes things easier to rout out.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      It compiles fine but logs an error as soon as I plot it on the chart.
      "Error on calling 'OnBarUpdate' method for indicator "MyCustomIndicato" on bar 0: You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo} with a value of 5 when there are only 4 bars on the chart."
      Do you get the same error?

      Comment


        #4
        Hello Tdschulz,
        I could print the values of the difference.

        Unfortunately I cannot say anything in concrete unless I can see a sample code which you are using in the OnBarUpdate event.

        For the specific errors please refer to this post which further discusses it
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          I have it figured out. thanks. I needed:
          if (CurrentBar < 1)
          return;

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by wzgy0920, 04-20-2024, 06:09 PM
          2 responses
          26 views
          0 likes
          Last Post wzgy0920  
          Started by wzgy0920, 02-22-2024, 01:11 AM
          5 responses
          32 views
          0 likes
          Last Post wzgy0920  
          Started by wzgy0920, Yesterday, 09:53 PM
          2 responses
          49 views
          0 likes
          Last Post wzgy0920  
          Started by Kensonprib, 04-28-2021, 10:11 AM
          5 responses
          192 views
          0 likes
          Last Post Hasadafa  
          Started by GussJ, 03-04-2020, 03:11 PM
          11 responses
          3,234 views
          0 likes
          Last Post xiinteractive  
          Working...
          X