math.rounding question - NinjaTrader Programming | futures io social day trading
futures io futures trading


math.rounding question
Updated: Views / Replies:3,290 / 6
Created: by max-td Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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

Reply
 
Thread Tools Search this Thread
 

math.rounding question

  #1 (permalink)
Elite Member
Frankfurt
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: FGBL 6E B4
 
max-td's Avatar
 
Posts: 1,754 since Jun 2009
Thanks: 2,309 given, 917 received

math.rounding question

hi,
who knows how i make a rounding of an EMA to a wished format ie :

121.25 instead of 121.2469857...

i want to use my EMA-value in an indicator but want it rounded to 2 numbers behind the point - like 121.25 instead of 121.2469857
if i use an EMA in my chart it is always set to the ticksize of the instrument - but if i use it in an indicator the value is given in a long number.
i dont wanna transform it in a string - i need a double value.
any ideas ?
Thanks in advance.

max-td
Reply With Quote
 
  #2 (permalink)
Elite Member
Florida
 
Futures Experience: Intermediate
Platform: NT7
Favorite Futures: CL, NQ, NG
 
Posts: 456 since Jun 2009
Thanks: 1,359 given, 383 received

max,I normally just do this - not very elegant but it works for me...

kz

Print(Math.Round(doublevalue*
100)/100);

Reply With Quote
The following user says Thank You to zeller4 for this post:
 
  #3 (permalink)
Elite Member
Frankfurt
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: FGBL 6E B4
 
max-td's Avatar
 
Posts: 1,754 since Jun 2009
Thanks: 2,309 given, 917 received


well - found an interesting way to do this in NT-forum :

double EMArounded = Math.Round(valueEMA*100)/100;

Round an integer to nearest 10 - NinjaTrader Support Forum

and hey ... there is a guy involved called cunparis

max-td

Last edited by max-td; July 2nd, 2009 at 01:34 PM.
Reply With Quote
 
  #4 (permalink)
Just starting out...
Bloomfield Hills, MI
 
Futures Experience: Master
Platform: NinjaTrader / Neoticker
Favorite Futures: ES
 
Velocity's Avatar
 
Posts: 16 since Jun 2009
Thanks: 0 given, 7 received

Multiply it by four, then round it, then divide it by four.

Reply With Quote
 
  #5 (permalink)
Elite Member
Calcutta, India
 
Futures Experience: Intermediate
Platform: ArthaChitra
 
Posts: 278 since Jun 2009
Thanks: 161 given, 259 received

math.round(value,2)

where 2 represents 2 decimal places

Reply With Quote
The following 2 users say Thank You to bukkan for this post:
 
  #6 (permalink)
Elite Member
Frankfurt
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: FGBL 6E B4
 
max-td's Avatar
 
Posts: 1,754 since Jun 2009
Thanks: 2,309 given, 917 received

bukkan - great!
tested >> works too
and its the most elegant way i would say !

Very nice solution also for further codings.

max-td
Reply With Quote
The following user says Thank You to max-td for this post:
 
  #7 (permalink)
Trading for Fun
Here, GA
 
Futures Experience: Intermediate
Platform: Ninja
 
Posts: 146 since Jun 2009
Thanks: 1 given, 72 received

You may want to consider using Round2TickSize. It can be used on more than just price. It will round any number to the nearest Instrument Tick Size. For example if the indicator is placed on an ES chart the ES Tick Size is .25. So using this example will round any number to the nearest .25. There may be some issues doing it this way but I have not found them.

Indicator.Set(Instrument.MasterInstrument.Round2TickSize(value to be rounded);

Reply With Quote
The following user says Thank You to TAJTrades for this post:

Reply



futures io > > > > > math.rounding question

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Murrey Math Big Mike Traders Hideout 225 Yesterday 06:41 PM
C# Math Library MXASJ Matlab, R project and Python 15 April 14th, 2015 07:11 AM
Murray Math Lines - Question Todd NinjaTrader 6 July 27th, 2011 10:08 PM
Murray Math Discussion? jwhtrades Traders Hideout 5 July 27th, 2011 10:06 PM
anyone know how to fix rounding errors in NT7? Math.Round(CO.Value,4); Todd NinjaTrader Programming 5 May 25th, 2010 09:33 PM


All times are GMT -4. The time now is 02:49 AM.

Copyright © 2017 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
Page generated 2017-12-12 in 0.10 seconds with 19 queries on phoenix via your IP 54.90.207.75