Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

round number

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

    round number

    Hi,
    Is there any way I can determine if the price is a round number e.g.

    2740
    2750
    2760
    I want to determine this in a strategy or an indicator. I can then draw a line, enter LONG, enter SHORT etc.
    probably missed this somehow


    TIA.
    Regards,


    SDG

    #2
    Sure...

    Code:
    decimalPlaces  = (YourNumber).ToString().Substring(YourNumber.ToString().IndexOf(".")).Length - 1;
    See if the number of decimal places in your number is 0.

    Comment


      #3
      Hello SuperDriveGuy,

      Thank you for the reply.

      You could use a modulus operator to check for whole numbers, here is a simple example comparing the Close to check if it is whole:
      Code:
      if(CurrentBar < 1) return;
      if(Close[0] % 1 == 0)
      {
      	DrawLine("tag" + CurrentBar, 1, Close[0], 0, Close[0], Color.Lime);
      }
      Here is a link for further information on this question and other examples as it is a general C# question surrounding Math. https://stackoverflow.com/a/2751597


      I look forward to being of further assistance.

      Comment


        #4
        I'm looking for an indicator that can draw a line at round number, or any specified number for that matter. Could you please help direct me to one such indicator? Thanks.

        Comment


          #5
          Have a look at this: https://ninjatrader.com/support/foru...ator-need-help
          Find my comment. Maybe this can help.

          Comment


            #6
            Ah was hopeful but didn't work for me maybe its for ninja 7

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            578 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            334 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            554 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            551 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X