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

How to Handle BarsRequest Errors?

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

  • NinjaTrader_Jesse
    replied
    Hello NtFan,

    Thank you for the post.

    Do you have a specific sample that demonstrates the problem? If you can copy/paste the total BarsRequest logic you used into a test indicator and attach that it would be helpful. Also what are the specific steps to see the error? Are you running this against an instrument that does not exist or what is the specific situation? If the case is that this is an error and it is not being reported as an error I can likely report that to development with a sample/steps to see that.

    I look forward to being of further assistance.

    Leave a comment:


  • NtFan
    started a topic How to Handle BarsRequest Errors?

    How to Handle BarsRequest Errors?

    I'm using BarsRequest in an Add On procedure that I've developed, and I'm handling BarsRequest errors as demonstrated in the NT8 Help Guide topic for BarsRequest, as in...

    barsRequest.Request(new Action<BarsRequest, ErrorCode, string>((bars, errorCode, errorMessage) =>
    {
    if (errorCode != ErrorCode.NoError)
    {
    // Handle any errors in requesting bars here
    NinjaTrader.Code.Output.Process(string.Format("Err or on requesting bars: {0}, {1}",
    errorCode, errorMessage), PrintTo.OutputTab1);
    return;
    }

    etc.

    I've discovered that this approach to handling errors produced by the Request method doesn't work. It doesn't work, because when the Request method encounters an error the "if (errorCode != ErrorCode.NoError)" code snippet doesn't execute. Instead, NT immediately issues an error that reads like "Error on requesting bars series: 'The instrument for which you requested data is invalid.'" and NT exits the procedure. So, might you recommend another approach for trapping and handling errors produced by the Request method?

Latest Posts

Collapse

Topics Statistics Last Post
Started by WHICKED, Today, 12:56 PM
0 responses
2 views
0 likes
Last Post WHICKED
by WHICKED
 
Started by Spiderbird, Today, 12:15 PM
2 responses
10 views
0 likes
Last Post Spiderbird  
Started by WHICKED, Today, 12:45 PM
0 responses
7 views
0 likes
Last Post WHICKED
by WHICKED
 
Started by FrazMann, Today, 11:21 AM
2 responses
6 views
0 likes
Last Post NinjaTrader_ChristopherJ  
Started by rjbtrade1, 11-30-2023, 04:38 PM
2 responses
80 views
0 likes
Last Post DavidHP
by DavidHP
 
Working...
X