PDA

View Full Version : Strategy: Rounding values to the nearest tick size


NinjaTrader_Josh
07-28-2009, 05:15 PM
Reference sample for NinjaTrader 6.5.xxxx.x or greater.

When NinjaTrader receives a request to submit an order, it automatically rounds any limit price or stop price to the nearest tick for that specific instrument. When debugging and/or printing out order information, this may not be apparent. NinjaTrader includes a callable function named Round2TickSize to apply the same internal rounding to any value you wish, which can help make comparisons easier.

This reference sample demonstrates the following concepts:

Rounding a value to the nearest tick

Important methods and properties used include:

Round2TickSize() (http://www.ninjatrader.com/support/helpGuides/nt7/masterinstrument_ro.htm)

Other methods and properties of interest include:

EnterLongLimit() (http://www.ninjatrader.com/support/helpGuides/nt7/enterlonglimit.htm)
ExitLong() (http://www.ninjatrader.com/support/helpGuides/nt7/exitlong.htm)
CrossAbove() (http://www.ninjatrader.com/support/helpGuides/nt7/crossabove.htm)
CrossBelow() (http://www.ninjatrader.com/support/helpGuides/nt7/crossbelow.htm)

Import instructions for NinjaTrader 6.5.XXXX.X or greater:

Download the file contained in this thread to your PC desktop
From the Control Center window, select the menu File > Utilities > Import NinjaScript
Select the downloaded file