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

Question about slope...

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

    Question about slope...

    Any help for the lost,

    I am using the strategy builder. My eventual goal is to only enter trades in the direction on the 50 SMA. My issue is asking the strategy builder to determine the slope of the SMA. How is keyword SLOPE determined? Is it measured in degrees of angle?

    Currently I have Slope(SMA(Close, 50), 10, 0) <15

    It asks for:

    End bar 0 (current bar)
    Series 1 SMA(Close, 50) (Close of the current bar on a 50 period SMA?)
    Start bar 10 (10 bars back from current bar)

    Then Less than

    Numeric Value 10

    Currently I'm asking it to DRAW a down arrow to show this works correctly...and I get nothing.

    Thank you for any help you can offer.

    Texasguy

    #2
    Hello Texasguy,

    Thanks for your post.

    The helpguide on Slope() advises: Returns a measurement of the steepness of a price series (y value) measured by the change over time (x value). The return value can also be thought of as the ratio between the startBarsAgo and endBarsAgo parameters passed to the method.

    What I would suggest is to use the Print statement within the strategy builder to print the values of slope as they are determined to give you some idea of the values you are working with based on the parameters you are providing.

    The statement: Slope(SMA(Close, 50), 10, 0) will provide the 10 bar slope of a 50 period SMA based on the close price type.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      So the only way to determine slope in degrees is unlock the code and use a complicated like...

      (System.Math.Atan(Slope(SMA(5),CurrentBar-1,CurrentBar))*180/Math.PI).ToString()


      I copied this from another post I found. Not even sure what it all means...

      Texasguy.

      Comment


        #4
        Hello Texasguy,

        Thanks for your reply.

        Correct you would not be able to accomplish that in the strategy builder.
        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Kaledus, Today, 01:29 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by frankthearm, Yesterday, 09:08 AM
        13 responses
        45 views
        0 likes
        Last Post frankthearm  
        Started by PaulMohn, Today, 12:36 PM
        2 responses
        16 views
        0 likes
        Last Post PaulMohn  
        Started by Conceptzx, 10-11-2022, 06:38 AM
        2 responses
        55 views
        0 likes
        Last Post PhillT
        by PhillT
         
        Started by yertle, Yesterday, 08:38 AM
        8 responses
        37 views
        0 likes
        Last Post ryjoga
        by ryjoga
         
        Working...
        X