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 CarlTrading, 05-11-2026, 05:56 AM
          0 responses
          25 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 05-10-2026, 08:12 PM
          0 responses
          19 views
          0 likes
          Last Post CarlTrading  
          Started by Hwop38, 05-04-2026, 07:02 PM
          0 responses
          182 views
          0 likes
          Last Post Hwop38
          by Hwop38
           
          Started by CaptainJack, 04-24-2026, 11:07 PM
          0 responses
          335 views
          0 likes
          Last Post CaptainJack  
          Started by Mindset, 04-21-2026, 06:46 AM
          0 responses
          260 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X