Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to get "smoothed" values of higher series indicator within lower timeframe?

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

    How to get "smoothed" values of higher series indicator within lower timeframe?

    Take a look at the screenshot below.

    I have a 2 minute chart with an added 15 minute data series.

    Then, I added an EMA indicator to the chart, on the 15 minute data series and told it to calculate on every tick. This is the WHITE plot line.

    As you can see, it is a smooth plot.

    I am trying to access these "smooth" values from my 2 minute series and the plot looks like a staircase.

    Now, I get it... you're going to tell me that it looks like that because on the 2m series it is still "waiting" for the 15m bar to close, so the values are "constant" then gap up or down when the higher dataframe bars close. However, my indicator is set to calculate on every tick and I'd like that for ALL dataseries added, so I can access the values are they come.

    Well, if I can see the perfectly smooth white line, how do I access those EXACT values on my 2 minute timeframe?

    This is a sample code I have:

    ...
    else if (State == State.Configure)
    {
    AddDataSeries(Data.BarsPeriodType.Minute, 5);
    AddDataSeries(Data.BarsPeriodType.Minute, 10);
    AddDataSeries(Data.BarsPeriodType.Minute, 15);
    AddDataSeries(Data.BarsPeriodType.Minute, 20);
    }​
    ....
    protected override void OnBarUpdate()
    {

    if (CurrentBar < 200) {
    return ;
    }

    if (BarsInProgress == 0) {
    Values[1][0] = EMA(Closes[3], 8)[0];
    }
    ​}

    Thank you KINDLY.

    Click image for larger version

Name:	NT8_ema.png
Views:	187
Size:	13.2 KB
ID:	1274560

    #2
    Hello focus333,

    Thank you for your post.

    The stair step is caused by the bars on the primary between secondary bars getting the same value as the previous bar (which is a flat line). In order to "fix" the stair steeping, you will need to estimate where the line would be on the in-between bars.

    For example, if the primary has 5 bars for each secondary bar, you could set the in-between bars as the previous primary bar value plus 1/5 the distance between the difference of the previous secondary bar and current secondary bar.

    Please note you wouldn't want to use these values in calculations though, as they are not real data.

    An alternate route would be to add the secondary series to the chart directly in the Data Series window, and then add the indicator using that series as the input series.

    If you have any other questions, please let me know.

    Comment


      #3
      Hi there NinjaTrader_Gaby. Thanks for the reply.

      Clearly Ninjatrader has these values available, I don't see the point in me trying to "estimate" them.


      Secondly, I would argue that if it is using CalculateOnTick and using tick data, this is a REAL datapoint that is being used to plot the slope between the previously closed bar and the current tick. Sure, it is changing per tick, but it's not a guess.


      As we can see from the smooth white plot, NT is already doing this job. In fact, the white line is coming from adding a 2ndary data series to the chart panel and adding the EMA do it. I just need to access them.


      How do I access those white values in NinjaScript. You said "An alternate route would be to add the secondary series to the chart directly in the Data Series window, and then add the indicator using that series as the input series." - Using this approach, how can my code pick the white plot values it up as an input?

      Here's a quick video showing the white line changing in real time and the price label showing the numbers based on the tick value:




      Thank you kindly!
      Last edited by focus333; 10-25-2023, 11:06 AM.

      Comment


        #4
        Hello,

        You can still access those values from your strategy when calling the indicator. When you call the indicator in your strategy, you will be accessing those values.

        For display purposes only, you can separately manually add it to its own series and view it without the stair step. The instance used by the strategy would be separate from the one being displayed, but if the data settings are the same the values produced will be the same.

        Please let us know if you have any other questions.
        Last edited by NinjaTrader_Gaby; 10-25-2023, 12:23 PM.

        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