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