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 Instrument strategy

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

    Multi Instrument strategy

    In example from documentation
    <<<<
    MSFT 1 minute Bars is given an index value of 0
    MSFT 3 minute Bars is given an index value of 1
    AAPL 1 minute Bars is given an index value of 2

    This allows us to get the correct Bars object and use it as input for an indicator method. For example:


    ADX(14)[0] > 30 && ADX(BarsArray[2], 14)[0] > 30
    >>>>
    But is it valid comparison? Time is different for 1 min between Time[0] and Times[2][0]. So, we are comparing value of indicators in different time.

    Is it possible to sync time? Or what is the way around?

    #2
    It is not possible to sync the time. Consider this example.

    AAPL 1min
    AAPL 3min

    A tick for AAPL comes in and is being processed in the 1min. You try to access the value of an indicator based off of 3mins. What do you get? You get the value of that indicator on the previous tick. The 3min has not been updated with the tick you are processing in the 1min yet.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      RE

      so if

      APPL 5 min
      MSFT 5 min

      it is impossible to compare these two at the same time ?

      I would like to do something with
      APPL[0] and MSFT[0],
      when
      Times[1][0] == Time[0]

      Comment


        #4
        When you have different instruments the behavior becomes unpredictable. NinjaTrader will process whichever tick was received first. If AAPL was received first then it will process that and you will get the value of the latest received MSFT tick. If the MSFT tick comes in during the processing of AAPL, MSFT has not updated with this tick yet so you will not get MSFT values in relation to this tick.
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by WHICKED, Today, 02:02 PM
        0 responses
        2 views
        0 likes
        Last Post WHICKED
        by WHICKED
         
        Started by selu72, Today, 02:01 PM
        0 responses
        0 views
        0 likes
        Last Post selu72
        by selu72
         
        Started by f.saeidi, Today, 12:14 PM
        8 responses
        21 views
        0 likes
        Last Post f.saeidi  
        Started by Mikey_, 03-23-2024, 05:59 PM
        3 responses
        49 views
        0 likes
        Last Post Sam2515
        by Sam2515
         
        Started by Russ Moreland, Today, 12:54 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Erick  
        Working...
        X