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 alexstox, 10-16-2018, 03:29 PM
      10 responses
      333 views
      0 likes
      Last Post Tburg1073  
      Started by smartromain, 03-13-2024, 01:42 AM
      6 responses
      98 views
      0 likes
      Last Post smartromain  
      Started by Jonker, 04-27-2024, 01:19 PM
      4 responses
      29 views
      0 likes
      Last Post Jonker
      by Jonker
       
      Started by Yasharandom, Today, 07:45 AM
      0 responses
      5 views
      0 likes
      Last Post Yasharandom  
      Started by llanqui, Yesterday, 09:59 AM
      4 responses
      24 views
      0 likes
      Last Post llanqui
      by llanqui
       
      Working...
      X