Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error on Calling 'OnBarUpdate'

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

    Error on Calling 'OnBarUpdate'

    I am getting the following error when applying my indicator

    Error on calling 'OnBarUpdate' method for indicator 'IndicatorName' on bar 533: A generic error occurred in GDI+.

    The indicator does what it is supposed to do immediately after adding it to a chart or after hitting the f5 reload but that's it. I have ToTime in the if statement but the indicator is ignoring the time. Is the error above a simple one and I just need to add some basic code to fix it or are there many possibilities that could be causing the error?

    Here is a code snippet:

    protected override void OnBarUpdate()
    {


    if(CurrentBar < 10) return;

    if (
    ToTime(Time[0]) >= ToTime(09, 30, 0)
    && ToTime(Time[0]) <= ToTime(09, 35, 0)
    && myBool == true)

    {

    Do Something Here
    }

    #2
    Hello jhowinvest,

    From that code snippet I do not see anything wrong with it. You may want to try commenting out line by line your code inside the "Do Something Here" area or use Try-Catch Blocks to debug your code.
    JCNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    649 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    370 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    109 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    574 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    576 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X