Trading Articles
Article Categories
Article Tools
Decimals in TickSize
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
5,063 views
thumb_up
3 thanks given
group
6 followers
forum
7 posts
attach_file
0 attachments
Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
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 and simple.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
(login for full post details)
#1 (permalink )
Las Vegas, USA
Experience: Master
Platform: Ninja, Multicharts, Proprietary
Trading: Energies
Posts: 48 since Jun 2011
Thanks: 1 given,
9
received
Is there a way in NT to return the number of decimals in the TickSize of a futures contract ?
Thanks
Best Threads (Most Thanked) in the last 7 days on futures io
(login for full post details)
#3 (permalink )
Calcutta, India
Experience: Intermediate
Platform: ArthaChitra
Posts: 278 since Jun 2009
Thanks: 161 given,
269
received
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;
The following user says Thank You to bukkan for this post:
(login for full post details)
#4 (permalink )
Las Vegas, USA
Experience: Master
Platform: Ninja, Multicharts, Proprietary
Trading: Energies
Posts: 48 since Jun 2011
Thanks: 1 given,
9
received
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;
The following user says Thank You to Baseheadz for this post:
(login for full post details)
#5 (permalink )
United States
Experience: None
Platform: MT4,TWS,Ninja Trader
Trading: Forex
Posts: 35 since Apr 2012
Thanks: 10 given,
10
received
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 );
(login for full post details)
#6 (permalink )
Birmingham UK
Experience: Intermediate
Platform: NinjaTrader
Broker: TST/Rithmic
Trading: YM/Gold
Posts: 3,651 since Dec 2012
Thanks: 17,422 given,
8,403
received
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
(login for full post details)
#7 (permalink )
Web: Jigsaw Trading AMA: Ask Me Anything Webinars: Jigsaw Trading Webinars Elite offer: Click here
Posts: 2,977 since Nov 2010
Thanks: 823 given,
10,312
received
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
(login for full post details)
#8 (permalink )
Web: Jigsaw Trading AMA: Ask Me Anything Webinars: Jigsaw Trading Webinars Elite offer: Click here
Posts: 2,977 since Nov 2010
Thanks: 823 given,
10,312
received
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
The following user says Thank You to Jigsaw Trading for this post:
Last Updated on February 4, 2016
Right now
Ongoing
Right now
February
Coming soon
March
Register to Attend
Elite only