Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Round up or down

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

    Round up or down

    Hi,

    Please help. I would like to check what is the function to perform the round up or down for a double value. Below is the formula I use. I want to submit the MidValue as a market order, which need to be a integer.

    private
    double MidValue = 0;
    MidValue = (High[
    1]+Low[1])/2;

    Thanks,
    Jess

    #2
    Hi Jess,

    You can cast a value as integer by putting (int) before the value. You may also get use of Math.Round() or Round2TickSize().

    I did not follow your request though, as market orders do not allow for specifying a price. Can you please clarify?
    Last edited by NinjaTrader_RyanM1; 09-20-2011, 10:33 AM.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Hi Ryan,

      Yes, you're right. That should be a stop order.

      Thanks,
      Jess

      Comment


        #4
        OK, I would not think that integer is used for the price, as these should always be doubles. You can use Round2TickSize like in example below:

        Code:
        double myStopPrice = Instrument.MasterInstrument.Round2TickSize(MidValue);
        Last edited by NinjaTrader_RyanM1; 09-23-2011, 08:02 AM.
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        66 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        41 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        24 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        27 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        53 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X