NexusFi: Find Your Edge


Home Menu

 





Decimals in TickSize


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Baseheadz with 2 posts (1 thanks)
    2. looks_two Jigsaw Trading with 2 posts (1 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 ratfink with 1 posts (0 thanks)
    1. trending_up 7,308 views
    2. thumb_up 3 thanks given
    3. group 5 followers
    1. forum 7 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 Baseheadz 
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


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
$134M Ground Entry Contract in Disputed Final Review Aft …
Prediction Markets & Event Contracts
I Have a Thing Called Iran -- Trump Stays in DC as Airsp …
Prediction Markets & Event Contracts
Post-Summit Scorecard: $36M in May 15 Bets Settle Near-Z …
Prediction Markets & Event Contracts
Expiration Day: Wall Street Rallies on Peace Hopes While …
Prediction Markets & Event Contracts
Iran War Prediction Markets: Ceasefire 16%, Ground Invas …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
21 thanks
2026 Jlab journal
10 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
2026 Fire Horse
5 thanks
  #3 (permalink)
 bukkan 
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;


Reply With Quote
Thanked by:
  #4 (permalink)
 Baseheadz 
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;


Started this thread Reply With Quote
Thanked by:
  #5 (permalink)
 
cutzpr's Avatar
 cutzpr 
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); 


Reply With Quote
  #6 (permalink)
 
ratfink's Avatar
 ratfink 
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 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 NexusFi Trade Journal Reply With Quote
  #7 (permalink)
 
Jigsaw Trading's Avatar
 Jigsaw Trading 
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 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 NexusFi Trade Journal Reply With Quote
  #8 (permalink)
 
Jigsaw Trading's Avatar
 Jigsaw Trading 
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
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:




Last Updated on February 4, 2016


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts