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 kinfxhk, 07-14-2026, 09:39 AM
        0 responses
        90 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 10:18 AM
        0 responses
        92 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 09:50 AM
        0 responses
        70 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 07:21 AM
        0 responses
        87 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-11-2026, 02:11 AM
        0 responses
        64 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X