Decimals in TickSize - futures io
futures io futures trading



Decimals in TickSize


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Jigsaw Trading with 2 posts (1 thanks)
    2. looks_two Baseheadz with 2 posts (1 thanks)
    3. looks_3 bukkan with 1 posts (1 thanks)
    4. looks_4 cutzpr with 1 posts (0 thanks)
    1. trending_up 5,063 views
    2. thumb_up 3 thanks given
    3. group 6 followers
    1. forum 7 posts
    2. 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)

 
Search this Thread
 

Decimals in TickSize

(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

Started this thread Reply With Quote

Journal Challenge February 2021 results (so far):
Competing for $1500 in prizes from Topstep
looks_oneSBtrader82 's Trading Journalby SBtrader82
(167 thanks from 31 posts)
looks_twoJust BEING a Trader: Letting Go!!by iqgod
(116 thanks from 33 posts)
looks_3Wisdom is Emptinessby Mtype
(68 thanks from 25 posts)
looks_4Deetee’s DAX Trading Journal (time based)by Deetee
(31 thanks from 17 posts)
looks_5Journal for peanuts1956by peanuts1956
(23 thanks from 13 posts)
 
 
(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;

Reply With Quote
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;

Started this thread Reply With Quote
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
 
cutzpr's Avatar
 
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); 

Reply With Quote
 
(login for full post details)
  #6 (permalink)
Birmingham UK
 
Experience: Intermediate
Platform: NinjaTrader
Broker: TST/Rithmic
Trading: YM/Gold
 
ratfink's Avatar
 
Posts: 3,651 since Dec 2012
Thanks: 17,422 given, 8,403 received


cutzpr View Post
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

Travel Well
Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #7 (permalink)
Site Sponsor

Web: Jigsaw Trading
AMA: Ask Me Anything
Webinars: Jigsaw Trading Webinars
Elite offer: Click here
 
 
Jigsaw Trading's Avatar
 
Posts: 2,977 since Nov 2010
Thanks: 823 given, 10,312 received


bukkan View Post
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
Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #8 (permalink)
Site Sponsor

Web: Jigsaw Trading
AMA: Ask Me Anything
Webinars: Jigsaw Trading Webinars
Elite offer: Click here
 
 
Jigsaw Trading's Avatar
 
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
Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to Jigsaw Trading for this post:


futures io Trading Community Platforms and Indicators NinjaTrader > Decimals in TickSize


Last Updated on February 4, 2016


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Journal Challenge w/$1500 prizes from Topstep!

February
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Call Option Buying: The New Pain Trade? w/Carley Garner

Elite only
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts