Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AddBar with Error: Write Lock may not be acquired with read lock held.

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

    AddBar with Error: Write Lock may not be acquired with read lock held.

    Greetings!
    Your help would certainly be appreciated.
    This is my first experience with AddBar; perhaps the syntax is incorrect. The script compiles well.
    I trade Tick bars but want to capture Time specific intrabar events – this example script is to retain the precise 9:30 price value which is accurately define as p930, but changes when the screen is refreshed (as is expected with Tick bars).

    Bars.AddBar( p930, p930+(2*TickSize), p930-(2*TickSize), p930, DateTime.Now,
    (long) Math.Min(Volume[1],Volume[2]), TickSize);

    I’ve read all Forum notes regarding this specific log displayed error – Upgradable Lock. In his 3/13/2017 post, Brett comments:

    If anyone else is running into Upgradable lock error message issue I would love to send you a custom build to make sure it will resolve the issue for you so we make sure we have this one squashed.


    This error is outside of my area of understanding or further Forum research. Thanks in advance. I am using NinjaTrader version 8.0.20.1 64-bit.
    Last edited by JulieC; 12-25-2019, 10:20 PM. Reason: Included NinjaTrader version

    #2
    Hi JulieC, thanks for your post.

    AddBar() is only used in custom bar types to add a new bar to the price series. It looks like your doing this from an indicator. To get a price at a certain time you will need to add a second price series to your script. There is a guide on multi-series scripts here:



    In your case, if the script runs OnBarClose, you can add a 1-minute series and capture the price at the close of the 9:30 bar. e.g.

    Code:
    OnBarUpdate()
    {
    
        if(BarsInProgress == 1)
        {
    
            if (Times[1][0].TimeOfDay == new TimeSpan(9, 30, 0))
                {
                    Print(Closes[1][0]);
                }
    
        }
    
    }
    Please let me know if I can assist any further.

    Comment


      #3
      Thanks ChrisL for your help.

      I have no problem extracting the precise price at the precise second/instant – intrabar, within a TickBar.
      The problem is retaining that much precision should a refresh be used.
      Yes, I agree, the suggestion recommended in your response is one good solution (but cumbersome from other aspects). I was hoping to slip in an extra bar without consequence

      I will research more about custom bar types.
      Thanks again.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      639 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      366 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      107 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      569 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      572 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X