Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Getting the EMA from two different time frames?

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

    Getting the EMA from two different time frames?

    How to I get the EMA (or other indicator value) from two different time frames?

    Say I'm running my strategy, in a 10 minute chart. I'd like to get the EMA(20) value from the 10 minute, 5 minute, and 1 minute charts. How to do? Thanks

    #2
    Hello timmbbo,

    Thank you for your note.

    To calculate the values of an indicator for a time series which is not the primary series, you would have to add additional data series, for example,

    Code:
    AddDataSeries(BarsPeriodType.Minute, 5);
    AddDataSeries(BarsPeriodType.Minute, 10);
    See AddDataSeries section of our helpguide,


    Then you should add current bar checks to make sure each series has enough bars, for example,

    Code:
    if(CurrentBars[0] <20 || CurrentBars[1]<20  || CurrentBars[2]<20) return;
    See more about current bar checks at "Make sure you have enough bars in the data series you are accessing" reference example,


    Then you can set the value of the indicator to a plot or a variable or use in your conditions.

    I have attached a sample strategy which adds 2 additional data series and sets plot values equal to the simple moving average of the primary, secondary, and third data series.

    Please let us know if you need further assistance.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by timmbbo View Post
      How to I get the EMA (or other indicator value) from two different time frames?

      Say I'm running my strategy, in a 10 minute chart. I'd like to get the EMA(20) value from the 10 minute, 5 minute, and 1 minute charts. How to do? Thanks
      Here's a strategy that simply adds a secondary series and prints the SMA(20) from the two different series on each tick. This is what helped me wrap my head around it. Link

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CaptainJack, 05-29-2026, 05:09 AM
      0 responses
      262 views
      0 likes
      Last Post CaptainJack  
      Started by CaptainJack, 05-29-2026, 12:02 AM
      0 responses
      168 views
      0 likes
      Last Post CaptainJack  
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      170 views
      1 like
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      257 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      209 views
      0 likes
      Last Post CarlTrading  
      Working...
      X