Round2TickSize Function

Posted by admin | Indicators | Sunday 9 November 2008 12:15 am

One very useful function in Ninja Trader is Round2TickSize(). It rounds the price to the nearest tick of the instrument ( stock, futures, etc). I want to give a few examples , just to make it clear. Sometimes people wonder if  Round2TickSize() works by truncating or does it round down. It does neither, it returns the next tick nearest tick price REGARDLESS if it is higher or lower.

 

Now, take the ES 9 S&P Emini 500 ) for example, which has a 0.25 tick size. One half of a tick would be 0.125.

If the foo is 936.37, then  Round2TickSize (936.37) = 936.25 ( 0.12 difference DOWNWARD)

if the foo rises 0.01 to 936.38 , then Round2TickSize (936.38) = 936.5 ( 0.12 difference UPWARD)

And since a picture is worth a thousand words, a table has to be worth something. So here is a table of examples to wrap up this post.

     foo      Round2TickSize
936.37 936.25
936.38 936.5
936.62 936.50
936.63 936.75
936.87 936.75
936.88 937.00
937.12 937.00
937.13 937.25

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

You must be logged in to post a comment.