Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to place a multi-time frame indicator on a chart ?

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

    How to place a multi-time frame indicator on a chart ?

    How could place a 4 hours MACD on a 30 minutes chart ?

    on the Initialize() method, BarsArray() is forbidden. So, I can not write the code like:

    Code:
    protected override void Initialize()
            {
    			Add(PeriodType.Minute, 5); 
    			Add(PeriodType.Minute, 30);
    			Add(PeriodType.Minute, 240);
    			Add(MACD(BarsArray[2],9,26,3) );
    			
    			
                CalculateOnBarClose = true;
            }
    Then, how could I place the 240 minutes MACD on the 30 mins chart in the strategy ?

    And by the way, which one is BarArray[0], if I start the strategy on a 5 mins chart and a 20 mins chart ?

    Thanks !

    #2
    Hello wolfcuring, and thank you for your question.

    DataSeries members of BarsArray created using the Add method are read only. You can, if you would like, simply use the MACD series directly in OnBarUpdate as follows,

    MACD(BarsArray[2], 9, 26, 3)

    BarsArray[0] is always the primary data series. I am providing a link to the Help Guide documentation for BarsArray.



    Please let us know if there are any other ways we can help.
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Thank you JessicaP,

      I have figured out another way to do it. That is, to create a multi-time frame MACD indicator first, that way, I don't have to refer to the BarsArray method in the Initialize() part.

      Thank you anyway, hopes this could also help the others who wanna do this too.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      633 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      364 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      567 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      568 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X