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

Add EMA on bar chart

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

    Add EMA on bar chart

    Hey,

    I have created a bar chart which process a future chart and gives some results.When I try to add an EMA on this bar chart, I take the EMA of the future chart but I want the EMA of these bars.Any idea?? (check the code)

    Thanks
    Attached Files

    #2
    Hello Joleto,

    Thank you for writing in. Could you please clarify further what you mean when you say "these bars"? Are you referring to the Thermometer data series? A bar chart is a type of chart but a future chart is not a type of chart. Also could you please clarify if you are using multiple instrument/time-frames in your code?

    Thank you in advance.
    Michael M.NinjaTrader Quality Assurance

    Comment


      #3
      I have involved the diagrams to the picture.The problem is that when I try to add EMA on those bars I take the EMA of the future for some reason.
      Attached Files

      Comment


        #4
        Hello Joleto,

        You likely have placeholder values from the future data series factoring into your calculation because you are not setting every value of the data series. Please try something like the following and let me know if the issue persists:
        Code:
            Thermometer.Set(0); //This needs to occur first for every single OnBarUpdate() to clear out the DataSeries
            if((todayHigh-yesterdayHigh)>(todayLow-yesterdayLow))
            {
                Thermometer.Set(Math.Abs(todayHigh-yesterdayHigh));
                EMAThermometer.Set(EMA(Thermometer, 22)[0]);
            }
        Thank you in advance.
        Michael M.NinjaTrader Quality Assurance

        Comment


          #5
          Still the same...The price that I take is too large (check the picture)
          Attached Files

          Comment


            #6
            Hello Joleto,

            Thank you for your patience. Please send me the rest of your code so I may further investigate this issue. If you do not wish to share it on the forums, please send it an email to platformsupport[AT]ninjatrader[DOT]com and be sure to include "ATTN: Michael M #1367183" in the Subject line.

            Thank you in advance.
            Michael M.NinjaTrader Quality Assurance

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by ETFVoyageur, Today, 07:55 PM
            0 responses
            6 views
            0 likes
            Last Post ETFVoyageur  
            Started by janio973, Today, 07:24 PM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by aligator, 01-06-2022, 12:14 PM
            4 responses
            242 views
            0 likes
            Last Post john_44573  
            Started by reynoldsn, Today, 05:56 PM
            0 responses
            13 views
            0 likes
            Last Post reynoldsn  
            Started by bortz, 11-06-2023, 08:04 AM
            51 responses
            1,996 views
            0 likes
            Last Post aligator  
            Working...
            X