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 charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      51 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      142 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      160 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      96 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      275 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Working...
      X