Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Math.Round - MidpointRounding.ToZero

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

    Math.Round - MidpointRounding.ToZero

    Can't find MidpointRounding.ToZero for Math.Round.

    Thanks

    edit
    Took another approach. Thanks
    Last edited by td_910; 05-08-2023, 02:20 AM.

    #2
    Works for me.

    Do you have 'using System;' in your script?

    Comment


      #3
      yes, but no worries

      Code:
      #region Using declarations
      using System;
      using System.Collections.Generic;
      using System.ComponentModel;
      using System.ComponentModel.DataAnnotations;
      using System.Linq;
      using System.Text;
      using System.Threading.Tasks;
      using System.Windows;
      using System.Windows.Input;
      using System.Windows.Media;
      using System.Xml.Serialization;
      using NinjaTrader.Cbi;
      using NinjaTrader.Gui;
      using NinjaTrader.Gui.Chart;
      using NinjaTrader.Gui.SuperDom;
      using NinjaTrader.Gui.Tools;
      using NinjaTrader.Data;
      using NinjaTrader.NinjaScript;
      using NinjaTrader.Core.FloatingPoint;
      using NinjaTrader.NinjaScript.DrawingTools;
      #endregion​

      Comment


        #4
        bltdavid td_910 This is because .ToZero wasn't added yet to the MidpointRounding enum as of Framework 4.8.1. The choices are AwayFromZero and ToEven.

        See the documentation here: https://learn.microsoft.com/en-us/do...ramework-4.8.1

        It would work in a standalone .NET application but you would have to target a framework later than this in the framework versions.
        Bruce DeVault
        QuantKey Trading Vendor Services
        NinjaTrader Ecosystem Vendor - QuantKey

        Comment


          #5
          Ah, yes, my bad ... I did not look closely at the docs.

          Good catch, thanks Bruce!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          647 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          368 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          108 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          571 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          573 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X