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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    80 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    41 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    64 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    66 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    54 views
    0 likes
    Last Post CarlTrading  
    Working...
    X