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

Rising or falling slope

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

    Rising or falling slope

    Does anyone know how to create a condition for a rising or falling slope? Also is there a way to include the degrees?

    #2
    Hello Brucelevy,

    Thank you for your note.

    You can check the Rising and Falling of the slope by using -
    Code:
    // Rising
    if(Slope(Close, 0, 1) > Slope(Close, 1, 2)) 
    
    // Falling
    if(Slope(Close, 0, 1) < Slope(Close, 1, 2))
    Additionally, to get the degrees you would need to use trigonometric functions under the Math class from C# to calculate this out.
    https://msdn.microsoft.com/en-us/lib...vs.110%29.aspx

    Let me know if I can be of further assistance.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Before you start calculating angles please have a look at these threads:

      this thread is probably dead but maybe someone needs the answer still. First, why should you be interested in slope... Well, it's an immediate response to change and allows for a visual view if using lines, boxes, rectangles... etc to see what's happening. It is easier to view a program and your logic visually... I am using int names as example to help reason the code int starting_bar = 4... Bars back int ending_bar = 0... Now int smaperiod = 4 double Degree =Math.Round(System.Math.Atan(Slope(SMA(smaperiod),startingbar, &#8230;

      "Slope" does not exist on scalable charts. The concept "Slope" refers to print outs and was used 50 years ago when charts were printed and neither the time scale nor the price scale were ever changed. Ticks are not suited to normalize momentum or slope But ticks or tick size are not at all suited, because the ticks do not reflect volatility. Forget the ticks, you cannot use them for normalization. And best forget the concept of slope, angles and remember that they were just used to visualize &#8230;


      Charts can be horizontally and vertically compressed. Angles and values for the slope were used prior to the advent of the PC and should not be used anymore. Slope is just a proxy for momentum. Instead of calculating slope you should take the momentum or the rate of change. Best normalize momentum by dividing it through the average range or the standard deviation calculated over the momentum period.

      For more information please read the article "The C-Test" by William Eckhardt published by "Stocks & Commodities", which can be downloaded from the archive of www.traders.com. Here is an excerpt:

      "RIGHT ANGLE INCLINATIONS:
      The fallacy concerning the sizes of angles in a bar chart or price graph arises from ignoring price/time heterogeneity. As an example, consider the claim that a major downtrend and the subsequent uptrend tend to be at right angles to each other. In Figure 1, the first chart conforms to the right-angle rule; in Figure 2, the uptrend falls short of the right-angle projection; in Figure 3, the uptrend exceeds the projection. The problem: These are all charts of the same price series (December 1989 gold, July 17, 1989, to December 1, 1989), but only the vertical price scale is different. This technique is likely to give the user varying results depending on the chart service he or she uses.
      "

      I have attached the charts from this text below.
      Attached Files
      Last edited by Harry; 02-14-2015, 06:07 PM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by LawrenHom, Today, 10:45 PM
      0 responses
      3 views
      0 likes
      Last Post LawrenHom  
      Started by love2code2trade, Yesterday, 01:45 PM
      4 responses
      28 views
      0 likes
      Last Post love2code2trade  
      Started by funk10101, Today, 09:43 PM
      0 responses
      7 views
      0 likes
      Last Post funk10101  
      Started by pkefal, 04-11-2024, 07:39 AM
      11 responses
      37 views
      0 likes
      Last Post jeronymite  
      Started by bill2023, Yesterday, 08:51 AM
      8 responses
      44 views
      0 likes
      Last Post bill2023  
      Working...
      X