Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

FirstTickOfBar MultiSeries

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

    FirstTickOfBar MultiSeries

    If you use FirstTickOfBar in a multi data series indicator, to which of the Bars does the condition refer?

    I did not see any option to differentiate between BarsInProgress == 0 and BarsInProgress = 1, so it seems that the condition is always true, when any of the added BarSeries registers a first tick.

    Do you envisage something like FirstTickOfBars[0], when BarsInProgress == 0, etc?

    Or am I completely wrong here?

    #2
    Hi Harry,

    That's correct. The property offers no distinction among multiple series, so would have to check its value within the context of a specific Bars In Progress.

    if (FirstTickOfBar && BarsInProgress == 0)
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Just a clarification, please. In a multi-time frame strategy using different periods of the same instrument, all BarsArrays will BIP at the same time, same tick. Will your suggestion isolate when BIP is working on FTOB or, because all BarsArrays are updating on the same tick, does BIP == true for BA[0], BA[1], and BA[2] and FTOB == true even if FTOB is on BA[2] and not on BA[0]?

      BarsArray[0].FirstTickOfBar would be really handy.

      EDIT: The answer appears to be NO. I just had a trade trigger with (FTOB && BIP == 0), intrabar BIP0.
      Last edited by snaphook; 03-28-2011, 07:42 AM.

      Comment


        #4
        Hi Snaphook,

        It should only return true when checked with a specific bars in progress. Can you clarify what you are seeing with an example? Under what conditions did you place your trade?

        If you have multiple series and check both FTOB and BIP = 0, then this checks the primary series for first tick of bar only.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Rats, I cleared my output window. I'll wait for another trigger and get back to you. The code looks like below and all variables are properly defined and the strategy runs, except for 2 intrabar trades before I disabled it:

          TRO tro1 = TRO(BarsArray[1],Range4);
          TRO tro2 = TRO(BarsArray[2],Range3);
          TRO tro3 = TRO(BarsArray[3],Range2);
          TRO tro4 = TRO(BarsArray[4],Range1);
          TRO tro = TRO(BarsArray[0],longPeriods);

          if(FirstTickOfBar && BarsInProgress == 0)
          {
          TROSum4 = TROSum3;
          TROSum3 = TROSum2;
          TROSum2 = TROSum1;
          TROSum1 = TROSum;
          TROSum = ((tro1[1] + tro2[1] + tro3[1] + tro4[1])/4);
          }

          Some other informative stuff here

          if(FirstTickOfBar && BarsInProgress == 0)
          {
          trade = 0;
          PatternDesc = "";

          if(tro[1] > 0
          && (tro[1] > deadZone || TROSum1 > deadZone)
          && tro[1] < maxSigVal
          && ((TROSum1 > TROSum2 + 5
          && TROSum3 > TROSum2)
          || (TROSum1 > TROSum2 + 15
          && TROSum3 > TROSum2 - 2))
          && Closes[0][1] == Highs[0][1])
          {
          trade = 7;
          Print("Bar: " + BarsArray[0].BarsSinceSession + " tro[1] = " + tro[1].ToString("f3") + " TROSum1 = " + TROSum1.ToString("f3") + " TROSum2 = " + TROSum2.ToString("f3") + " TROSum3 = " + TROSum3.ToString("f3"));
          }

          if(trade == 0
          && tro[1] < 0
          && (tro[1] < -deadZone || TROSum1 < -deadZone)
          && tro[1] > -maxSigVal
          && ((TROSum1 < TROSum2 - 5
          && TROSum3 < TROSum2)
          || (TROSum1 < TROSum2 - 15
          && TROSum3 < TROSum2 + 2))
          && Closes[0][1] == Lows[0][1])
          {
          trade = -7;
          Print("Bar: " + BarsArray[0].BarsSinceSession + " tro[1] = " + tro[1].ToString("f3") + " TROSum1 = " + TROSum1.ToString("f3") + " TROSum2 = " + TROSum2.ToString("f3") + " TROSum3 = " + TROSum3.ToString("f3"));
          }

          Switch to select trade template

          }

          Comment


            #6
            Thanks, snaphook. Your trade placement takes place outside the FirstTickOfBar and BIP == 0 check, so this would be the first place to simplify the evaluation. You can also confirm with a simple print statement that the condition is true for only the BIP you're checking.

            if(FirstTickOfBar && BarsInProgress == 0)
            {
            Print("FTOB is true for BIP: " + BarsInProgress);
            }
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              Immediately following the code I sent there is some other housekeeping and then:

              #region Order Entry
              if (Historical) return;
              else if(FirstTickOfBar && BarsInProgress == 0)
              {
              //Print ("Line 489, Bar" + BarsArray[0].BarsSinceSession + " " + Time[0].TimeOfDay + " Pre anything Order Entry: Strategy Id: " + atmStrategyId + ", Order Id: " + orderId);
              if((atmStrategyId.Length > 0 ? GetAtmStrategyMarketPosition(atmStrategyId) == MarketPosition.Flat : 1==1)
              && realized_profit > loss_exit && realized_profit < profit_exit
              && PatternDesc != "" && btnManual.Text == "Auto" && trade != 0)//wait til flat
              Entry(typeEntry, trade);//Put it back here
              }
              #endregion

              The actual trade execution occurs in Entry() and is only called here.

              Comment


                #8
                Thanks, snaphook. Can you let us know what scenario we can follow to see a similar result here? It also helps to remove any extra code that is not critical in reproducing.
                Ryan M.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                574 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                332 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