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 NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    58 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    133 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    73 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    50 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X