Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Math.Ceiling

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

    Math.Ceiling

    The following line of code is giving me the error "The call is ambiguous between the following methods or properties: 'System.Math.Ceiling(decimal)' and 'System.Math.Ceiling(double)'". What does this mean?

    Code:
    [FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]qty = ([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]) Math.Ceiling(Positions[[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]].Quantity/[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]2[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]);
    [/SIZE][/FONT][/SIZE][/FONT]

    #2
    you probably want to do something like
    Code:
    (double)(Positions[0].Quantity/2)
    see if that clears up the ambiguity (i can't try it now).
    mrlogik
    NinjaTrader Ecosystem Vendor - Purelogik Trading

    Comment


      #3
      That didn't work.

      Comment


        #4
        Try
        Code:
        qty = (int) Math.Ceiling((double) Positions[0].Quantity/2);

        Comment


          #5
          Great. Thanks!!!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          152 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          89 views
          1 like
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          133 views
          2 likes
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          127 views
          1 like
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          107 views
          0 likes
          Last Post CarlTrading  
          Working...
          X