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

Understanding multi instrument strategies

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

    Understanding multi instrument strategies

    below two code versions using multi instrument techniques. The 1 checks condition on inst[1] using BIP==1. And them checks a condition on inst[0] and another condition on inst[1]. number 2 checks all condition in inst[1] and them checks instrumnet [0] without BIP==0.
    1-Is there any rule regarding BIP and inst x y z condition?
    2-can I mixes condition on different instruments?
    3-Do I have to use BIP??
    4-can I use BIP==0 and check a condition on inst[1]?


    1) if (BarsInProgress == 1 && (priorClosePrice-Medians[1][0]> -deltaVX) && (priorClosePrice-Medians[1][0]< deltaVX))
    {

    if (CrossAbove(Medians[0], Bollinger( BarsArray[0], NumberStdDev, Period).Lower, 1) && (Medians[1][0] > SMA (BarsArray[1],SMACycle)[0]))
    {
    EnterLong(0,positionTaken,priorClosePrice.ToString ());
    }
    }
    <<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>
    2) if ((priorClosePrice-Medians[1][0]> -deltaVX) && (priorClosePrice-Medians[1][0]< deltaVX) && (Medians[1][0] > SMA (BarsArray[1],SMACycle)[0]))
    {

    if (BarsInProgress == 0 && CrossAbove(Medians[0], Bollinger( BarsArray[0], NumberStdDev, Period).Lower, 1))
    {
    EnterLong(0,positionTaken,(deltaVX).ToString());
    }
    }

    #2
    1-Is there any rule regarding BIP and inst x y z condition?
    I'm not sure I fully understand this question but I think my answers to the following should help.

    2-can I mixes condition on different instruments?
    Yes, see answer to #4
    3-Do I have to use BIP??
    You will need some sort of BIP filtering otherwise you will get all your instruments making calls to the same condition set

    4-can I use BIP==0 and check a condition on inst[1]?

    if(BarsInProgress == 0)
    {
    //this condition would check the SMA of the secondary instrument against the closing price of the 2nd instrument
    if( SMA(BarsArray[1], 20)[0] > Closes[1][0])
    //do something
    }




    Very important information if you haven't read already: http://www.ninjatrader.com/support/h...nstruments.htm

    As a side note in your example you wouldn't need to check the barsarray if you knew the BIP you were in and needed the value from that same BIP

    if(BarsInProgress == 0)
    {
    //this condition would check the SMA of the primary instrument against the closing price of the primary instrument
    if( SMA( 20)[0] > Close[0])
    //do something
    }
    LanceNinjaTrader Customer Service

    Comment


      #3
      I will read it carefully.
      But, Can we say that: supposing we ve added instrument[0], inst[1] and inst [2]
      if BIP==0
      instrument[0] is the inst we are running the strategy on (zero)? and instrument[1] is the first added inst (equal [1]) and so on?
      and
      id BIP==1
      instrument[0] is the first added instrument (inst[1] on top) and instrument [1] will be the second insturment added (inst[2] on top)???

      Comment


        #4
        Sounds like you have it correct.

        BIP == 0 will always be the Chart series (primary)

        BIP==1 will always be the first instrument/series added
        LanceNinjaTrader Customer Service

        Comment


          #5
          I was meaning something different..
          so, to make it clear.
          no matter what BIP am I. BIP==1 or BIP==2,
          Medians[0] will ALLWAYS be related to the current chart.
          Is that correct?

          Comment


            #6
            That is correct
            LanceNinjaTrader Customer Service

            Comment


              #7
              So My last question would be:
              regarding conditions to trigger buy and sell orders,
              When I need to use BIP==...? Is there any specfic situation?
              (or working with Medians[0] and [1]... I can handle instruments well);

              Comment


                #8
                Originally posted by dafonseca View Post
                I was meaning something different..
                so, to make it clear.
                no matter what BIP am I. BIP==1 or BIP==2,
                Medians[0] will ALLWAYS be related to the current chart.
                Is that correct?
                I had some major complaints with this in Market Replay... One of my "earlier" posts...

                but at some point, everything appeared to clear up, and behaves as expected as far as I can tell.

                (this was early nt 7.0 releases)..

                Comment


                  #9
                  Originally posted by dafonseca View Post
                  So My last question would be:
                  regarding conditions to trigger buy and sell orders,
                  When I need to use BIP==...? Is there any specfic situation?
                  (or working with Medians[0] and [1]... I can handle instruments well);
                  It depends on your logic and what you are trying to accomplish.

                  What is your specific situation? I don't know!

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by giulyko00, 04-24-2024, 12:03 PM
                  7 responses
                  32 views
                  0 likes
                  Last Post eDanny
                  by eDanny
                   
                  Started by NM_eFe, Today, 10:13 AM
                  0 responses
                  4 views
                  0 likes
                  Last Post NM_eFe
                  by NM_eFe
                   
                  Started by hdge4u, Yesterday, 12:23 PM
                  1 response
                  10 views
                  0 likes
                  Last Post hdge4u
                  by hdge4u
                   
                  Started by 1001111, Today, 09:45 AM
                  0 responses
                  12 views
                  0 likes
                  Last Post 1001111
                  by 1001111
                   
                  Started by DTSSTS, 01-28-2024, 12:07 PM
                  11 responses
                  561 views
                  0 likes
                  Last Post bmo111
                  by bmo111
                   
                  Working...
                  X