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 jasinhbca, Today, 01:20 PM
3 responses
30 views
0 likes
Last Post jasinhbca  
Started by jhjhawkins, Today, 12:25 PM
3 responses
20 views
0 likes
Last Post NinjaTrader_Kate  
Started by rexsole, Today, 11:48 AM
1 response
28 views
0 likes
Last Post NinjaTrader_PatrickG  
Started by jeronymite, Yesterday, 05:05 PM
3 responses
61 views
0 likes
Last Post NinjaTrader_ChristopherJ  
Started by Don22Trader1, Yesterday, 05:54 PM
3 responses
53 views
0 likes
Last Post NinjaTrader_Jesse  
Working...
X