Dark Theme
Light Theme
Welcome to NexusFi: the best trading community on the planet, with over 200,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to
register in order to view the content of the threads and start contributing to our community.
It's free for basic access, or support us by becoming an Elite Member -- discounts are available after registering.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Updated February 4, 2016
Top Posters
looks_one
Jigsaw Trading
with 2 posts (1 thanks)
looks_two
Baseheadz
with 2 posts (1 thanks)
looks_3
bukkan
with 1 posts (1 thanks)
looks_4
cutzpr
with 1 posts (0 thanks)
trending_up
7,318 views
thumb_up
3 thanks given
group
5 followers
forum
7 posts
attach_file
0 attachments
August 19th, 2011, 12:37 PM
Las Vegas, USA
Experience: Master
Platform: Ninja, Multicharts, Proprietary
Trading: Energies
Posts: 48 since Jun 2011
Thanks Given: 1
Thanks Received: 9
Is there a way in NT to return the number of decimals in the TickSize of a futures contract ?
Thanks
Can you help answer these questions from other members on NexusFi?
Best Threads (Most Thanked) in the last 7 days on NexusFi
August 19th, 2011, 01:10 PM
Calcutta, India
Experience: Intermediate
Platform: ArthaChitra
Posts: 278 since Jun 2009
Thanks Given: 161
Thanks Received: 271
i use this code. i got it from the nt forum, cant remember the original author so my apologies.
Code
double d = TickSize - (int)TickSize;
string dstr = d.ToString();
int decimalplaces = 0;
if (dstr.IndexOf(".") > 0) decimalplaces = dstr.Length - 2;
else decimalplaces = 0;
August 19th, 2011, 01:38 PM
Las Vegas, USA
Experience: Master
Platform: Ninja, Multicharts, Proprietary
Trading: Energies
Posts: 48 since Jun 2011
Thanks Given: 1
Thanks Received: 9
I got a solution I did it a little differently.
if (TickSize == 0.1)
Rounding=1;
else if(TickSize == 0.01)
Rounding=2;
else if (TickSize == 0.25)
Rounding=2;
else if (TickSize == 0.005)
Rounding=3;
else if (TickSize == 0.0001)
Rounding=4;
else if (TickSize == 0.0005)
Rounding=4;
else if (TickSize == 0.00005)
Rounding=5;
February 4th, 2016, 08:08 AM
United States
Experience: None
Platform: TWS,Ninja Trader
Trading: Forex, Futures, Stocks
Posts: 35 since Apr 2012
Thanks Given: 10
Thanks Received: 10
Even though this is an old post, I had to reply. There is a better way to get the number of decimal places.
Code
//Number of decimals places
double decimals = Math . Log10 ( 1 / TickSize );
February 4th, 2016, 10:41 AM
Birmingham UK
Market Wizard
Experience: Intermediate
Platform: NinjaTrader
Broker: TST/Rithmic
Trading: YM/Gold
Posts: 3,550 since Dec 2012
Thanks Given: 17,423
Thanks Received: 8,430
cutzpr
Even though this is an old post, I had to reply. There is a better way to get the number of decimal places.
Code
//Number of decimals places double decimals = Math . Log10 ( 1 / TickSize );
Nice, but no cigar, needs to handle 0.5 increments (and the like.)
e.g.
Code
protected override void OnStartUp ()
{
double decimals = Math.Log10(1/Instrument.MasterInstrument.TickSize);
Print("TickSize for " + Instrument + " is " + Instrument.MasterInstrument.TickSize + " and has " + decimals + " decimal places");
}
Gives:
TickSize for FDXM 03-16 Eurex is 1 and has 0 decimal places
TickSize for FDAX 03-16 Eurex is 0.5 and has 0.301029995663981 decimal places
TickSize for ^DAX Xetra is 0.01 and has 2 decimal places
Cheers
February 4th, 2016, 11:18 AM
Bangkok
Vendor: www.jigsawtrading.com
Experience: Intermediate
Platform: MultiCharts.NET, S5, Ninj
Broker: AMP, S5, IB
Trading: ES
Posts: 2,988 since Nov 2010
Thanks Given: 831
Thanks Received: 10,399
bukkan
i use this code. i got it from the nt forum, cant remember the original author so my apologies.
Code
double d = TickSize - (int)TickSize;
string dstr = d.ToString();
int decimalplaces = 0;
if (dstr.IndexOf(".") > 0) decimalplaces = dstr.Length - 2;
else decimalplaces = 0;
Wont work in Europe
If you have any questions about the products or services provided, please send me a Private Message or use the futures.io " Ask Me Anything " thread
February 4th, 2016, 11:22 AM
Bangkok
Vendor: www.jigsawtrading.com
Experience: Intermediate
Platform: MultiCharts.NET, S5, Ninj
Broker: AMP, S5, IB
Trading: ES
Posts: 2,988 since Nov 2010
Thanks Given: 831
Thanks Received: 10,399
Code
decimal workTickSize = (decimal)tickSize;
workTickSize -= (int)workTickSize;
int decimals = 0;
while (workTickSize > 0)
{
decimals++;
workTickSize *= 10;
workTickSize -= (int)workTickSize;
}
the int "decimals" will contain what you need
If you have any questions about the products or services provided, please send me a Private Message or use the futures.io " Ask Me Anything " thread
Last Updated on February 4, 2016