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

MRO and LRO method for secondary series

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

    MRO and LRO method for secondary series

    I see in the Help guide that the MRO and LRO methods do NOT work on multi-series strategies and indicators. So does this mean that if I add a secondary series and have the following:
    MRO (() => Highs[1][0] > Closes[1][0]), that it won't recognize the Highs[1][0] or Closes[1][0] of the secondary series?​

    #2
    Hello Lance El Camino,

    MRO / LRO will be looping back on the primary series and not on the secondary series.

    Sure you can use those values from the other series, but they may be not the bar relative to the primary bar you think it is and you could run into index errors.

    In other words, as it loops back to the previous Closes[0][0] bar, Closes[1][0] may not be the previous bar, depending on if its using the same interval as the primary.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the confirmation. A simple workaround is to create a bool that is true on the primary series when a condition is met on the secondary series and apply MRO/LRO to when that variable was last true.

      Comment


        #4
        Hello Lance El Camino,

        If you need to know when the condition is true looping through the added series indexes, you might just use a loop.

        Thats what MRO and LRO are doing internally.

        int conditionFoundBarsAgo = -1;

        for (int index = 0; index < 10; index++)
        {
        if ( Highs[1][index] < Closes[1][index] )
        {
        conditionFoundBarsAgo = index;
        }
        }

        Print(conditionFoundBarsAgo);
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thank you. Do LowestBar and HighestBar operate in the same way, not being able to use secondary series?

          Comment


            #6
            Hello Lance El Camino,

            I am not aware of this limitation with HighestBar() / LowestBar (as these are not being supplied a lambda expression).

            However, you could still make a loop for the same behavior.
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by ms52390, 06-20-2024, 03:48 PM
            2 responses
            14 views
            0 likes
            Last Post ms52390
            by ms52390
             
            Started by ccrone2024, Today, 05:13 AM
            0 responses
            7 views
            0 likes
            Last Post ccrone2024  
            Started by ttodua, Today, 03:40 AM
            0 responses
            6 views
            0 likes
            Last Post ttodua
            by ttodua
             
            Started by ttodua, Today, 03:18 AM
            0 responses
            7 views
            0 likes
            Last Post ttodua
            by ttodua
             
            Started by TraderKnG, Today, 01:30 AM
            0 responses
            13 views
            0 likes
            Last Post TraderKnG  
            Working...
            X