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 do I add 20 perior EMA of 5 min chart to a 14 tick Renko chart

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

    How do I add 20 perior EMA of 5 min chart to a 14 tick Renko chart

    I am using a 14 tick renko chart but want to add a 20 period EMA based on the 5 min chart. Is there a way to do this?

    #2
    Hello wtdtrader,
    Thanks for your post.

    Are you trying to plot the EMA or just make calculations based on it?
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      I plan to do both

      Comment


        #4
        All you need to do is add the series and then plot it. The value you pass in to the plot can be used for your other calculations as well. Something like the following snippet would accomplish this.

        Code:
        private EMA myEMA;
        protected override void OnStateChange()
        {
        	if (State == State.SetDefaults)
        	{		
        		AddPlot(Brushes.Yellow, "myEMA");
        	}
        	else if (State == State.Configure)
        	{	
        		AddDataSeries("ES 09-18",BarsPeriodType.Minute, 5);
        	}
        	else if(State==State.DataLoaded)
        	{
        		myEMA = EMA(BarsArray[1],20);
        	}
        }
        protected override void OnBarUpdate()
        {
        	if (BarsInProgress==1 && CurrentBars[1]<20)return;	
        	Value[0] = myEMA[0];
        }
        I am also including the relevant help guide documents for the above snippet.

        Help Guide - AddPlot()
        Help Guide- AddDataSeries()
        Help Guide - BarsArray
        Help Guide - Multi-Time Frame & Instruments

        Let me know if you have any questions.
        Josh G.NinjaTrader Customer Service

        Comment


          #5
          Sorry, I am using Ninja 7, could you provide the code for that and the reference articles.
          Thanks!

          Comment


            #6
            Sorry about that. This would be done differently with NT7. Check out the following reference sample that demonstrates a nice workaround on how to plot from a strategy in NT7.

            Help Guide - Plotting from within a NinjaScript strategy

            Help Guide - BarsArray

            Help Guide - Add()

            Help Guide - Multi Time Frame and Instruments

            EDIT: Mistake
            Last edited by NinjaTrader_JoshG; 04-25-2019, 12:58 PM.
            Josh G.NinjaTrader Customer Service

            Comment


              #7
              Can you please send me a snippet of code to accomplish this? Thank you!

              Comment


                #8
                The help guide article "Plotting with a NinjaScript Strategy" demonstrates this. Please download the sample script from that page.
                Josh G.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by The_Sec, Today, 02:29 PM
                1 response
                5 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by jeronymite, 04-12-2024, 04:26 PM
                2 responses
                30 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Started by Mindset, 05-06-2023, 09:03 PM
                10 responses
                265 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Started by michi08, 10-05-2018, 09:31 AM
                5 responses
                743 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by tsantospinto, 04-12-2024, 07:04 PM
                4 responses
                63 views
                0 likes
                Last Post aligator  
                Working...
                X