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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        37 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, Yesterday, 02:41 AM
        0 responses
        17 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        25 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        40 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        34 views
        0 likes
        Last Post CarlTrading  
        Working...
        X