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 CarlTrading, 03-31-2026, 09:41 PM
          1 response
          72 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          39 views
          0 likes
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          63 views
          2 likes
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          63 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          53 views
          0 likes
          Last Post CarlTrading  
          Working...
          X