![]() |
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
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Senior Member
Join Date: Nov 2007
Posts: 388
Thanks: 0
Thanked 0 times in 0 posts
|
Howdy,
This should be a fairly simple question. I wish to convert a variable with a decimal to only the integer value before the decimal, for example taking these figures: 4.02 4.24 4.74 3.88 3.34 I wish to convert these to: 4 4 4 3 3 I'd like to be able to compare when the "integer" value changed (in other words using the above example when the variable changed from a value of "4" to "3"...). Thank you in advance. |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
|
Burga1, you can just case them to be an int -
double myDouble = 3.34; int myInt = (int)myDouble;
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Nov 2007
Posts: 388
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks for the help!
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Show more than 2 decimal places | williammanda | General Programming | 6 | 03-05-2012 02:00 AM |
| Decimal Places in Control Box | DaveE | Version 7 Beta General Questions & Bug Reports | 3 | 10-29-2010 08:22 AM |
| FX price being truncated to 3 decimal places on chart when it should be 4 places. | bluelou | Charting | 2 | 08-05-2010 04:03 PM |
| Is there a way to see 2 decimal places in SMA? | gsmaster | Charting | 1 | 05-02-2008 12:25 PM |
| Finding decimal places | sbgtrading | General Programming | 3 | 11-25-2007 07:29 PM |