Can anybody tell my, how i can get significant digits for instrument? I am need it for writing to file.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Get significant digits for instrument
Collapse
X
-
Hello Dzammer,
I've done a quick google search for significant digits string c# and found the following links:
http://stackoverflow.com/questions/3...ficant-figures
https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx
https://msdn.microsoft.com/en-us/lib...v=vs.110).aspxChelsea B.NinjaTrader Customer Service
-
Ninja have not standart function to get digits of instrument? I have reading this examples and all have problem. When convert 1.2351 to string, we can get 1.23519999999. That numbers have different digit numbers. Do you have other issue?Originally posted by NinjaTrader_ChelseaB View PostHello Dzammer,
I've done a quick google search for significant digits string c# and found the following links:
http://stackoverflow.com/questions/3...ficant-figures
https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx
https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx
Comment
-
Hello,
No, NinjaTrader does not have a function to to set the number of digits in a string as this is already part of C#.
(NinjaScript is written in C#. Any existing C# functions are not going to be re-created)
Are you finding that using the correct Number format string is not working for you?
What is the output you are getting?
What is the output you are wanting?Chelsea B.NinjaTrader Customer Service
Comment
-
I use this:Originally posted by NinjaTrader_ChelseaB View PostHello,
No, NinjaTrader does not have a function to to set the number of digits in a string as this is already part of C#.
(NinjaScript is written in C#. Any existing C# functions are not going to be re-created)
Are you finding that using the correct Number format string is not working for you?
What is the output you are getting?
What is the output you are wanting?
It works write now.PHP Code:private int GetInstrumentDigits() { string digits_str = Instrument.MasterInstrument.TickSize.ToString(); return digits_str.Length - digits_str.IndexOf(Convert.ToChar(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator)) - 1; }
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
117 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
166 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
85 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|
||
|
Started by cmoran13, 04-16-2026, 01:02 PM
|
0 responses
130 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|
||
|
Started by PaulMohn, 04-10-2026, 11:11 AM
|
0 responses
88 views
0 likes
|
Last Post
by PaulMohn
04-10-2026, 11:11 AM
|

Comment