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

How To Calculate The Angle Of A HMA Line ?

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

    How To Calculate The Angle Of A HMA Line ?

    Hello All

    i want to calculate the angle of the HMA
    Can I Use The Slop Method ?

    The slope is a measure of the steepness of a line.
    This method returns a double value indicating the slope of a line

    double hmaAngel = Slop(HMA(117),3,0);

    i want to build codition for my indicator ,
    the idea is When a small angle to paint a particular system weakened and know momentum .

    Thanks For Helping

    #2
    Keep in mind that it will change depending on the window dimensions.

    Comment


      #3
      Welcome to our forums, yes you could use the slope on the HMA, however this would just be the steepness of the line determined by a rise over run calculation - depending on your needs you might need to add custom code to convert to an angle (arcus tangens of slope).
      BertrandNinjaTrader Customer Service

      Comment


        #4
        How Can I Draw The Slop Above Any Bar ?

        the Slop() Method return A Double Value
        ** Slope(IDataSeries series, int startBarsAgo, int endBarsAgo)

        How Can I Draw This Value Above each bar ?

        double slopValue = Slop(HMA,1,0)[0] ; // it return the current Slop of the HMA

        now how can i draw this value above each bar ?

        this code will work ?
        DrawText( "current Slop",slopValue.ToString(),CurrentBar,High[0]+1,Color.Black);

        Comment


          #5
          Hello Refaer_Cohen,

          Yes, that looks code. One change you can make is to add + CurrentBar to your tag to make unique and draw for each bar.

          DrawText( "current Slop" + CurrentBar, slopValue.ToString(),CurrentBar,High[0]+1,Color.Black);
          Ryan M.NinjaTrader Customer Service

          Comment


            #6
            Thanks But Only The DrawTextFixed Method Work For Me

            Thanks RyanM

            my Code Is :
            double slopValue = Slope(HMA(117),2,0);
            //This Code Doesnt Work ??
            DrawText("Slop Value"+CurrentBar ,
            slopValue.ToString(),
            CurrentBar ,
            High[0]+1,
            Color.Red );

            //This Code Work But Show Only The Last sloapValue(current)
            DrawTextFixed(
            "current Slop",
            slopValue.ToString(),
            TextPosition.BottomRight );

            may be i need to create a DataSeries to store the data ?

            Comment


              #7
              Correct, if you would like to have access to historical value of the slope you would need to store the double values in a data series - http://www.ninjatrader.com/support/h...ries_class.htm
              BertrandNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Mestor, 03-10-2023, 01:50 AM
              16 responses
              388 views
              0 likes
              Last Post z.franck  
              Started by rtwave, 04-12-2024, 09:30 AM
              4 responses
              31 views
              0 likes
              Last Post rtwave
              by rtwave
               
              Started by yertle, Yesterday, 08:38 AM
              7 responses
              29 views
              0 likes
              Last Post yertle
              by yertle
               
              Started by bmartz, 03-12-2024, 06:12 AM
              2 responses
              22 views
              0 likes
              Last Post bmartz
              by bmartz
               
              Started by funk10101, Today, 12:02 AM
              0 responses
              7 views
              0 likes
              Last Post funk10101  
              Working...
              X