Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Limit Orders Pile Up In Real Time

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

    Limit Orders Pile Up In Real Time

    Under certain conditions, my strategy will place a limit order on a five minute chart. If the order is not filled, it will cancel the order and place a new one. This works fine in back testing, but in real time, the new order is placed at the new price, but the old order is left working.

    Today, an "exitshortlimit" order was not filled during the first five minutes. A new "exitshortlimit" was placed, but the old one was not cancelled and both were filled leaving me long instead of out. What can I do to fix this?

    Thanks,

    John

    #2
    Can you paste in the code that generates these orders?
    RayNinjaTrader Customer Service

    Comment


      #3
      Code

      Thanks for the quick respose!

      {

      if (ToTime(Time[0]) >= ToTime(10, 00, 0)
      && ToTime(Time[0]) < ToTime(14, 00, 0)
      && MYBUYPRICE[0] > MYBUYCONDITION[0])
      {
      EnterLongLimit(DefaultQuantity, MYBUYPRICE[0], "BUY LOW");
      }
      if (MYEXITLONGPRICE[0] <= MYEXITLONGCONDITION[0])
      {
      ExitLongLimit(DefaultQuantity, MYEXITLONGPRICE[0], "EXIT LONG","BUY LOW");
      }
      if (ToTime(Time[0]) >= ToTime(14, 00, 0))
      {
      ExitLongLimit(DefaultQuantity, MYEXITLONGPRICE[0], "TIMED OUT","BUY LOW");
      }


      if (ToTime(Time[0]) >= ToTime(10, 00, 0)
      && ToTime(Time[0]) < ToTime(14, 00, 0)
      && MYSELLPRICE[0] < MYSELLCONDITION[0])
      {
      EnterShortLimit(DefaultQuantity, MYSELLPRICE[0], "SELL HIGH");
      }
      if (MYEXITSHORTPRICE[0] >= MYEXITSHORTCONDITION[0])
      {
      ExitShortLimit(DefaultQuantity, MYEXITSHORTPRICE[0], "EXIT SHORT","SELL HIGH");
      }
      if (ToTime(Time[0]) >= ToTime(14, 00, 0))
      {
      ExitShortLimit(DefaultQuantity, MYEXITSHORTPRICE[0], "TIMED OUT","SELL HIGH");
      }

      }

      Comment


        #4
        When you run your strategy, can you ensure that "Entries per direction" is set to a value of 1. This may be the problem.
        RayNinjaTrader Customer Service

        Comment


          #5
          Settings attached

          Ray,

          The attached jpg shows my settings. I am just trading a simulated account for now, but will be trading a Zen-Fire account as soon my account is approved and funded.

          I'll try again tomorrow and see how it goes.

          Thanks,

          John
          Attached Files

          Comment


            #6
            I think I need to add a time constraint to both exits...

            Ray,

            I was looking at my orders and the cancel and replace wasn't the problem. The strategy did exactly what I told it to. By a strange coincidence, the exit bar fullfilled the conditions of both exit strategies simultaneously and placed both orders. My bad.

            If I add the same time conditions from the entry to the first exit, the exits can't fire at the same time.

            Sorry to trouble you. I have been writing Easy Language for 20 years and C# for 1 week. There is a huge difference, but even after a week, I can see C# blows away Easy Language!

            Thanks again,

            John
            Attached Files

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by DJ888, 04-16-2024, 06:09 PM
            6 responses
            18 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by Jon17, Today, 04:33 PM
            0 responses
            1 view
            0 likes
            Last Post Jon17
            by Jon17
             
            Started by Javierw.ok, Today, 04:12 PM
            0 responses
            6 views
            0 likes
            Last Post Javierw.ok  
            Started by timmbbo, Today, 08:59 AM
            2 responses
            10 views
            0 likes
            Last Post bltdavid  
            Started by alifarahani, Today, 09:40 AM
            6 responses
            41 views
            0 likes
            Last Post alifarahani  
            Working...
            X