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 Stanfillirenfro, Today, 07:23 AM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by cmtjoancolmenero, Yesterday, 03:58 PM
      2 responses
      22 views
      0 likes
      Last Post cmtjoancolmenero  
      Started by olisav57, Yesterday, 07:39 PM
      1 response
      9 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by cocoescala, 10-12-2018, 11:02 PM
      7 responses
      944 views
      0 likes
      Last Post Jquiroz1975  
      Started by oviejo, Today, 12:28 AM
      1 response
      12 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Working...
      X