Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

EMA value

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

    EMA value

    Hi, I need to get the value of the EMA indicator as it moves along the ChartScale (I think this is what it's called). For example i would need the 2702.46 value as shown in the LastEma pic and the 2631 value shown in the PrevEma pic (attached) while scrolling. I'm new to Ninja and have been really impressed with your documentation, but just couldn't figure this one out. Thanks, Ed
    Attached Files

    #2
    Hello AxiomProducts,

    Thanks for your post and welcome to the NinjaTrader forums!

    From a Ninjascript perspective, you can obtain the value of the EMA at any bar by using the Bars Ago index. Bars ago would be relative to the "Current bar" which is the currently forming bar (if using Calculate.OnEachTick or Calculate.OnPrice Change) or would be the latest closed bar if using Calculate.OnBarClose. For example, if using an EMA(10), the value of the current bar would be EMA(10)[0]. The value of the EMA(10) 20 bars ago would be EMA(10)[20], 30 bars ago would be EMA(10)[30], etc. etc.

    Comment


      #3
      Thanks Paul. Since i need to be clear i have a couple questions, In the LastEma pic the last bar is formed with its value shown in the chartscale colored yellow (2702.46).Scrolling back from there in the PrevEma pic the last bar shown is green (2751.50). How would i find the bars ago for the green 2751.50 reading? i would think the yellow 2702.46 bar would be (using ema(10)) ema(10)[0] so what would be the the green 2751 bar --- ema(10)[?] ?

      Comment


        #4
        correction the PrevEma value is 2631 colored grey.

        Comment


          #5
          So, what i am trying to do is get the values of the white lines here as i scroll to the left.
          Attached Files

          Comment


            #6
            Hello AxiomProducts,

            Thanks for your reply.

            I am not sure I understand what you are trying to do here. Can you give me a larger overview? Since you posted in the indicator development area, are you trying to develop an indicator, if so can you elaborate as I um unsure how the chart gets scrolled via an indicator (or likely I am not understanding)?

            Comment


              #7
              What I'm trying to do is add a label to the EMA much like what is shown for NT7 here: https://ninjatraderecosystem.com/use.../ema-enhanced/
              It seems this is not available for NT8. I have everything in place in OnRender, but i cannot move the label correctly to match the EMA value as I scroll to get the yVal needed to move the label.

              Comment


                #8
                Hello,

                Thanks for your reply and clarification.

                I downloaded the NT7 example and all that it is doing is drawing a label to the right of the EMA, it does not follow the EMA when scrolled back. If this is all you want then you don't need OnRender then you can just use Draw.Text() and specify a negative bars ago value to put the label to the right of the plot and use the current bar value of the EMA for the Y location of the text..

                You might take a look at the OnRender() code used in the Pivots indicator as it is an example of code that adds the labels (as well as the plot but you don't need that part). It cycles through all the plots but you can simplify for your single plot.

                The ChartBars.ToIndex is the bar located on the far right of the chart. Reference: https://ninjatrader.com/support/help...rs_toindex.htm

                Comment


                  #9
                  Thanks Paul, i took a look at Pivots & ChartBars,ToIndex and can see why you referenced them from my weak explanation. But what i am trying to do should be better explained by the attached, This is screen shot of a proprietary trading application that sure looks like it was created on the Ninja platform. i only want the column of EMA values (the degrees i should get with your Slope() method). Can you point me to references that can guide me in development? Thanks again!
                  Attached Files

                  Comment


                    #10
                    Hello AxiomProducts,

                    Thanks for your reply.

                    Here is a link to the NT8 help guide for Onrender(): https://ninjatrader.com/support/help.../?onrender.htm If you use the example in the help guide it will provide labels to your plots (and draws a line but you can remove that).

                    Comment


                      #11
                      Thank you.

                      Comment


                        #12
                        The example code you recommended in NT8 help guide for Onrender() is exactly what i needed to put some pieces together, so thanks again. If i may ask (hopefully) one more question on this project, in the attached example pic of the proprietary system, that screen has a column that holds that EMA values and that column is not overwritten by the chart values. Example 1and 2 shows what happens if i don't have that column. Can you tell me how i can add that column to the chart control?
                        Attached Files

                        Comment


                          #13
                          Hello AxiomProducts,

                          Thanks for your reply.

                          Glad the help guide example is what you needed.

                          What the screenshot on the right has done is set the chart properties right side margin to a larger value to create the "dead space" (my term) that can be used for the labels. Typically it will be set to 8 pixels so you may want to try 80 to 100. Right mouse click on the chart and select "properties" and in the properties window it will be the "Right side margin". You can set it programmatically but keep in mind it can be a conflict if a user wants to set it manually. Here is a help guide link to that: https://ninjatrader.com/support/help...properties.htm

                          Comment


                            #14
                            Perfect...

                            Comment


                              #15
                              Hello AxiomProducts,

                              I'm looking exactly for the same look. Were you able to get this in NT8?
                              In case you did, may I ask you to share with me the Code or Indicator?
                              Many Thanks !

                              Stefan

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              581 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              338 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              103 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              554 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              552 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X