Announcement

Collapse
No announcement yet.

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 sjsj2732, Yesterday, 04:31 AM
                0 responses
                27 views
                0 likes
                Last Post sjsj2732  
                Started by NullPointStrategies, 03-13-2026, 05:17 AM
                0 responses
                283 views
                0 likes
                Last Post NullPointStrategies  
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                280 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                131 views
                1 like
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                90 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Working...
                X