Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

More than 100 subsequent user events

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

    More than 100 subsequent user events

    Ok. I have a small issue where by when I run my strategy using the associated indicator, I get the below error.
    Sometimes the strategy would be working fine for hours then it throws that error. Other times I cannot get it start due to it throwing that error. I have to wait a few more bars sometimes then it starts, but crashes later on. If I do market replay, it doesn't crash, I can play 3 months of Market replay one time and it doesn't crash, but go live and there it is. Sporadic. Even when the indicator loads to the chart, if I reload the ninjascript I get the error also.

    Please let me know how I can avoid this. Thanks.

    I am using the indicator DeltaMomentum that is available on the NInjatrader ecosystem.




    Indicator 'irDeltaMomentum': Error on calling 'OnBarUpdate' method on bar 7832: More than 100 subsequent user events
    Strategy 'DeltaScalper5': Error on calling 'OnBarUpdate' method on bar 7833: Object reference not set to an instance of an object.
    Disabling NinjaScript strategy 'DeltaScalper5/159561905'


    code Snipets.
    else if (State == State.Configure)
    {
    AddDataSeries(Data.BarsPeriodType.Tick, 1);

    }
    else if (State == State.DataLoaded)
    {
    irDeltaMomentum1 = irDeltaMomentum(Close);
    AddChartIndicator(irDeltaMomentum1);


    }
    protected override void OnBarUpdate()
    {
    if (BarsInProgress != 0)
    return;
    if ( CurrentBar <500)
    return;
    Print("Called on Bar");


    if (Bars.IsFirstBarOfSession || ToTime(Time[0]) < 020000 )
    {
    // _so.TrailEma.Checked=true;
    // Store the strategy's prior cumulated realized profit and number of trades
    RunOnce=false;
    priorTradesCount = SystemPerformance.AllTrades.Count;
    priorTradesCumProfit = SystemPerformance.AllTrades.TradesPerformance.Curr ency.CumProfit;
    CalledStop=false;
    if (Bars.IsFirstBarOfSession)
    Print(irDeltaMomentum1.DownMomo[0]);
    }

    #2
    Hello, thanks for your post.

    In the source code for DeltaMomentum, there is an extra override of OnMarketData and OnMarketDepth, please remove those from the source code first and test if this problem happens again.

    Remove:
    Code:
    protected override void OnMarketData(MarketDataEventArgs marketDataUpdate)
    {
    
    }
    
    protected override void OnMarketDepth(MarketDepthEventArgs marketDepthUpdate)
    {
    
    }
    I look forward to hearing of your results.

    Comment


      #3
      Ok. Looks like it is holding. Will continue to monitor over the next few days.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      54 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      131 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      73 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      44 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      49 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X