Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Slope method returns value greater than 1

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

    Slope method returns value greater than 1

    Hi there,

    In the documentation for the Slope method on this page:
    http://ninjatrader.com/support/helpG...-us/?slope.htm

    It says:
    Method Return Value
    This method returns a double value between 1 and -1 indicating the slope of a line.


    However when debugging a strategy and I have printed the slope value using the following code:

    Code:
    Print(String.Format("GannHiLow: {0}   Middle Bollinger: {1}   Slope Fast: {2}   Slope Slow: {3}   Bar Index: {4}", _gannHiLoActivator.HiLo[1], _bollinger.Middle[1], Slope(_smaFast, 5, 0), Slope(_smaSlow, 20, 0), CurrentBar));
    It produces the following output:
    GannHiLow: 10754.15
    Middle Bollinger: 10758.7142857143
    Slope Fast: 2.24285714285725
    Slope Slow: 1.13142857142857
    Bar Index: 198

    So you can see that the doco says the value retuend is between 1 and -1, yet I am getting values of 2.24285714285725 and 1.13142857142857, both of which are greater than 1.

    So which is correct, the output of the Slope method or the documentation?

    Regards,

    Scott

    #2
    Originally posted by codeowl View Post
    Hi there,

    In the documentation for the Slope method on this page:
    http://ninjatrader.com/support/helpG...-us/?slope.htm

    It says:
    Method Return Value
    This method returns a double value between 1 and -1 indicating the slope of a line.


    However when debugging a strategy and I have printed the slope value using the following code:

    Code:
    Print(String.Format("GannHiLow: {0}   Middle Bollinger: {1}   Slope Fast: {2}   Slope Slow: {3}   Bar Index: {4}", _gannHiLoActivator.HiLo[1], _bollinger.Middle[1], Slope(_smaFast, 5, 0), Slope(_smaSlow, 20, 0), CurrentBar));
    It produces the following output:
    GannHiLow: 10754.15
    Middle Bollinger: 10758.7142857143
    Slope Fast: 2.24285714285725
    Slope Slow: 1.13142857142857
    Bar Index: 198

    So you can see that the doco says the value retuend is between 1 and -1, yet I am getting values of 2.24285714285725 and 1.13142857142857, both of which are greater than 1.

    So which is correct, the output of the Slope method or the documentation?

    Regards,

    Scott
    If they are really using the formula that is in the documentation, then the documentation is incorrect, as that expression can clearly return an absolute value greater than 1. The definition that they are using is, more or less, standard for calculating a slope, and a slope is, most definitely, not confined to a value between 1 and -1.

    Comment


      #3
      koganam, thanks for the response mate. That makes sense ;-)

      Regards,

      Scott

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by naanku, Today, 07:25 PM
      0 responses
      5 views
      0 likes
      Last Post naanku
      by naanku
       
      Started by milfocs, Today, 07:23 PM
      0 responses
      3 views
      0 likes
      Last Post milfocs
      by milfocs
       
      Started by PaulMohn, Today, 06:59 PM
      0 responses
      7 views
      0 likes
      Last Post PaulMohn  
      Started by bortz, 11-06-2023, 08:04 AM
      48 responses
      1,752 views
      0 likes
      Last Post carnitron  
      Started by Jonker, 04-27-2024, 01:19 PM
      3 responses
      24 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Working...
      X