Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Read Only Error

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

    Read Only Error

    HI
    I have an indicator I have been using for a couple of years.
    With the latest iteration of NT8 I get this odd error message

    Error on calling OnBarUpdate method on Bar 2505 .Cannot set a property on object '#FFFFFF0' because it is in a read only state

    It doesn't prevent the indicator from running, working or compiling.

    On investigation it's a problem with a color setting specifically

    Code:
            [XmlIgnore]
            [Display(Name="Dot  Color 1", Order=1, GroupName="Dot Colour Settings")]
            public Brush DotColor1
            { get; set; }
                
            [Browsable(false)]
            public string DotColor1Serializable
            {
                get { return Serialize.BrushToString(DotColor1); }
                set { DotColor1 = Serialize.StringToBrush(value); }
            }​
    However I have 3 other Dot Colors in the indiicator all following the exact same coding which don't produce this error.
    I have tried changing colors and it always produces the same error. Just on this Dot1.
    It seems ok Bar 0 - bar 2504 I think and as I say it doesn't stop the indicator running - just an irritation.
    Anyone help shine a light as to what I might have done to cause this error?

    thanks

    #2
    Hello Mindset,

    Are you trying to modify the brush in OnBarUpdate()?

    (If so, you need to clone it, change the clone, and freeze it)
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea
      No it stays exactly as it's set in SetDefaults.
      I simply use the color to define a dot color in OnMarketUpdate
      ps your link is broken but I found the resource anyway

      Comment


        #4
        Hello Mindset,

        "I simply use the color to define a dot color in OnMarketUpdate"

        Are you defining a brush in OnMarketUpdate or just using the existing brush saved to the variable?

        Our IT is aware of the forum links breaking and are looking into the matter. In the meantime we have received reports that using the uBlock origin extension can prevent the malformed URLs.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi
          yes just using the pre defined brush

          Comment


            #6
            Hello Mindset,

            What is the specific line of code causing the error?
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              I don't know!
              However I coded another version which seems to have fixed the problem.
              NO idea how or why. as the method coding was unchanged as were the Brush properties. Maybe just a glitch in the Matrix?

              Comment


                #8
                Hello Mindset,

                Debug the script by adding prints before each line to see which print is the last print to appear before the error appears.
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by rbeckmann05, Today, 06:48 PM
                0 responses
                4 views
                0 likes
                Last Post rbeckmann05  
                Started by rhyminkevin, Today, 04:58 PM
                4 responses
                52 views
                0 likes
                Last Post dp8282
                by dp8282
                 
                Started by iceman2018, Today, 05:07 PM
                0 responses
                5 views
                0 likes
                Last Post iceman2018  
                Started by lightsun47, Today, 03:51 PM
                0 responses
                8 views
                0 likes
                Last Post lightsun47  
                Started by 00nevest, Today, 02:27 PM
                1 response
                14 views
                0 likes
                Last Post 00nevest  
                Working...
                X