Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Referencing a Renko Chart in a Multi-Time Frame Strategy

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

    Referencing a Renko Chart in a Multi-Time Frame Strategy

    I’m currently working on a strategy where I use a 50 Renko chart as a filter within another time frame strategy. One of the filters I’m trying to implement is checking if EMA 20 > EMA 50 on the 50 Renko chart as a condition for buy signals.

    Here’s the approach I’ve taken using AddDataSeries():
    • In the OnStateChange() method, under (State == State.Configure), I added:

      AddDataSeries(Instrument.FullName, new BarsPeriod { BarsPeriodType = BarsPeriodType.Renko, Value = 50 });
    • To initialize the EMA indicators for the 50 Renko chart, I added this under (State == State.DataLoaded) of OnStateChange():

      ema20_50Renko = EMA(BarsArray[1].Close, 20);
      ema50_50Renko = EMA(BarsArray[1].Close, 50);
    ​However, I encountered the following error message:

    'Bars' does not contain a definition for 'Closes' and no accessible extension method 'Closes' accepting a first argument of type 'Bars' could be found (are you missing a using directive or an assembly reference?)

    I believe the issue lies in how I’m referencing the data from the Renko chart, but I’m not sure how to proceed.

    Could anyone guide me on how to properly reference the Renko chart and retrieve the correct data to make this filter work?

    Thanks in advance for your help!
    ​​

    #2
    Hello faccipieri,

    Was this strategy created with the NinjaScript Editor?

    May I confirm you have not removed any default using statements?

    May I have a screenshot of the NinjaScript Editor showing the error and the code line specified in the error?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by faccipieri View Post
      ema20_50Renko = EMA(BarsArray[1].Close, 20);
      ema50_50Renko = EMA(BarsArray[1].Close, 50);
      Try this,
      ema20_50Renko = EMA(BarsArray[1], 20);
      ema50_50Renko = EMA(BarsArray[1], 50);​


      See file,
      bin/Custom/Strategies/@SampleMultiTimeFrame.cs

      Comment


        #4
        Btw, if you're dealing specifically with AddDataSeries and Renko bars,
        why are you not using the AddRenko method instead?

        Comment


          #5
          Originally posted by bltdavid View Post

          Try this,
          ema20_50Renko = EMA(BarsArray[1], 20);
          ema50_50Renko = EMA(BarsArray[1], 50);​


          See file,
          bin/Custom/Strategies/@SampleMultiTimeFrame.cs

          It worked! Thanks

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Mindset, 04-21-2026, 06:46 AM
          0 responses
          86 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by M4ndoo, 04-20-2026, 05:21 PM
          0 responses
          125 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by M4ndoo, 04-19-2026, 05:54 PM
          0 responses
          64 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by cmoran13, 04-16-2026, 01:02 PM
          0 responses
          117 views
          0 likes
          Last Post cmoran13  
          Started by PaulMohn, 04-10-2026, 11:11 AM
          0 responses
          67 views
          0 likes
          Last Post PaulMohn  
          Working...
          X