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

Multi-timeframe indicator referencing

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

    Multi-timeframe indicator referencing

    Hello,
    i am trying to build a multi-time frame strategy processing in real-time with setting
    'CalculateOnBarClose = false'

    The primary bars are 10min while secondary bars object is Add(PeriodType.Tick, 10);

    My question is the following:
    If I would like to initiate something on the secondary bars object with condition examined on the primary bars, can I reference the MACD on the primary bar to trigger conditional action on the secondary bar with...

    if( MACD(BarsArray[0],8, 21, 10).Diff[0]) > 0 )
    {
    if(Highs[1][0] > Highs[1][1])
    {
    EnterLong("","")
    }
    }

    ...or the 'if (BarsInProgress == 0)' and 'if (BarsInProgress == 1)' conditions are necessary to reference the correct bars object?

    Thank you

    #2
    Hi LazKz, welcome to the NinjaTrader support forums! Both methods are fine - either use the BarsArray and point to the correct bars object with the index value or call the methods in reference to the BarsInProgress and which bars object is calling the OnBarUpdate().
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thanks Bertrand,

      There is one thing I am still not sure of. When checking which bars object is calling the OnBarUpdate() method with the following code

      if (BarsInProgress == 1)
      {
      MACD(8, 21, 10).Diff[0] > 0
      }

      the MACD().Diff[0] without the BarsArray[1] defining the Inputdata would it refer to the secondary Bars object or to the primary bars object?

      Comment


        #4
        When in BIP=1, a regular call would refer to the secondary bar object.
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by bourasrafik, Today, 03:26 PM
        0 responses
        1 view
        0 likes
        Last Post bourasrafik  
        Started by benmarkal, Yesterday, 08:44 AM
        1 response
        30 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by somethingcomplex, Yesterday, 10:36 PM
        1 response
        24 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by rayyyu12, Today, 12:47 AM
        1 response
        14 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by guyonabuffalo, Yesterday, 10:01 PM
        1 response
        13 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Working...
        X