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

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 andrewtrades, Today, 04:57 PM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by chbruno, Today, 04:10 PM
      0 responses
      6 views
      0 likes
      Last Post chbruno
      by chbruno
       
      Started by josh18955, 03-25-2023, 11:16 AM
      6 responses
      436 views
      0 likes
      Last Post Delerium  
      Started by FAQtrader, Today, 03:35 PM
      0 responses
      7 views
      0 likes
      Last Post FAQtrader  
      Started by rocketman7, Today, 09:41 AM
      5 responses
      19 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X