Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsSinceEntry() Question and Trade-# all the same

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

    BarsSinceEntry() Question and Trade-# all the same

    My strategy is broken and the culprit is BarsSinceEntry(BarsArrayIndex, TradeName, EntriesAgo).

    The release notes say this function is changed and now returns proper values relation to multi-series strategies which is the case I'm running.

    So what exactly does this mean? The error I'm getting is indicating index out of range but I don't really see how since this was working fine in V 6.5.

    One other data point. I've noticed all of my trades are 1 instead of the normal 1,2,3... Maybe this is contributing to the other problem.

    Any input greatly appreciated.
    daqu40
    NinjaTrader Ecosystem Vendor - QTradez

    #2
    Not sure what you mean by trades being 1,2,3 vs 1. Please clarify.

    Please provide the code snippet as to where you receive Index out of range.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Trade# all the same

      In Trades tab for my backtest every trade # is 1, instead of the each one being in sequence as would be expected of 1, 2, 3, etc.

      I'll post the code snipet on the BarsSinceEntry problem later when I'm in front of my development machine.
      daqu40
      NinjaTrader Ecosystem Vendor - QTradez

      Comment


        #4
        >> In Trades tab for my backtest every trade # is 1, instead of the each one being in sequence as would be expected of 1, 2, 3, etc.
        That's a bug which we just fixed. Thanks for reporting though.

        Comment


          #5
          cose snipet for BarsSinceEntry problem

          here is the code:

          if ((Position.MarketPosition == MarketPosition.Long )
          && BarsInProgress == 1
          && ATR(BarsArray[1], SetSMATrapATRPeriod)[BarsSinceEntry(1, myStratTrade.TradeName, 0)] >= SetSMATrapATRBound
          && (CrossAbove(BarsArray[1], SMA(BarsArray[1],SetSMATrapSMAPeriod),1)
          && Closes[1][0] >= SMA(BarsArray[1],SetSMATrapSMAPeriod)[0] + SetSMATrapLongOffsetTicks)
          && Closes[1][BarsSinceEntry(1, myStratTrade.TradeName, 0)] <= SMA(BarsArray[1],SetSMATrapSMAPeriod)[BarsSinceEntry(1, myStratTrade.TradeName, 0)] + SetSMATrapLongOffsetTicks
          )

          It works fine in NT 6.5. BarsArray[1] is 60 minutes. I just realized that not all trades enter on a 60 min bar. Maybe this is why the error is thrown.
          daqu40
          NinjaTrader Ecosystem Vendor - QTradez

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          601 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          347 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          103 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          559 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          558 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X