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 rocketman7, Today, 01:00 AM
      0 responses
      1 view
      0 likes
      Last Post rocketman7  
      Started by wzgy0920, 04-20-2024, 06:09 PM
      2 responses
      27 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, 04-23-2024, 09:53 PM
      2 responses
      74 views
      0 likes
      Last Post wzgy0920  
      Started by Kensonprib, 04-28-2021, 10:11 AM
      5 responses
      193 views
      0 likes
      Last Post Hasadafa  
      Working...
      X