![]() |
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Certified NinjaScript Consultant
Join Date: Oct 2007
Location: Northern Illinois
Posts: 256
Thanks: 0
Thanked 3 times in 3 posts
|
How can you find the number of decimal places for an instrument with NinjaScript? (e.g. YI is 3 digits after the ".", YM has 0 digits, ES has 2 digits)
I have written a routine to find it, but it's cumbersome. Is there a way to get the value directly? |
|
|
|
|
|
#2 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Please check out TickSize.
http://www.ninjatrader-support.com/H.../TickSize.html
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Certified NinjaScript Consultant
Join Date: Oct 2007
Location: Northern Illinois
Posts: 256
Thanks: 0
Thanked 3 times in 3 posts
|
Yes...but TickSize does not explicitly tell me how many digits in the valuation.
TickSize for the YI is 0.001, to get the valuation for significant digits (3 in this case), you have to write a routine. One example would be to convert TickSize to a string ("0.001" in this case), and then counts how many characters are after the "." ...not a very pretty solution. |
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Counting places on a substring is the way I would do it.
Josh
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Trouble finding FX pairs in IB | ali_chambers | Connecting | 22 | 02-21-2008 03:44 PM |
| decimal sign in input of indicator | ceesvh | General Programming | 2 | 08-01-2007 03:34 AM |
| Decimal to Float Problem | PrTester | General Programming | 3 | 06-09-2007 09:35 AM |
| Decimal format -> stumped... | funk101 | General Programming | 2 | 05-15-2007 01:05 AM |
| Indicator convert from decimal to 32nds | Json | Indicator Development | 5 | 03-08-2007 01:45 AM |