NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 03-08-2010, 09:48 PM   #1
suprsnipes
Senior Member
 
Join Date: Aug 2008
Posts: 233
Thanks: 19
Thanked 5 times in 5 posts
Default Rounding Up

I am using the following line of code to round down which works without any problems,

Code:
 ((int)(Close[0]/100))*100
but I am having a great deal of trouble in attempting to ROUND UP.

Any help would be greatly appreciated.

suprsnipes
suprsnipes is offline  
Reply With Quote
Old 03-09-2010, 06:03 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,420
Thanks: 252
Thanked 981 times in 963 posts
Default

Have you tried yet Math.Ceiling for this task?

http://msdn.microsoft.com/en-us/libr...ng(VS.80).aspx
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 03-09-2010, 08:00 AM   #3
suprsnipes
Senior Member
 
Join Date: Aug 2008
Posts: 233
Thanks: 19
Thanked 5 times in 5 posts
Default

The following code has it working

Code:
roundnUP = ((int)Math.Ceiling(Close[0]/100))*100;
suprsnipes is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Rounding error on Euro cunparis General Programming 5 01-04-2010 05:22 AM
Rounding to the nearest integer... 8DTK8 Strategy Development 4 11-30-2009 03:57 PM
Rounding confusion safetrading Indicator Development 3 08-28-2009 02:49 PM
rounding of values anniebee Suggestions And Feedback 4 06-21-2009 12:09 AM
Rounding off to an integer? Burga1 General Programming 1 01-02-2008 10:20 PM


All times are GMT -6. The time now is 08:52 AM.