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 Mindset, 04-21-2026, 06:46 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        150 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        71 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        125 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        79 views
        0 likes
        Last Post PaulMohn  
        Working...
        X