• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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 Zuhier Dourgham, Today, 03:55 AM
      0 responses
      1 view
      0 likes
      Last Post Zuhier Dourgham  
      Started by JorgeDamien, Today, 03:47 AM
      0 responses
      1 view
      0 likes
      Last Post JorgeDamien  
      Started by jefferyfrench, Today, 03:45 AM
      0 responses
      1 view
      0 likes
      Last Post jefferyfrench  
      Started by alberts, Yesterday, 09:50 AM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_Marco  
      Started by VincentMicah, Today, 12:46 AM
      0 responses
      3 views
      0 likes
      Last Post VincentMicah  
      Working...
      X