Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
RoundDownToTickSize()
Collapse
X
-
RoundDownToTickSize()
If one has a target order based on some SMA for example, what is the default NT8 rounding for an indicator value that may not be at a certain tick size and what does rounddown do? Just to confirm, if the SMA for ES is at 2808.67, does the regular NT cover at 2808.75? or at 2808.50? I'm guessing the RoundDownToTickSize() will always be more conservative and cover at 2808.50?Tags: None
-
Hello Boonfly8,
Thanks for your post.
Here are the two definitions from the help guide:
Instrument.MasterInstrument.RoundToTickSize(): Returns a value that is rounded up to the nearest valid value evenly divisible by the instrument's tick size. Reference: https://ninjatrader.com/support/help...toticksize.htm
Instrument.MasterInstrument.RoundDownToTickSize(): Returns a value that is rounded down to the nearest valid value evenly divisible by the instrument's tick size. https://ninjatrader.com/support/help...toticksize.htm
I've attached a screenshot of three 20 period SMAs. The "orangeRed" SMA is without rounding and is what you would typically see. The "cornflowerblue" is the 20 period SMA "rounded". The "purple" is the 20 period SMA roundeddown. The output window shows the values as calculated. (CB = Current bar number).
If you would like to replicate, here is the code that was used for the plots:
MySMA[0] = SMA(20)[0];
MySMArounded[0] = Instrument.MasterInstrument.RoundToTickSize(SMA(20 )[0]);
MySMAroundeddown[0] = Instrument.MasterInstrument.RoundDownToTickSize(SM A(20)[0]);
Note: I made the bars transparent to better show the SMAs of interest.
To answer your specific question though, I have an inquiry into our development group and will update this thread when they advise.
edit: forgot to attach the attachement!Paul H.NinjaTrader Customer Service
-
Hey Paul,
Thank you for your note and the detailed response. Appreciate it as always. I think just as I suspected, it would make sense to use regular round (or round up) if you have a short position to cover and rounddown if you have a long position to cover. I noticed that it could be the case where if the SMA value you used in the example gets higher then the cover order will go to another tick, which may be "skiddish" if you know what I mean. One would probably use these methods to make the cover order "stay" at a particular price
Comment
-
Hello Boonfly8,
To answer your initial case question: "....ES is at 2808.67, does the regular NT cover at 2808.75? or at 2808.50? " It would round to 2808.75. as it would be using the RoundToTickSize methods previously linked.
Further information can be found here: https://ninjatrader.com/support/foru...ad.php?t=19147Paul H.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by MaupinFinche, Today, 05:08 AM
|
0 responses
2 views
0 likes
|
Last Post
by MaupinFinche
Today, 05:08 AM
|
||
Started by Enkidu, Yesterday, 06:40 AM
|
9 responses
35 views
0 likes
|
Last Post
by Enkidu
Yesterday, 01:11 PM
|
||
Started by Mestor, 03-10-2023, 01:50 AM
|
12 responses
307 views
0 likes
|
Last Post
by z.franck
Today, 04:29 AM
|
||
Started by AgriTrdr, 07-16-2023, 12:54 PM
|
32 responses
267 views
0 likes
|
Last Post
by f.saeidi
Yesterday, 06:49 AM
|
||
Started by Mestor, Today, 03:15 AM
|
0 responses
2 views
0 likes
|
Last Post
by Mestor
Today, 03:15 AM
|
Comment