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 Barry Milan, Yesterday, 10:35 PM
        5 responses
        16 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by DanielSanMartin, Yesterday, 02:37 PM
        2 responses
        13 views
        0 likes
        Last Post DanielSanMartin  
        Started by DJ888, 04-16-2024, 06:09 PM
        4 responses
        13 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by terofs, Today, 04:18 PM
        0 responses
        12 views
        0 likes
        Last Post terofs
        by terofs
         
        Started by nandhumca, Today, 03:41 PM
        0 responses
        8 views
        0 likes
        Last Post nandhumca  
        Working...
        X