Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Round to Next To Nearest Tick

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

    Round to Next To Nearest Tick

    Hey Guys I have code
    Code:
    roundedClose = Instrument.MasterInstrument.Round2TickSize( (Close[0])) ;
    		DrawTextFixed("Round", roundedClose.ToString(), TextPosition.TopRight, Color.Black, new Font ("Arial", 14), Color.Empty, Color.Empty,0);
    My chart is set EUR/USD (TenthOfAPiP) so I get number like 1.06978 but I want to display the nearest Pip not Pipette. How would I do this? so that if the Close[0] = 1.06978 ; I'll get 1.0698?

    What do I have to change? thank you

    #2
    Hello ginx10k,

    Thanks for your post.

    Try:

    Code:
    DrawTextFixed("Round", roundedClose.ToString("0.0000"), TextPosition.TopRight, 
    			Color.Black, new Font ("Arial", 14), Color.Empty, Color.Empty,0);

    Comment


      #3
      That's great for Writing the String. Thanks so much. HOWEVER,

      How do I get that value now so I can use it in another variable. or in the same variable. I want that roundedClose the same as it displays, I want the value in a variable.

      Comment


        #4
        Hello ginx10k,

        Thanks for your reply.

        Math.Round(number to round, decimals wanted) would meet your needs.

        newrounded = Math.Round(roundedClose, 4);

        Rounds a value to the nearest integer or to the specified number of fractional digits.

        Comment


          #5
          Great. thanks a lot!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Hwop38, 05-04-2026, 07:02 PM
          0 responses
          162 views
          0 likes
          Last Post Hwop38
          by Hwop38
           
          Started by CaptainJack, 04-24-2026, 11:07 PM
          0 responses
          312 views
          0 likes
          Last Post CaptainJack  
          Started by Mindset, 04-21-2026, 06:46 AM
          0 responses
          245 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by M4ndoo, 04-20-2026, 05:21 PM
          0 responses
          350 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by M4ndoo, 04-19-2026, 05:54 PM
          0 responses
          179 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Working...
          X