NinjaTrader Support Forum  

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

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 11-25-2007, 06:49 PM   #1
sbgtrading
Certified NinjaScript Consultant
 
Join Date: Oct 2007
Location: Northern Illinois
Posts: 256
Thanks: 0
Thanked 3 times in 3 posts
Default Finding decimal places

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?
sbgtrading is offline  
Reply With Quote
Old 11-25-2007, 07:00 PM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

Please check out TickSize.
http://www.ninjatrader-support.com/H.../TickSize.html
NinjaTrader_Josh is offline  
Reply With Quote
Old 11-25-2007, 07:21 PM   #3
sbgtrading
Certified NinjaScript Consultant
 
Join Date: Oct 2007
Location: Northern Illinois
Posts: 256
Thanks: 0
Thanked 3 times in 3 posts
Default

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.
sbgtrading is offline  
Reply With Quote
Old 11-25-2007, 07:29 PM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

Counting places on a substring is the way I would do it.
NinjaTrader_Josh 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
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


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