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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    81 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    43 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    64 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    68 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    56 views
    0 likes
    Last Post CarlTrading  
    Working...
    X