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 Hwop38, 05-04-2026, 07:02 PM
    0 responses
    169 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    324 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    250 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    353 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    180 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Working...
    X