Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Value either too large or too small for an Int32

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

    Value either too large or too small for an Int32

    I need help troubleshooting the error, "Value was either too large or too small for an Int32"? I have a strategy that puts fibs on a chart and places limit orders at a particular fib value (e.g. 55%). I also Draw.Text on the chart showing how many contracts would be traded based on risking a dollar amount beyond the fib level.

    To troubleshoot, I've commented out sections of code, stored price values rounded to the ticksize and rounded number of contracts to integers. I even Print values and don't see anything weird When drawing text on the chart I converted the contact number to a string thinking that was the problem. I'm not sure where to go from here. The error doesn't show up on a consistent basis. I'm testing the strategy on Playback mode and typically need to move the fibs around manually on the chart before the strategy stops and I get the error. Any tips on how to troubleshoot this?

    #2
    Hello tak145,

    Thank you for your post.

    I would suggest narrowing down exactly which line of code is throwing the error and what the value you are trying to assign to this int variable is.

    If you've already done the debugging by commenting out sections of code, which line of code is throwing the error?

    Comment


      #3
      I've only used Print statements so far. I'm reading how to use the debugger between Ninjascript Editor and Visual Studio. I'll try this. Thanks.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      53 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      130 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      70 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      44 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      49 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X