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

Has anyone used degree of angle at a crossover point?

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

    Has anyone used degree of angle at a crossover point?

    I am trying to figure out how to program the degree at which two sma's of differing periods crossover each other. Has anyone out there ever tried this? I have a theory that this could be significant in trading and if an alert could be added to something like this to signal if it was over a certain degree. Any help or suggestions would be greatly appreciated.

    #2
    Hello,

    Thank you for the question.

    I wanted to check, are you asking to get the degree of each SMA line at the time when they cross?

    If so, you may be able to utilize the Slope method to return a slope of the line, which you could then use math to convert to other things like degrees.

    http://ninjatrader.com/support/helpG...lightsub=slope

    In addition to the Slope, you would likely need CrossAbove or CrossBelow to determine when they cross:

    http://ninjatrader.com/support/helpG...sub=crossabove
    http://ninjatrader.com/support/helpG...sub=crossbelow


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Originally posted by jleguk View Post
      I am trying to figure out how to program the degree at which two sma's of differing periods crossover each other. Has anyone out there ever tried this? I have a theory that this could be significant in trading and if an alert could be added to something like this to signal if it was over a certain degree. Any help or suggestions would be greatly appreciated.
      The slope of an SMA is not dimensionless, so depends on the relative scales; a scale that often changes as the price action evolves, which means that it depends on the dimensions of the chart itself, mainly the width of the chart. An angle is a dimensionless quantity. Therefore, the apparent difference in angle that you seek is arithmetically meaningless in a visual sense.

      The pictures show you the exact same crossovers at different scales of the chart. They obviously look different, despite measuring exactly the same thing. True trigonometric angles do not change their look. Of course, you can always use the Slopes of the lines. Whereas they are not dimensionless, as far as relative values are concerned, they will not change.
      Attached Files

      Comment


        #4
        impossible measurement?

        So you are saying if one line is at a 20 degree downward slope and another line is at a 6 degree downward slope when the line crosses over that can't be truly measured? I have a theory that involves the angle to which SMA lines crossover how much of a price movement will be realized in the short term. But if the angle at which they cross is not a defined number then this theory is blown.

        Comment


          #5
          Originally posted by jleguk View Post
          So you are saying if one line is at a 20 degree downward slope and another line is at a 6 degree downward slope when the line crosses over that can't be truly measured? I have a theory that involves the angle to which SMA lines crossover how much of a price movement will be realized in the short term. But if the angle at which they cross is not a defined number then this theory is blown.
          It is, as are all theories based on an invalid premise.

          Comment


            #6
            Originally posted by koganam View Post
            The slope of an SMA is not dimensionless
            I've seen this argument before.

            I'm not sure I can agree on how this argument is usually framed. Sure, the visual angle as rendered by the charting software can change, but the calculated values of slopes and angles are consistent on the same chart instrument with the same bar series, regardless of how you stretch or scrunch the axes, and regardless of the pixel dimensions of the chart window.

            Slope is rise over run ... or "rise of price within bars of lookback period" divided by "number of bars in lookback period".

            Those values simply do not change when you squeeze or stretch your chart.

            The calculation, therefore, and the angle derived from it, is consistent and reliable, has dimensions, and is very much a usable quantity in trade setups.

            The issue is that those calculated slope & angle values (which are always consistent) do not always appear related to the visual depiction of the 'slope' or 'angle' the charting software is drawing on the chart. Why? Because the visual angle will depend on the pixel dimensions of the chart window, and whether you have scrunched or stretched one axis or the other.

            But, once you understand the difference between calculated and visual slope, and you accept this limitation completely, you can go back to using the reliable and consistent results of slope and angle calculations in any way you see fit.

            I mean, once you train your mind to break the relationship between the visual angle you see vs the calculated angle your script generates, you can trust the consistency of the calculated angles just fine. But you won't be able to (reliably) use any visual cues to trust the angle calculations -- and that's the *real* problem -- people want this trust relationship to include a visual component, but it simply does not. If you can accept that a slope or angle is just an abstract number, and is not visually guaranteed to be representative of the drawn value, then you're on the right path to using slopes and angles.

            <highrisk>
            However, if one were to use the same chart window pixel dimensions (such as full screen, etc) and use the same non-squeezed/non-scrunched axes, one can attempt to maintain some consistency to the visual angles, so that one can start to mentally form the relationship between the visual angle the charting software is showing and the calculated angle from their script. But making this visual vs calculated relationship consistent and repeatable is tricky, and subject to a lot of eyeball hours, and is not guaranteed to make sense to you, or other humans. (Eg, a calculated angle of 45 degrees may not necessarily look like 45 degrees when visually drawn on the chart) -- but however it looks, you want consistency in how the angle visually appears every time, so use same window dimensions, chart dimensions, bar series, etc. But, beware, this is a risky endeavor to make yourself an "expert" at the visual angle vs the calculated angle.
            </highrisk>
            Last edited by bltdavid; 04-06-2016, 10:14 AM.

            Comment


              #7
              Originally posted by bltdavid View Post
              I've seen this argument before.

              I'm not sure I can agree on how this argument is usually framed. Sure, the visual angle as rendered by the charting software can change, but the calculated values of slopes and angles are consistent on the same chart instrument with the same bar series, regardless of how you stretch or scrunch the axes, and regardless of the pixel dimensions of the chart window.

              Slope is rise over run ... or "rise of price within bars of lookback period" divided by "number of bars in lookback period".

              Those values simply do not change when you squeeze or stretch your chart.

              The calculation, therefore, and the angle derived from it, is consistent and reliable, has dimensions, and is very much a usable quantity in trade setups.

              The issue is that those calculated slope & angle values (which are always consistent) do not always appear related to the visual depiction of the 'slope' or 'angle' the charting software is drawing on the chart. Why? Because the visual angle will depend on the pixel dimensions of the chart window, and whether you have scrunched or stretched one axis or the other.

              But, once you understand the difference between calculated and visual slope, and you accept this limitation completely, you can go back to using the reliable and consistent results of slope and angle calculations in any way you see fit.

              I mean, once you train your mind to break the relationship between the visual angle you see vs the calculated angle your script generates, you can trust the consistency of the calculated angles just fine. But you won't be able to (reliably) use any visual cues to trust the angle calculations -- and that's the *real* problem -- people want this trust relationship to include a visual component, but it simply does not. If you can accept that a slope or angle is just an abstract number, and is not visually guaranteed to be representative of the drawn value, then you're on the right path to using slopes and angles.

              <highrisk>
              However, if one were to use the same chart window pixel dimensions (such as full screen, etc) and use the same non-squeezed/non-scrunched axes, one can attempt to maintain some consistency to the visual angles, so that one can start to mentally form the relationship between the visual angle the charting software is showing and the calculated angle from their script. But making this visual vs calculated relationship consistent and repeatable is tricky, and subject to a lot of eyeball hours, and is not guaranteed to make sense to you, or other humans. (Eg, a calculated angle of 45 degrees may not necessarily look like 45 degrees when visually drawn on the chart) -- but however it looks, you want consistency in how the angle visually appears every time, so use same window dimensions, chart dimensions, bar series, etc. But, beware, this is a risky endeavor to make yourself an "expert" at the visual angle vs the calculated angle.
              </highrisk>
              You have simply said more elaborately what I said: the divorce of the visual from the calculations.

              I do have a tendency to be overly terse when I write for people who I think can comprehend things quickly. A bad fault, no doubt, as your more elaborate exposition certainly does make the point much better than I did.

              Comment


                #8
                Originally posted by koganam View Post
                You have simply said more elaborately what I said: the divorce of the visual from the calculations.

                I do have a tendency to be overly terse when I write for people who I think can comprehend things quickly. A bad fault, no doubt, as your more elaborate exposition certainly does make the point much better than I did.
                Thanks. Your answer was certainly not wrong ... just terse (as you say), which led me to consider it somewhat incomplete.

                So I wanted to stress that despite the differences intrinsic to the visual vs calculated issue, if one understands those differences and accepts those limitations, there ain't a darn thing in the world wrong with using slopes or angles in the way the OP is asking.

                Most threads shoo away those who ask about using slopes and angles, and fail to dig into the discussion deep enough to explain the context of how to properly consider their use.

                Thus, I finally scratched an itch and wrote a little essay I can point back to ...

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by daniel_weber8, Today, 01:21 PM
                1 response
                5 views
                0 likes
                Last Post NinjaTrader_ChristopherS  
                Started by jungsoohuh, Today, 12:07 PM
                1 response
                19 views
                0 likes
                Last Post NinjaTrader_PaulH  
                Started by SharonSS, Today, 11:54 AM
                1 response
                14 views
                0 likes
                Last Post NinjaTrader_Jim  
                Started by crystalet, Today, 11:20 AM
                3 responses
                17 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by SuperDude123, Today, 09:23 AM
                1 response
                34 views
                0 likes
                Last Post NinjaTrader_JustinD  
                Working...
                X