Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Combine UniRenko with normal time series

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

    Combine UniRenko with normal time series

    Hi,

    I have a strategy that uses the UniRenko. This works fine. However I want to add a second dataseries with normal 60 minute data. This second series is used for the overall direction of the market.

    When I add this second series to the UniRenko strategy:
    else if (State == State.Configure)
    {

    AddDataSeries(BarsPeriodType.Minute, 60);
    }

    and add a EMA
    else if (State == State.DataLoaded)
    {

    SMA30=SMA(Close,30);

    }

    and debug the data it looks like the data is not based on the 60 minute data for this instrument. Could it be that by adding the dataseries to a UniRenko type dataseries the minute data gets extracted from the UniRenko data instead of just the 60 minute tick data?

    Regards
    Stefan

    #2
    Hello Stefan,

    Thanks for your post.

    In your example of SMA30=SMA(Close,30); This is assigning the close price of the primary data series (the chart bars, unirenko)

    When you add a data series, to refer to added data series you would use the plurals of the price types and include the BarArray index number. The primary series (Chart bars) are automatically assigned to BarsArray[0] and you can refer to it via Close or Closes[0] and in the case of the plural [0] is not the current bar but is the barsarray index.

    So the correct assignment would be: SMA30=SMA(Closes[1],30); // Uses the close data from the Barsarray index of [1].

    Note that you can also directly use BarsArray in this case because the default price type is close, so this would also work: SMA30=SMA(BarsArray[1],30);

    As you are creating a multi time frame script it will be important for you to be aware of all the changes that this type of script dictates, please review the entire section here: https://ninjatrader.com/support/help...nstruments.htm

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    88 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    135 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    119 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    69 views
    0 likes
    Last Post PaulMohn  
    Working...
    X