Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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

    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by aussugardefender, Today, 01:07 AM
    0 responses
    1 view
    0 likes
    Last Post aussugardefender  
    Started by pvincent, 06-23-2022, 12:53 PM
    14 responses
    238 views
    0 likes
    Last Post Nyman
    by Nyman
     
    Started by TraderG23, 12-08-2023, 07:56 AM
    9 responses
    383 views
    1 like
    Last Post Gavini
    by Gavini
     
    Started by oviejo, Today, 12:28 AM
    0 responses
    1 view
    0 likes
    Last Post oviejo
    by oviejo
     
    Started by pechtri, 06-22-2023, 02:31 AM
    10 responses
    125 views
    0 likes
    Last Post Leeroy_Jenkins  
    Working...
    X