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 SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    29 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    17 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    9 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    16 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    19 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X