Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

RoundDownToTickSize()

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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?

    #2
    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!
    Attached Files
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      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


        #4
        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=19147
        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by arvidvanstaey, Today, 02:19 PM
        0 responses
        0 views
        0 likes
        Last Post arvidvanstaey  
        Started by mmckinnm, Today, 01:34 PM
        3 responses
        5 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by f.saeidi, Today, 01:32 PM
        2 responses
        5 views
        0 likes
        Last Post f.saeidi  
        Started by alifarahani, 04-19-2024, 09:40 AM
        9 responses
        55 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by Conceptzx, 10-11-2022, 06:38 AM
        3 responses
        60 views
        0 likes
        Last Post NinjaTrader_SeanH  
        Working...
        X