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 CaptainJack, 05-29-2026, 05:09 AM
          0 responses
          213 views
          0 likes
          Last Post CaptainJack  
          Started by CaptainJack, 05-29-2026, 12:02 AM
          0 responses
          125 views
          0 likes
          Last Post CaptainJack  
          Started by charlesugo_1, 05-26-2026, 05:03 PM
          0 responses
          145 views
          0 likes
          Last Post charlesugo_1  
          Started by DannyP96, 05-18-2026, 02:38 PM
          1 response
          228 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 05-11-2026, 05:56 AM
          0 responses
          189 views
          0 likes
          Last Post CarlTrading  
          Working...
          X