Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Max Down Day

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

    #16
    Yes, the primary series would always come from the UI directly, it's what you choose to base your strategy on.

    If I test my script posted I get exactly the same trades # and Net Profit when comparing.

    What entry Handling are you now using? On my script I was using then EntriesPerDirection of 2 with a handling of AllEntries, so that both instruments could have one trade open simultaneous.

    Comment


      #17
      Ok good progress, got it to match up between single and multi instruments scripts even with having 6 price series(3 for each instrument).

      Question here now is, is this the shortest way to do this, having to create a new BIP for each instrument? What I was ultimately looking to do was run the whole nasdaq 100 under a multiinstrument script so I can see graphs based on the whole portfolio. Using your script example this would mean 100 BIP's!
      And with my strategy having 3 price series per instrument this will get even crazier.

      Also I'm not even sure if there is a limit to how many BIP's you can have.
      Last edited by zachj; 06-26-2013, 05:33 PM.

      Comment


        #18
        Glad to hear about the progress Zach, you're unfortunately correct in understanding the series would need to be added this way which you wanted to have access to in the portfolio. There's no hard set limit, but depending on your setup it can affect performance seen though in your case it's relatively easy since there's no true tick data involved.

        Comment


          #19
          Isn't there something you could potentially set up where you have a list of Instruments iterating through one BIP line where it keeps plugging in each instrument to the same line of code increasing the BIP by +1 until it completes the list or something to this effect? No idea how you would set this up but somehow using the type of info below? Maybe creating a method also?

          private int PriceSeries = 1;

          Add("DIA", PeriodType.Minute, 5);
          Add("SPY", PeriodType.Minute, 5);
          Add("QQQ", PeriodType.Minute, 5);
          Add("MSFT", PeriodType.Minute, 5);
          Add("JPM", PeriodType.Minute, 5);

          DIA =1, SPY = 2, QQQ =3, MSFT=4, JPM=5

          if (BarsInProgress == PriceSeries ++1)

          Comment


            #20
            Zach, nothing that we could support in that area unfortunately - however via the undocumented territories you could look into something along those lines -

            NinjaTrader.Cbi.InstrumentList list1 = NinjaTrader.Cbi.InstrumentList.GetObject("DOW 30");

            foreach (Instrument i in list1.Instruments)
            {
            Add(i.FullName, PeriodType.Minute, 5);
            }

            Comment


              #21
              Could you do something like this...

              for (int priceseries = 0; priceseries < 6; priceseries++)
              if (BarsInProgress == priceseries)
              {
              if (CrossAbove(SMA(10), SMA(20), 1))
              EnterLong();
              }

              Comment


                #22
                Yes, that would work as well.

                Comment


                  #23
                  If I do... for (int priceseries = 0; priceseries < 6; priceseries++)

                  Will it start with price series 0 or start at 1?

                  Comment


                    #24
                    Hello zachj,

                    It will start at 0.
                    JCNinjaTrader Customer Service

                    Comment


                      #25
                      If I have these 4 price series, 2 for each instrument. I'm using only 2 instruments just to test the loop.
                      //Primary is 5min SPY, series 0
                      Add("DIA", PeriodType.Minute, 5); //primary for DIA, series 1
                      Add(PeriodType.Minute, 1); //secondary for SPY, series 2
                      Add("DIA", PeriodType.Minute, 1); //secondary for DIA, series 3

                      For this code below I created "series" for the primary bars for each instrument and "seriestwo" for the secondary bars for each instrument. BIP just uses "seriestwo" but the SMA and Close part of the code uses both. So basically for "seriestwo" I want it to pick up 2 and plug that in all the way to EnterLong() while also picking up 0 for "series" and plugging that in as well. Then I'm looking for it to start over and pick up 3 for "seriestwo" and pick up 1 for "series". Something is not right though because net profit isn't checking out and looking at the trades from backtest its only trading the first instrument or making only one loop. Any idea?

                      for (int series = 0; series < 2; series++)
                      for (int seriestwo = 2; seriestwo < 4; seriestwo++)
                      if (BarsInProgress == seriestwo)
                      {
                      if (SMA(BarsArray[series],Fast)[1] > SMA(BarsArray[series],Slow)[1] && SMA(BarsArray[series],Fast)[2] < SMA(BarsArray[series],Slow)[2] && Closes[seriestwo][0] > Highs[series][1] + distance

                      EnterLong(200, "");
                      }
                      Last edited by zachj; 06-27-2013, 08:59 PM.

                      Comment


                        #26
                        Zach, so seriestwo is always series + 2?

                        Comment


                          #27
                          "seriestwo" im looking for it to use price series 2 then on the second loop use prices series 3. Which plugs the 1minute bar for each instrument into Closes[seriestwo][0]

                          "series" is plugging in the 5min bar for each instrument.

                          Hope that answers your question.

                          Comment


                            #28
                            No, I was more referring to your condition exactly as posted since if you add all instruments in this manner logically, you should be able to work it using one loop I think. By simply expressing seriestwo as series + 2.

                            Comment


                              #29
                              Oh genius, now I see. I didn't know you could do that. For some reason net profit isn't matching the single instrument script run for the 2 instruments. Ill have to look into it more. Thanks

                              Comment


                                #30
                                Everything seems to be matching how the single script is run but net profit is off. Am I missing anything in the looping script possibly? Do I need the code below to be before series++. It doesnt seem to change anything though and Im not quite understanding what that code means anyway.

                                if (CurrentBars[0] < BarsRequired || CurrentBars[1] < BarsRequired || CurrentBars[2] < BarsRequired || CurrentBars[3] < BarsRequired) return;

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                                0 responses
                                578 views
                                0 likes
                                Last Post Geovanny Suaza  
                                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                                0 responses
                                334 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by Mindset, 02-09-2026, 11:44 AM
                                0 responses
                                101 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                                0 responses
                                553 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by RFrosty, 01-28-2026, 06:49 PM
                                0 responses
                                551 views
                                1 like
                                Last Post RFrosty
                                by RFrosty
                                 
                                Working...
                                X